// AUTOGENERATED FILE. DO NOT MODIFY.

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

#include "unpack8.h"



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

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);
}

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

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);
}

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

	int32_t value;

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

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

	uint32_t value;

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

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

	int32_t value;

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

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

	uint32_t value;

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

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

	int32_t value;

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

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

	uint32_t value;

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

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

	int32_t value;

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

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

	uint32_t value;

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

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

	int32_t value;

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

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

	uint32_t value;

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

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

	int32_t value;

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

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

	uint32_t value;

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

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

	int32_t value;

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

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

	uint32_t value;

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

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

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);
}

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

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);
}

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

	int32_t value;

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

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

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

	uint32_t value;

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

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

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

	int32_t value;

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

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

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

	uint32_t value;

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

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

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

	int32_t value;

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

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

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

	uint32_t value;

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

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

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

	int32_t value;

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

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

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

	uint32_t value;

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

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

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

	int32_t value;

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

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

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

	uint32_t value;

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

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

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

	int32_t value;

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

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

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

	uint32_t value;

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

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

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

	int32_t value;

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

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

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

	uint32_t value;

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

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

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

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

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

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

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

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

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

	int32_t value;

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

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

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

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

	uint32_t value;

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

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

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

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

	int32_t value;

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

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

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

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

	uint32_t value;

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

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

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

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

	int32_t value;

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

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

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

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

	uint32_t value;

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

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

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

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

	int32_t value;

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

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

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

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

	uint32_t value;

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

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

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

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

	int32_t value;

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

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

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

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

	uint32_t value;

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

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

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

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

	int32_t value;

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

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

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

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

	uint32_t value;

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

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

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

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

	int32_t value;

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

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

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

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

	uint32_t value;

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

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

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

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

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);
}

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

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);
}

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

	int32_t value;

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

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

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

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

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

	uint32_t value;

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

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

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

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

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

	int32_t value;

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

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

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

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);
}

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

	uint32_t value;

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

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

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

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);
}

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

	int32_t value;

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

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

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

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

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

	uint32_t value;

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

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

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

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

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

	int32_t value;

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

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

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

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

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

	uint32_t value;

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

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

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

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

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

	int32_t value;

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

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

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

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

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

	uint32_t value;

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

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

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

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

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

	int32_t value;

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

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

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

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

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

	uint32_t value;

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

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

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

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

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

	int32_t value;

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

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

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

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

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

	uint32_t value;

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

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

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

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

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

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);
}

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

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);
}

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

	int32_t value;

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

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

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

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

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

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

	uint32_t value;

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

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

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

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

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

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

	int32_t value;

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

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

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

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

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

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

	uint32_t value;

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

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

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

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

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

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

	int32_t value;

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

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

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

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

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

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

	uint32_t value;

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

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

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

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

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

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

	int32_t value;

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

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

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

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

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

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

	uint32_t value;

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

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

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

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

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

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

	int32_t value;

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

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

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

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

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

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

	uint32_t value;

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

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

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

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

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

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

	int32_t value;

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

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

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

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

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

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

	uint32_t value;

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

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

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

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

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

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

	int32_t value;

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

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

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

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

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

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

	uint32_t value;

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

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

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

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

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

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

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);
}

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

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);
}

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

	int32_t value;

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

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

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

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

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

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

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

	uint32_t value;

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

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

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

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

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

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

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

	int32_t value;

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

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

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

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

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

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

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

	uint32_t value;

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

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

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

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

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

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

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

	int32_t value;

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

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

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

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

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

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

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

	uint32_t value;

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

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

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

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

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

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

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

	int32_t value;

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

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

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

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

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

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);
}

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

	uint32_t value;

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

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

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

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

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

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);
}

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

	int32_t value;

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

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

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

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

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

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

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

	uint32_t value;

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

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

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

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

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

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

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

	int32_t value;

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

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

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

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

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

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

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

	uint32_t value;

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

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

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

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

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

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

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

	int32_t value;

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

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

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

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

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

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

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

	uint32_t value;

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

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

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

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

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

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

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

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);
}

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

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);
}

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

	int32_t value;

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

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

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

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

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

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

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

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

	uint32_t value;

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

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

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

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

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

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

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

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

	int32_t value;

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

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

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

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

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

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

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

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

	uint32_t value;

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

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

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

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

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

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

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

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

	int32_t value;

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

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

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

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

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

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

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

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

	uint32_t value;

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

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

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

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

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

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

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

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

	int32_t value;

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

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

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

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

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

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

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

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

	uint32_t value;

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

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

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

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

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

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

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

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

	int32_t value;

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

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

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

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

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

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

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);
}

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

	uint32_t value;

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

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

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

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

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

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

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);
}

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

	int32_t value;

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

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

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

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

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

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

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

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

	uint32_t value;

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

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

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

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

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

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

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

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

	int32_t value;

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

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

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

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

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

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

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

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

	uint32_t value;

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

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

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

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

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

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

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

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

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);
}

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

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);
}

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

	int32_t value;

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

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

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

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

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

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

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

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

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

	uint32_t value;

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

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

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

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

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

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

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

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

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

	int32_t value;

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

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

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

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

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

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

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

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

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

	uint32_t value;

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

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

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

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

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

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

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

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

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

	int32_t value;

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

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

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

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

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

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

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

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

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

	uint32_t value;

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

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

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

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

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

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

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

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

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

	int32_t value;

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

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

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

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

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

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

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

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

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

	uint32_t value;

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

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

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

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

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

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

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

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

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

	int32_t value;

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

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

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

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

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

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

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

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

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

	uint32_t value;

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

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

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

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

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

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

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

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

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

	int32_t value;

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

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

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

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

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

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

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

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);
}

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

	uint32_t value;

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

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

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

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

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

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

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

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);
}

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

	int32_t value;

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

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

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

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

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

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

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

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

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

	uint32_t value;

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

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

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

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

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

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

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

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

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

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);
}

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

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);
}

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

	int32_t value;

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

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

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

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

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

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

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

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

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

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

	uint32_t value;

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

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

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

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

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

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

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

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

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

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

	int32_t value;

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

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

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

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

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

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

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

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

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

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

	uint32_t value;

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

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

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

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

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

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

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

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

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

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

	int32_t value;

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

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

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

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

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

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

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

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

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

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

	uint32_t value;

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

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

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

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

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

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

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

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

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

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

	int32_t value;

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

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

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

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

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

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

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

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

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

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

	uint32_t value;

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

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

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

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

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

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

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

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

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

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

	int32_t value;

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

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

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

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

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

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

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

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

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

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

	uint32_t value;

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

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

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

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

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

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

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

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

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

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

	int32_t value;

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

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

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

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

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

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

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

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

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

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

	uint32_t value;

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

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

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

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

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

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

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

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

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

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

	int32_t value;

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

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

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

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

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

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

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

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

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

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

	uint32_t value;

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

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

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

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

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

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

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

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

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

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

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);
}

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

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);
}

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

	int32_t value;

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

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

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

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

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

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

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

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

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

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

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

	uint32_t value;

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

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

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

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

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

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

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

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

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

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

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

	int32_t value;

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

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

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

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

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

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

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

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

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

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

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

	uint32_t value;

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

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

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

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

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

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

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

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

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

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

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

	int32_t value;

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

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

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

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

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

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

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

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

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);
}

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

	uint32_t value;

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

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

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

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

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

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

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

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

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);
}

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

	int32_t value;

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

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

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);
}

static void unpack_10_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 10 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 80 bits of data.
	// Input must be at least 11 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);
}

static void unpack_10_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 10 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 80 bits of data.
	// Input must be at least 11 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);
}

static void unpack_10_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 10 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 80 bits of data.
	// Input must be at least 11 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);
}

static void unpack_10_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 10 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 80 bits of data.
	// Input must be at least 11 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);
}

static void unpack_10_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 10 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 80 bits of data.
	// Input must be at least 11 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);
}

static void unpack_10_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 10 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 80 bits of data.
	// Input must be at least 11 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);
}

static void unpack_10_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 10 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 80 bits of data.
	// Input must be at least 11 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);
}

static void unpack_11_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 11 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 88 bits of data.
	// Input must be at least 11 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);
}

static void unpack_11_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 11 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 88 bits of data.
	// Input must be at least 11 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);
}

static void unpack_11_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 11 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 88 bits of data.
	// Input must be at least 12 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);
}

static void unpack_11_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 11 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 88 bits of data.
	// Input must be at least 12 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);
}

static void unpack_11_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 11 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 88 bits of data.
	// Input must be at least 12 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);
}

static void unpack_11_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 11 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 88 bits of data.
	// Input must be at least 12 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);
}

static void unpack_11_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 11 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 88 bits of data.
	// Input must be at least 12 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);
}

static void unpack_11_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 11 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 88 bits of data.
	// Input must be at least 12 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);
}

static void unpack_11_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 11 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 88 bits of data.
	// Input must be at least 12 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);
}

static void unpack_11_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 11 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 88 bits of data.
	// Input must be at least 12 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);
}

static void unpack_11_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 11 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 88 bits of data.
	// Input must be at least 12 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);
}

static void unpack_11_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 11 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 88 bits of data.
	// Input must be at least 12 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);
}

static void unpack_11_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 11 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 88 bits of data.
	// Input must be at least 12 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);
}

static void unpack_11_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 11 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 88 bits of data.
	// Input must be at least 12 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);
}

static void unpack_11_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 11 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 88 bits of data.
	// Input must be at least 12 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);
}

static void unpack_11_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 11 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 88 bits of data.
	// Input must be at least 12 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);
}

static void unpack_12_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 12 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 96 bits of data.
	// Input must be at least 12 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);
}

static void unpack_12_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 12 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 96 bits of data.
	// Input must be at least 12 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);
}

static void unpack_12_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 12 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 96 bits of data.
	// Input must be at least 13 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);
}

static void unpack_12_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 12 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 96 bits of data.
	// Input must be at least 13 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);
}

static void unpack_12_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 12 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 96 bits of data.
	// Input must be at least 13 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);
}

static void unpack_12_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 12 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 96 bits of data.
	// Input must be at least 13 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);
}

static void unpack_12_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 12 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 96 bits of data.
	// Input must be at least 13 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);
}

static void unpack_12_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 12 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 96 bits of data.
	// Input must be at least 13 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);
}

static void unpack_12_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 12 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 96 bits of data.
	// Input must be at least 13 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);
}

static void unpack_12_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 12 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 96 bits of data.
	// Input must be at least 13 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);
}

static void unpack_12_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 12 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 96 bits of data.
	// Input must be at least 13 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);
}

static void unpack_12_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 12 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 96 bits of data.
	// Input must be at least 13 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);
}

static void unpack_12_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 12 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 96 bits of data.
	// Input must be at least 13 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);
}

static void unpack_12_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 12 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 96 bits of data.
	// Input must be at least 13 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);
}

static void unpack_12_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 12 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 96 bits of data.
	// Input must be at least 13 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);
}

static void unpack_12_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 12 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 96 bits of data.
	// Input must be at least 13 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);
}

static void unpack_13_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 104 bits of data.
	// Input must be at least 13 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);
}

static void unpack_13_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 104 bits of data.
	// Input must be at least 13 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);
}

static void unpack_13_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 104 bits of data.
	// Input must be at least 14 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);
}

static void unpack_13_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 104 bits of data.
	// Input must be at least 14 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);
}

static void unpack_13_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 104 bits of data.
	// Input must be at least 14 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);
}

static void unpack_13_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 104 bits of data.
	// Input must be at least 14 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);
}

static void unpack_13_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 104 bits of data.
	// Input must be at least 14 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);
}

static void unpack_13_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 104 bits of data.
	// Input must be at least 14 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);
}

static void unpack_13_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 104 bits of data.
	// Input must be at least 14 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);
}

static void unpack_13_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 104 bits of data.
	// Input must be at least 14 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);
}

static void unpack_13_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 104 bits of data.
	// Input must be at least 14 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);
}

static void unpack_13_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 104 bits of data.
	// Input must be at least 14 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);
}

static void unpack_13_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 104 bits of data.
	// Input must be at least 14 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);
}

static void unpack_13_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 104 bits of data.
	// Input must be at least 14 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);
}

static void unpack_13_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 104 bits of data.
	// Input must be at least 14 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);
}

static void unpack_13_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 104 bits of data.
	// Input must be at least 14 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);
}

static void unpack_14_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 112 bits of data.
	// Input must be at least 14 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);
}

static void unpack_14_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 112 bits of data.
	// Input must be at least 14 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);
}

static void unpack_14_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 112 bits of data.
	// Input must be at least 15 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);
}

static void unpack_14_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 112 bits of data.
	// Input must be at least 15 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);
}

static void unpack_14_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 112 bits of data.
	// Input must be at least 15 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);
}

static void unpack_14_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 112 bits of data.
	// Input must be at least 15 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);
}

static void unpack_14_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 112 bits of data.
	// Input must be at least 15 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);
}

static void unpack_14_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 112 bits of data.
	// Input must be at least 15 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);
}

static void unpack_14_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 112 bits of data.
	// Input must be at least 15 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);
}

static void unpack_14_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 112 bits of data.
	// Input must be at least 15 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);
}

static void unpack_14_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 112 bits of data.
	// Input must be at least 15 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);
}

static void unpack_14_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 112 bits of data.
	// Input must be at least 15 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);
}

static void unpack_14_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 112 bits of data.
	// Input must be at least 15 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);
}

static void unpack_14_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 112 bits of data.
	// Input must be at least 15 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);
}

static void unpack_14_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 112 bits of data.
	// Input must be at least 15 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);
}

static void unpack_14_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 112 bits of data.
	// Input must be at least 15 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);
}

static void unpack_15_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 120 bits of data.
	// Input must be at least 15 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);
}

static void unpack_15_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 120 bits of data.
	// Input must be at least 15 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);
}

static void unpack_15_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 120 bits of data.
	// Input must be at least 16 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);
}

static void unpack_15_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 120 bits of data.
	// Input must be at least 16 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);
}

static void unpack_15_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 120 bits of data.
	// Input must be at least 16 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);
}

static void unpack_15_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 120 bits of data.
	// Input must be at least 16 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);
}

static void unpack_15_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 120 bits of data.
	// Input must be at least 16 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);
}

static void unpack_15_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 120 bits of data.
	// Input must be at least 16 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);
}

static void unpack_15_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 120 bits of data.
	// Input must be at least 16 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);
}

static void unpack_15_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 120 bits of data.
	// Input must be at least 16 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);
}

static void unpack_15_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 120 bits of data.
	// Input must be at least 16 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);
}

static void unpack_15_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 120 bits of data.
	// Input must be at least 16 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);
}

static void unpack_15_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 120 bits of data.
	// Input must be at least 16 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);
}

static void unpack_15_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 120 bits of data.
	// Input must be at least 16 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);
}

static void unpack_15_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 120 bits of data.
	// Input must be at least 16 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);
}

static void unpack_15_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 120 bits of data.
	// Input must be at least 16 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);
}

static void unpack_16_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 128 bits of data.
	// Input must be at least 16 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);
}

static void unpack_16_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 128 bits of data.
	// Input must be at least 16 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);
}

static void unpack_16_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 128 bits of data.
	// Input must be at least 17 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);
}

static void unpack_16_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 128 bits of data.
	// Input must be at least 17 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);
}

static void unpack_16_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 128 bits of data.
	// Input must be at least 17 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);
}

static void unpack_16_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 128 bits of data.
	// Input must be at least 17 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);
}

static void unpack_16_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 128 bits of data.
	// Input must be at least 17 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);
}

static void unpack_16_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 128 bits of data.
	// Input must be at least 17 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);
}

static void unpack_16_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 128 bits of data.
	// Input must be at least 17 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);
}

static void unpack_16_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 128 bits of data.
	// Input must be at least 17 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);
}

static void unpack_16_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 128 bits of data.
	// Input must be at least 17 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);
}

static void unpack_16_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 128 bits of data.
	// Input must be at least 17 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);
}

static void unpack_16_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 128 bits of data.
	// Input must be at least 17 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);
}

static void unpack_16_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 128 bits of data.
	// Input must be at least 17 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);
}

static void unpack_16_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 128 bits of data.
	// Input must be at least 17 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);
}

static void unpack_16_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 128 bits of data.
	// Input must be at least 17 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);
}

static void unpack_17_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 136 bits of data.
	// Input must be at least 17 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);
}

static void unpack_17_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 136 bits of data.
	// Input must be at least 17 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);
}

static void unpack_17_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 136 bits of data.
	// Input must be at least 18 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);
}

static void unpack_17_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 136 bits of data.
	// Input must be at least 18 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);
}

static void unpack_17_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 136 bits of data.
	// Input must be at least 18 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);
}

static void unpack_17_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 136 bits of data.
	// Input must be at least 18 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);
}

static void unpack_17_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 136 bits of data.
	// Input must be at least 18 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);
}

static void unpack_17_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 136 bits of data.
	// Input must be at least 18 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);
}

static void unpack_17_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 136 bits of data.
	// Input must be at least 18 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);
}

static void unpack_17_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 136 bits of data.
	// Input must be at least 18 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);
}

static void unpack_17_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 136 bits of data.
	// Input must be at least 18 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);
}

static void unpack_17_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 136 bits of data.
	// Input must be at least 18 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);
}

static void unpack_17_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 136 bits of data.
	// Input must be at least 18 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);
}

static void unpack_17_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 136 bits of data.
	// Input must be at least 18 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);
}

static void unpack_17_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 136 bits of data.
	// Input must be at least 18 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);
}

static void unpack_17_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 136 bits of data.
	// Input must be at least 18 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);
}

static void unpack_18_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 18 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 144 bits of data.
	// Input must be at least 18 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);
}

static void unpack_18_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 18 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 144 bits of data.
	// Input must be at least 18 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);
}

static void unpack_18_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 18 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 144 bits of data.
	// Input must be at least 19 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);
}

static void unpack_18_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 18 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 144 bits of data.
	// Input must be at least 19 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);
}

static void unpack_18_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 18 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 144 bits of data.
	// Input must be at least 19 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);
}

static void unpack_18_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 18 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 144 bits of data.
	// Input must be at least 19 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);
}

static void unpack_18_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 18 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 144 bits of data.
	// Input must be at least 19 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);
}

static void unpack_18_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 18 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 144 bits of data.
	// Input must be at least 19 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);
}

static void unpack_18_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 18 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 144 bits of data.
	// Input must be at least 19 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);
}

static void unpack_18_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 18 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 144 bits of data.
	// Input must be at least 19 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);
}

static void unpack_18_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 18 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 144 bits of data.
	// Input must be at least 19 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);
}

static void unpack_18_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 18 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 144 bits of data.
	// Input must be at least 19 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);
}

static void unpack_18_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 18 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 144 bits of data.
	// Input must be at least 19 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);
}

static void unpack_18_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 18 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 144 bits of data.
	// Input must be at least 19 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);
}

static void unpack_18_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 18 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 144 bits of data.
	// Input must be at least 19 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);
}

static void unpack_18_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 18 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 144 bits of data.
	// Input must be at least 19 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);
}

static void unpack_19_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 152 bits of data.
	// Input must be at least 19 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);
}

static void unpack_19_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 152 bits of data.
	// Input must be at least 19 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);
}

static void unpack_19_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 152 bits of data.
	// Input must be at least 20 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);
}

static void unpack_19_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 152 bits of data.
	// Input must be at least 20 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);
}

static void unpack_19_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 152 bits of data.
	// Input must be at least 20 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);
}

static void unpack_19_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 152 bits of data.
	// Input must be at least 20 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);
}

static void unpack_19_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 152 bits of data.
	// Input must be at least 20 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);
}

static void unpack_19_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 152 bits of data.
	// Input must be at least 20 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);
}

static void unpack_19_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 152 bits of data.
	// Input must be at least 20 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);
}

static void unpack_19_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 152 bits of data.
	// Input must be at least 20 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);
}

static void unpack_19_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 152 bits of data.
	// Input must be at least 20 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);
}

static void unpack_19_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 152 bits of data.
	// Input must be at least 20 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);
}

static void unpack_19_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 152 bits of data.
	// Input must be at least 20 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);
}

static void unpack_19_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 152 bits of data.
	// Input must be at least 20 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);
}

static void unpack_19_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 152 bits of data.
	// Input must be at least 20 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);
}

static void unpack_19_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 152 bits of data.
	// Input must be at least 20 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);
}

static void unpack_20_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 160 bits of data.
	// Input must be at least 20 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);
}

static void unpack_20_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 160 bits of data.
	// Input must be at least 20 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);
}

static void unpack_20_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 160 bits of data.
	// Input must be at least 21 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);
}

static void unpack_20_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 160 bits of data.
	// Input must be at least 21 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);
}

static void unpack_20_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 160 bits of data.
	// Input must be at least 21 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);
}

static void unpack_20_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 160 bits of data.
	// Input must be at least 21 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);
}

static void unpack_20_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 160 bits of data.
	// Input must be at least 21 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);
}

static void unpack_20_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 160 bits of data.
	// Input must be at least 21 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);
}

static void unpack_20_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 160 bits of data.
	// Input must be at least 21 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);
}

static void unpack_20_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 160 bits of data.
	// Input must be at least 21 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);
}

static void unpack_20_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 160 bits of data.
	// Input must be at least 21 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);
}

static void unpack_20_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 160 bits of data.
	// Input must be at least 21 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);
}

static void unpack_20_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 160 bits of data.
	// Input must be at least 21 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);
}

static void unpack_20_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 160 bits of data.
	// Input must be at least 21 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);
}

static void unpack_20_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 160 bits of data.
	// Input must be at least 21 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);
}

static void unpack_20_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 160 bits of data.
	// Input must be at least 21 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);
}

static void unpack_21_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 21 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 168 bits of data.
	// Input must be at least 21 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);
}

static void unpack_21_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 21 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 168 bits of data.
	// Input must be at least 21 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);
}

static void unpack_21_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 21 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 168 bits of data.
	// Input must be at least 22 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);
}

static void unpack_21_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 21 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 168 bits of data.
	// Input must be at least 22 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);
}

static void unpack_21_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 21 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 168 bits of data.
	// Input must be at least 22 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);
}

static void unpack_21_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 21 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 168 bits of data.
	// Input must be at least 22 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);
}

static void unpack_21_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 21 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 168 bits of data.
	// Input must be at least 22 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);
}

static void unpack_21_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 21 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 168 bits of data.
	// Input must be at least 22 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);
}

static void unpack_21_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 21 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 168 bits of data.
	// Input must be at least 22 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);
}

static void unpack_21_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 21 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 168 bits of data.
	// Input must be at least 22 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);
}

static void unpack_21_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 21 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 168 bits of data.
	// Input must be at least 22 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);
}

static void unpack_21_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 21 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 168 bits of data.
	// Input must be at least 22 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);
}

static void unpack_21_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 21 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 168 bits of data.
	// Input must be at least 22 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);
}

static void unpack_21_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 21 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 168 bits of data.
	// Input must be at least 22 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);
}

static void unpack_21_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 21 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 168 bits of data.
	// Input must be at least 22 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);
}

static void unpack_21_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 21 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 168 bits of data.
	// Input must be at least 22 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);
}

static void unpack_22_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 22 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 176 bits of data.
	// Input must be at least 22 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);
}

static void unpack_22_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 22 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 176 bits of data.
	// Input must be at least 22 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);
}

static void unpack_22_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 22 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 176 bits of data.
	// Input must be at least 23 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);
}

static void unpack_22_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 22 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 176 bits of data.
	// Input must be at least 23 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);
}

static void unpack_22_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 22 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 176 bits of data.
	// Input must be at least 23 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);
}

static void unpack_22_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 22 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 176 bits of data.
	// Input must be at least 23 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);
}

static void unpack_22_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 22 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 176 bits of data.
	// Input must be at least 23 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);
}

static void unpack_22_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 22 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 176 bits of data.
	// Input must be at least 23 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);
}

static void unpack_22_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 22 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 176 bits of data.
	// Input must be at least 23 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);
}

static void unpack_22_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 22 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 176 bits of data.
	// Input must be at least 23 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);
}

static void unpack_22_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 22 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 176 bits of data.
	// Input must be at least 23 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);
}

static void unpack_22_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 22 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 176 bits of data.
	// Input must be at least 23 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);
}

static void unpack_22_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 22 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 176 bits of data.
	// Input must be at least 23 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);
}

static void unpack_22_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 22 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 176 bits of data.
	// Input must be at least 23 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);
}

static void unpack_22_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 22 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 176 bits of data.
	// Input must be at least 23 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);
}

static void unpack_22_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 22 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 176 bits of data.
	// Input must be at least 23 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);
}

static void unpack_23_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 23 values into output
	// Values are 8-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 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);
}

static void unpack_23_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 23 values into output
	// Values are 8-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 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);
}

static void unpack_23_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 23 values into output
	// Values are 8-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 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);
}

static void unpack_23_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 23 values into output
	// Values are 8-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 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);
}

static void unpack_23_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 23 values into output
	// Values are 8-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 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);
}

static void unpack_23_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 23 values into output
	// Values are 8-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 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);
}

static void unpack_23_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 23 values into output
	// Values are 8-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 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);
}

static void unpack_23_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 23 values into output
	// Values are 8-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 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);
}

static void unpack_23_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 23 values into output
	// Values are 8-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 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);
}

static void unpack_23_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 23 values into output
	// Values are 8-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 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);
}

static void unpack_23_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 23 values into output
	// Values are 8-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 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);
}

static void unpack_23_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 23 values into output
	// Values are 8-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 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);
}

static void unpack_23_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 23 values into output
	// Values are 8-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 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);
}

static void unpack_23_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 23 values into output
	// Values are 8-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 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);
}

static void unpack_23_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 23 values into output
	// Values are 8-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 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);
}

static void unpack_23_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 23 values into output
	// Values are 8-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 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);
}

static void unpack_24_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 24 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 192 bits of data.
	// Input must be at least 24 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);
}

static void unpack_24_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 24 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 192 bits of data.
	// Input must be at least 24 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);
}

static void unpack_24_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 24 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 192 bits of data.
	// Input must be at least 25 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);
}

static void unpack_24_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 24 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 192 bits of data.
	// Input must be at least 25 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);
}

static void unpack_24_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 24 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 192 bits of data.
	// Input must be at least 25 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);
}

static void unpack_24_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 24 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 192 bits of data.
	// Input must be at least 25 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);
}

static void unpack_24_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 24 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 192 bits of data.
	// Input must be at least 25 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);
}

static void unpack_24_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 24 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 192 bits of data.
	// Input must be at least 25 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);
}

static void unpack_24_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 24 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 192 bits of data.
	// Input must be at least 25 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);
}

static void unpack_24_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 24 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 192 bits of data.
	// Input must be at least 25 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);
}

static void unpack_24_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 24 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 192 bits of data.
	// Input must be at least 25 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);
}

static void unpack_24_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 24 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 192 bits of data.
	// Input must be at least 25 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);
}

static void unpack_24_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 24 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 192 bits of data.
	// Input must be at least 25 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);
}

static void unpack_24_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 24 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 192 bits of data.
	// Input must be at least 25 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);
}

static void unpack_24_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 24 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 192 bits of data.
	// Input must be at least 25 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);
}

static void unpack_24_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 24 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 192 bits of data.
	// Input must be at least 25 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);
}

static void unpack_25_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 25 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 200 bits of data.
	// Input must be at least 25 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);
}

static void unpack_25_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 25 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 200 bits of data.
	// Input must be at least 25 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);
}

static void unpack_25_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 25 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 200 bits of data.
	// Input must be at least 26 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);
}

static void unpack_25_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 25 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 200 bits of data.
	// Input must be at least 26 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);
}

static void unpack_25_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 25 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 200 bits of data.
	// Input must be at least 26 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);
}

static void unpack_25_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 25 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 200 bits of data.
	// Input must be at least 26 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);
}

static void unpack_25_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 25 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 200 bits of data.
	// Input must be at least 26 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);
}

static void unpack_25_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 25 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 200 bits of data.
	// Input must be at least 26 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);
}

static void unpack_25_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 25 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 200 bits of data.
	// Input must be at least 26 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);
}

static void unpack_25_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 25 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 200 bits of data.
	// Input must be at least 26 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);
}

static void unpack_25_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 25 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 200 bits of data.
	// Input must be at least 26 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);
}

static void unpack_25_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 25 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 200 bits of data.
	// Input must be at least 26 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);
}

static void unpack_25_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 25 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 200 bits of data.
	// Input must be at least 26 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);
}

static void unpack_25_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 25 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 200 bits of data.
	// Input must be at least 26 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);
}

static void unpack_25_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 25 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 200 bits of data.
	// Input must be at least 26 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);
}

static void unpack_25_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 25 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 200 bits of data.
	// Input must be at least 26 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);
}

static void unpack_26_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 26 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 208 bits of data.
	// Input must be at least 26 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);
}

static void unpack_26_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 26 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 208 bits of data.
	// Input must be at least 26 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);
}

static void unpack_26_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 26 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 208 bits of data.
	// Input must be at least 27 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);
}

static void unpack_26_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 26 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 208 bits of data.
	// Input must be at least 27 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);
}

static void unpack_26_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 26 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 208 bits of data.
	// Input must be at least 27 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);
}

static void unpack_26_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 26 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 208 bits of data.
	// Input must be at least 27 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);
}

static void unpack_26_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 26 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 208 bits of data.
	// Input must be at least 27 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);
}

static void unpack_26_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 26 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 208 bits of data.
	// Input must be at least 27 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);
}

static void unpack_26_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 26 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 208 bits of data.
	// Input must be at least 27 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);
}

static void unpack_26_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 26 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 208 bits of data.
	// Input must be at least 27 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);
}

static void unpack_26_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 26 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 208 bits of data.
	// Input must be at least 27 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);
}

static void unpack_26_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 26 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 208 bits of data.
	// Input must be at least 27 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);
}

static void unpack_26_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 26 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 208 bits of data.
	// Input must be at least 27 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);
}

static void unpack_26_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 26 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 208 bits of data.
	// Input must be at least 27 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);
}

static void unpack_26_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 26 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 208 bits of data.
	// Input must be at least 27 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);
}

static void unpack_26_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 26 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 208 bits of data.
	// Input must be at least 27 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);
}

static void unpack_27_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 27 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 216 bits of data.
	// Input must be at least 27 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);
}

static void unpack_27_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 27 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 216 bits of data.
	// Input must be at least 27 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);
}

static void unpack_27_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 27 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 216 bits of data.
	// Input must be at least 28 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);
}

static void unpack_27_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 27 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 216 bits of data.
	// Input must be at least 28 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);
}

static void unpack_27_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 27 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 216 bits of data.
	// Input must be at least 28 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);
}

static void unpack_27_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 27 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 216 bits of data.
	// Input must be at least 28 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);
}

static void unpack_27_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 27 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 216 bits of data.
	// Input must be at least 28 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);
}

static void unpack_27_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 27 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 216 bits of data.
	// Input must be at least 28 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);
}

static void unpack_27_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 27 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 216 bits of data.
	// Input must be at least 28 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);
}

static void unpack_27_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 27 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 216 bits of data.
	// Input must be at least 28 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);
}

static void unpack_27_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 27 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 216 bits of data.
	// Input must be at least 28 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);
}

static void unpack_27_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 27 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 216 bits of data.
	// Input must be at least 28 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);
}

static void unpack_27_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 27 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 216 bits of data.
	// Input must be at least 28 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);
}

static void unpack_27_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 27 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 216 bits of data.
	// Input must be at least 28 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);
}

static void unpack_27_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 27 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 216 bits of data.
	// Input must be at least 28 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);
}

static void unpack_27_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 27 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 216 bits of data.
	// Input must be at least 28 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);
}

static void unpack_28_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 28 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 224 bits of data.
	// Input must be at least 28 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);
}

static void unpack_28_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 28 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 224 bits of data.
	// Input must be at least 28 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);
}

static void unpack_28_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 28 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 224 bits of data.
	// Input must be at least 29 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);
}

static void unpack_28_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 28 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 224 bits of data.
	// Input must be at least 29 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);
}

static void unpack_28_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 28 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 224 bits of data.
	// Input must be at least 29 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);
}

static void unpack_28_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 28 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 224 bits of data.
	// Input must be at least 29 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);
}

static void unpack_28_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 28 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 224 bits of data.
	// Input must be at least 29 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);
}

static void unpack_28_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 28 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 224 bits of data.
	// Input must be at least 29 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);
}

static void unpack_28_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 28 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 224 bits of data.
	// Input must be at least 29 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);
}

static void unpack_28_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 28 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 224 bits of data.
	// Input must be at least 29 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);
}

static void unpack_28_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 28 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 224 bits of data.
	// Input must be at least 29 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);
}

static void unpack_28_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 28 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 224 bits of data.
	// Input must be at least 29 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);
}

static void unpack_28_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 28 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 224 bits of data.
	// Input must be at least 29 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);
}

static void unpack_28_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 28 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 224 bits of data.
	// Input must be at least 29 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);
}

static void unpack_28_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 28 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 224 bits of data.
	// Input must be at least 29 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);
}

static void unpack_28_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 28 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 224 bits of data.
	// Input must be at least 29 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);
}

static void unpack_29_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 29 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 232 bits of data.
	// Input must be at least 29 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);
}

static void unpack_29_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 29 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 232 bits of data.
	// Input must be at least 29 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);
}

static void unpack_29_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 29 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 232 bits of data.
	// Input must be at least 30 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);
}

static void unpack_29_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 29 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 232 bits of data.
	// Input must be at least 30 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);
}

static void unpack_29_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 29 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 232 bits of data.
	// Input must be at least 30 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);
}

static void unpack_29_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 29 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 232 bits of data.
	// Input must be at least 30 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);
}

static void unpack_29_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 29 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 232 bits of data.
	// Input must be at least 30 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);
}

static void unpack_29_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 29 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 232 bits of data.
	// Input must be at least 30 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);
}

static void unpack_29_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 29 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 232 bits of data.
	// Input must be at least 30 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);
}

static void unpack_29_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 29 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 232 bits of data.
	// Input must be at least 30 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);
}

static void unpack_29_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 29 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 232 bits of data.
	// Input must be at least 30 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);
}

static void unpack_29_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 29 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 232 bits of data.
	// Input must be at least 30 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);
}

static void unpack_29_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 29 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 232 bits of data.
	// Input must be at least 30 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);
}

static void unpack_29_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 29 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 232 bits of data.
	// Input must be at least 30 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);
}

static void unpack_29_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 29 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 232 bits of data.
	// Input must be at least 30 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);
}

static void unpack_29_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 29 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 232 bits of data.
	// Input must be at least 30 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);
}

static void unpack_30_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 30 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 240 bits of data.
	// Input must be at least 30 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);
}

static void unpack_30_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 30 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 240 bits of data.
	// Input must be at least 30 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);
}

static void unpack_30_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 30 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 240 bits of data.
	// Input must be at least 31 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);
}

static void unpack_30_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 30 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 240 bits of data.
	// Input must be at least 31 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);
}

static void unpack_30_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 30 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 240 bits of data.
	// Input must be at least 31 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);
}

static void unpack_30_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 30 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 240 bits of data.
	// Input must be at least 31 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);
}

static void unpack_30_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 30 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 240 bits of data.
	// Input must be at least 31 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);
}

static void unpack_30_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 30 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 240 bits of data.
	// Input must be at least 31 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);
}

static void unpack_30_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 30 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 240 bits of data.
	// Input must be at least 31 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);
}

static void unpack_30_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 30 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 240 bits of data.
	// Input must be at least 31 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);
}

static void unpack_30_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 30 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 240 bits of data.
	// Input must be at least 31 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);
}

static void unpack_30_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 30 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 240 bits of data.
	// Input must be at least 31 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);
}

static void unpack_30_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 30 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 240 bits of data.
	// Input must be at least 31 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);
}

static void unpack_30_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 30 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 240 bits of data.
	// Input must be at least 31 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);
}

static void unpack_30_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 30 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 240 bits of data.
	// Input must be at least 31 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);
}

static void unpack_30_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 30 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 240 bits of data.
	// Input must be at least 31 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);
}

static void unpack_31_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 31 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 248 bits of data.
	// Input must be at least 31 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);
}

static void unpack_31_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 31 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 248 bits of data.
	// Input must be at least 31 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);
}

static void unpack_31_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 31 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 248 bits of data.
	// Input must be at least 32 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);
}

static void unpack_31_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 31 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 248 bits of data.
	// Input must be at least 32 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);
}

static void unpack_31_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 31 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 248 bits of data.
	// Input must be at least 32 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);
}

static void unpack_31_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 31 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 248 bits of data.
	// Input must be at least 32 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);
}

static void unpack_31_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 31 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 248 bits of data.
	// Input must be at least 32 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);
}

static void unpack_31_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 31 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 248 bits of data.
	// Input must be at least 32 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);
}

static void unpack_31_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 31 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 248 bits of data.
	// Input must be at least 32 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);
}

static void unpack_31_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 31 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 248 bits of data.
	// Input must be at least 32 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);
}

static void unpack_31_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 31 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 248 bits of data.
	// Input must be at least 32 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);
}

static void unpack_31_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 31 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 248 bits of data.
	// Input must be at least 32 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);
}

static void unpack_31_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 31 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 248 bits of data.
	// Input must be at least 32 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);
}

static void unpack_31_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 31 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 248 bits of data.
	// Input must be at least 32 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);
}

static void unpack_31_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 31 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 248 bits of data.
	// Input must be at least 32 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);
}

static void unpack_31_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 31 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 248 bits of data.
	// Input must be at least 32 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);
}

static void unpack_32_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 32 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 256 bits of data.
	// Input must be at least 32 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);
}

static void unpack_32_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 32 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 256 bits of data.
	// Input must be at least 32 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);
}

static void unpack_32_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 32 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 256 bits of data.
	// Input must be at least 33 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);
}

static void unpack_32_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 32 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 256 bits of data.
	// Input must be at least 33 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);
}

static void unpack_32_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 32 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 256 bits of data.
	// Input must be at least 33 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);
}

static void unpack_32_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 32 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 256 bits of data.
	// Input must be at least 33 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);
}

static void unpack_32_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 32 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 256 bits of data.
	// Input must be at least 33 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);
}

static void unpack_32_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 32 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 256 bits of data.
	// Input must be at least 33 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);
}

static void unpack_32_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 32 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 256 bits of data.
	// Input must be at least 33 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);
}

static void unpack_32_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 32 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 256 bits of data.
	// Input must be at least 33 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);
}

static void unpack_32_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 32 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 256 bits of data.
	// Input must be at least 33 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);
}

static void unpack_32_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 32 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 256 bits of data.
	// Input must be at least 33 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);
}

static void unpack_32_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 32 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 256 bits of data.
	// Input must be at least 33 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);
}

static void unpack_32_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 32 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 256 bits of data.
	// Input must be at least 33 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);
}

static void unpack_32_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 32 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 256 bits of data.
	// Input must be at least 33 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);
}

static void unpack_32_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 32 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 256 bits of data.
	// Input must be at least 33 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);
}

static void unpack_33_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 33 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 264 bits of data.
	// Input must be at least 33 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);
}

static void unpack_33_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 33 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 264 bits of data.
	// Input must be at least 33 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);
}

static void unpack_33_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 33 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 264 bits of data.
	// Input must be at least 34 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);
}

static void unpack_33_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 33 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 264 bits of data.
	// Input must be at least 34 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);
}

static void unpack_33_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 33 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 264 bits of data.
	// Input must be at least 34 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);
}

static void unpack_33_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 33 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 264 bits of data.
	// Input must be at least 34 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);
}

static void unpack_33_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 33 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 264 bits of data.
	// Input must be at least 34 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);
}

static void unpack_33_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 33 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 264 bits of data.
	// Input must be at least 34 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);
}

static void unpack_33_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 33 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 264 bits of data.
	// Input must be at least 34 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);
}

static void unpack_33_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 33 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 264 bits of data.
	// Input must be at least 34 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);
}

static void unpack_33_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 33 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 264 bits of data.
	// Input must be at least 34 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);
}

static void unpack_33_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 33 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 264 bits of data.
	// Input must be at least 34 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);
}

static void unpack_33_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 33 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 264 bits of data.
	// Input must be at least 34 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);
}

static void unpack_33_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 33 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 264 bits of data.
	// Input must be at least 34 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);
}

static void unpack_33_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 33 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 264 bits of data.
	// Input must be at least 34 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);
}

static void unpack_33_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 33 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 264 bits of data.
	// Input must be at least 34 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);
}

static void unpack_34_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 34 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 272 bits of data.
	// Input must be at least 34 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);
}

static void unpack_34_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 34 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 272 bits of data.
	// Input must be at least 34 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);
}

static void unpack_34_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 34 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 272 bits of data.
	// Input must be at least 35 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);
}

static void unpack_34_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 34 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 272 bits of data.
	// Input must be at least 35 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);
}

static void unpack_34_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 34 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 272 bits of data.
	// Input must be at least 35 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);
}

static void unpack_34_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 34 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 272 bits of data.
	// Input must be at least 35 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);
}

static void unpack_34_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 34 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 272 bits of data.
	// Input must be at least 35 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);
}

static void unpack_34_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 34 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 272 bits of data.
	// Input must be at least 35 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);
}

static void unpack_34_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 34 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 272 bits of data.
	// Input must be at least 35 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);
}

static void unpack_34_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 34 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 272 bits of data.
	// Input must be at least 35 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);
}

static void unpack_34_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 34 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 272 bits of data.
	// Input must be at least 35 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);
}

static void unpack_34_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 34 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 272 bits of data.
	// Input must be at least 35 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);
}

static void unpack_34_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 34 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 272 bits of data.
	// Input must be at least 35 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);
}

static void unpack_34_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 34 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 272 bits of data.
	// Input must be at least 35 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);
}

static void unpack_34_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 34 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 272 bits of data.
	// Input must be at least 35 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);
}

static void unpack_34_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 34 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 272 bits of data.
	// Input must be at least 35 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);
}

static void unpack_35_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 35 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 280 bits of data.
	// Input must be at least 35 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);
}

static void unpack_35_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 35 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 280 bits of data.
	// Input must be at least 35 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);
}

static void unpack_35_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 35 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 280 bits of data.
	// Input must be at least 36 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);
}

static void unpack_35_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 35 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 280 bits of data.
	// Input must be at least 36 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);
}

static void unpack_35_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 35 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 280 bits of data.
	// Input must be at least 36 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);
}

static void unpack_35_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 35 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 280 bits of data.
	// Input must be at least 36 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);
}

static void unpack_35_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 35 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 280 bits of data.
	// Input must be at least 36 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);
}

static void unpack_35_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 35 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 280 bits of data.
	// Input must be at least 36 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);
}

static void unpack_35_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 35 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 280 bits of data.
	// Input must be at least 36 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);
}

static void unpack_35_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 35 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 280 bits of data.
	// Input must be at least 36 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);
}

static void unpack_35_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 35 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 280 bits of data.
	// Input must be at least 36 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);
}

static void unpack_35_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 35 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 280 bits of data.
	// Input must be at least 36 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);
}

static void unpack_35_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 35 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 280 bits of data.
	// Input must be at least 36 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);
}

static void unpack_35_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 35 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 280 bits of data.
	// Input must be at least 36 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);
}

static void unpack_35_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 35 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 280 bits of data.
	// Input must be at least 36 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);
}

static void unpack_35_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 35 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 280 bits of data.
	// Input must be at least 36 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);
}

static void unpack_36_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 36 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 288 bits of data.
	// Input must be at least 36 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);
}

static void unpack_36_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 36 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 288 bits of data.
	// Input must be at least 36 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);
}

static void unpack_36_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 36 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 288 bits of data.
	// Input must be at least 37 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);
}

static void unpack_36_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 36 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 288 bits of data.
	// Input must be at least 37 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);
}

static void unpack_36_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 36 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 288 bits of data.
	// Input must be at least 37 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);
}

static void unpack_36_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 36 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 288 bits of data.
	// Input must be at least 37 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);
}

static void unpack_36_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 36 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 288 bits of data.
	// Input must be at least 37 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);
}

static void unpack_36_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 36 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 288 bits of data.
	// Input must be at least 37 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);
}

static void unpack_36_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 36 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 288 bits of data.
	// Input must be at least 37 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);
}

static void unpack_36_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 36 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 288 bits of data.
	// Input must be at least 37 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);
}

static void unpack_36_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 36 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 288 bits of data.
	// Input must be at least 37 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);
}

static void unpack_36_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 36 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 288 bits of data.
	// Input must be at least 37 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);
}

static void unpack_36_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 36 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 288 bits of data.
	// Input must be at least 37 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);
}

static void unpack_36_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 36 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 288 bits of data.
	// Input must be at least 37 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);
}

static void unpack_36_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 36 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 288 bits of data.
	// Input must be at least 37 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);
}

static void unpack_36_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 36 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 288 bits of data.
	// Input must be at least 37 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);
}

static void unpack_37_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 37 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 296 bits of data.
	// Input must be at least 37 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);
}

static void unpack_37_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 37 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 296 bits of data.
	// Input must be at least 37 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);
}

static void unpack_37_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 37 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 296 bits of data.
	// Input must be at least 38 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);
}

static void unpack_37_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 37 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 296 bits of data.
	// Input must be at least 38 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);
}

static void unpack_37_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 37 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 296 bits of data.
	// Input must be at least 38 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);
}

static void unpack_37_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 37 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 296 bits of data.
	// Input must be at least 38 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);
}

static void unpack_37_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 37 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 296 bits of data.
	// Input must be at least 38 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);
}

static void unpack_37_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 37 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 296 bits of data.
	// Input must be at least 38 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);
}

static void unpack_37_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 37 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 296 bits of data.
	// Input must be at least 38 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);
}

static void unpack_37_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 37 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 296 bits of data.
	// Input must be at least 38 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);
}

static void unpack_37_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 37 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 296 bits of data.
	// Input must be at least 38 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);
}

static void unpack_37_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 37 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 296 bits of data.
	// Input must be at least 38 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);
}

static void unpack_37_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 37 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 296 bits of data.
	// Input must be at least 38 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);
}

static void unpack_37_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 37 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 296 bits of data.
	// Input must be at least 38 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);
}

static void unpack_37_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 37 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 296 bits of data.
	// Input must be at least 38 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);
}

static void unpack_37_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 37 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 296 bits of data.
	// Input must be at least 38 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);
}

static void unpack_38_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 38 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 304 bits of data.
	// Input must be at least 38 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);
}

static void unpack_38_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 38 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 304 bits of data.
	// Input must be at least 38 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);
}

static void unpack_38_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 38 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 304 bits of data.
	// Input must be at least 39 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);
}

static void unpack_38_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 38 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 304 bits of data.
	// Input must be at least 39 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);
}

static void unpack_38_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 38 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 304 bits of data.
	// Input must be at least 39 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);
}

static void unpack_38_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 38 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 304 bits of data.
	// Input must be at least 39 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);
}

static void unpack_38_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 38 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 304 bits of data.
	// Input must be at least 39 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);
}

static void unpack_38_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 38 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 304 bits of data.
	// Input must be at least 39 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);
}

static void unpack_38_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 38 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 304 bits of data.
	// Input must be at least 39 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);
}

static void unpack_38_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 38 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 304 bits of data.
	// Input must be at least 39 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);
}

static void unpack_38_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 38 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 304 bits of data.
	// Input must be at least 39 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);
}

static void unpack_38_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 38 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 304 bits of data.
	// Input must be at least 39 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);
}

static void unpack_38_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 38 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 304 bits of data.
	// Input must be at least 39 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);
}

static void unpack_38_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 38 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 304 bits of data.
	// Input must be at least 39 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);
}

static void unpack_38_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 38 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 304 bits of data.
	// Input must be at least 39 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);
}

static void unpack_38_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 38 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 304 bits of data.
	// Input must be at least 39 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);
}

static void unpack_39_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 39 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 312 bits of data.
	// Input must be at least 39 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);
}

static void unpack_39_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 39 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 312 bits of data.
	// Input must be at least 39 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);
}

static void unpack_39_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 39 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 312 bits of data.
	// Input must be at least 40 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);
}

static void unpack_39_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 39 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 312 bits of data.
	// Input must be at least 40 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);
}

static void unpack_39_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 39 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 312 bits of data.
	// Input must be at least 40 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);
}

static void unpack_39_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 39 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 312 bits of data.
	// Input must be at least 40 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);
}

static void unpack_39_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 39 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 312 bits of data.
	// Input must be at least 40 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);
}

static void unpack_39_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 39 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 312 bits of data.
	// Input must be at least 40 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);
}

static void unpack_39_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 39 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 312 bits of data.
	// Input must be at least 40 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);
}

static void unpack_39_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 39 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 312 bits of data.
	// Input must be at least 40 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);
}

static void unpack_39_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 39 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 312 bits of data.
	// Input must be at least 40 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);
}

static void unpack_39_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 39 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 312 bits of data.
	// Input must be at least 40 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);
}

static void unpack_39_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 39 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 312 bits of data.
	// Input must be at least 40 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);
}

static void unpack_39_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 39 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 312 bits of data.
	// Input must be at least 40 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);
}

static void unpack_39_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 39 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 312 bits of data.
	// Input must be at least 40 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);
}

static void unpack_39_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 39 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 312 bits of data.
	// Input must be at least 40 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);
}

static void unpack_40_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 40 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 320 bits of data.
	// Input must be at least 40 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);
}

static void unpack_40_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 40 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 320 bits of data.
	// Input must be at least 40 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);
}

static void unpack_40_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 40 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 320 bits of data.
	// Input must be at least 41 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);
}

static void unpack_40_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 40 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 320 bits of data.
	// Input must be at least 41 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);
}

static void unpack_40_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 40 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 320 bits of data.
	// Input must be at least 41 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);
}

static void unpack_40_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 40 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 320 bits of data.
	// Input must be at least 41 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);
}

static void unpack_40_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 40 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 320 bits of data.
	// Input must be at least 41 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);
}

static void unpack_40_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 40 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 320 bits of data.
	// Input must be at least 41 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);
}

static void unpack_40_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 40 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 320 bits of data.
	// Input must be at least 41 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);
}

static void unpack_40_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 40 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 320 bits of data.
	// Input must be at least 41 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);
}

static void unpack_40_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 40 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 320 bits of data.
	// Input must be at least 41 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);
}

static void unpack_40_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 40 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 320 bits of data.
	// Input must be at least 41 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);
}

static void unpack_40_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 40 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 320 bits of data.
	// Input must be at least 41 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);
}

static void unpack_40_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 40 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 320 bits of data.
	// Input must be at least 41 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);
}

static void unpack_40_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 40 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 320 bits of data.
	// Input must be at least 41 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);
}

static void unpack_40_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 40 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 320 bits of data.
	// Input must be at least 41 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);
}

static void unpack_41_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 41 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 328 bits of data.
	// Input must be at least 41 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);
}

static void unpack_41_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 41 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 328 bits of data.
	// Input must be at least 41 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);
}

static void unpack_41_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 41 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 328 bits of data.
	// Input must be at least 42 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);
}

static void unpack_41_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 41 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 328 bits of data.
	// Input must be at least 42 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);
}

static void unpack_41_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 41 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 328 bits of data.
	// Input must be at least 42 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);
}

static void unpack_41_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 41 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 328 bits of data.
	// Input must be at least 42 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);
}

static void unpack_41_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 41 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 328 bits of data.
	// Input must be at least 42 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);
}

static void unpack_41_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 41 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 328 bits of data.
	// Input must be at least 42 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);
}

static void unpack_41_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 41 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 328 bits of data.
	// Input must be at least 42 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);
}

static void unpack_41_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 41 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 328 bits of data.
	// Input must be at least 42 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);
}

static void unpack_41_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 41 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 328 bits of data.
	// Input must be at least 42 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);
}

static void unpack_41_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 41 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 328 bits of data.
	// Input must be at least 42 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);
}

static void unpack_41_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 41 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 328 bits of data.
	// Input must be at least 42 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);
}

static void unpack_41_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 41 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 328 bits of data.
	// Input must be at least 42 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);
}

static void unpack_41_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 41 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 328 bits of data.
	// Input must be at least 42 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);
}

static void unpack_41_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 41 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 328 bits of data.
	// Input must be at least 42 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);
}

static void unpack_42_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 42 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 336 bits of data.
	// Input must be at least 42 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 328 to 335
	value = ((uint32_t)input[41] << 24);
	output[41] = (double)(value >> 24);
}

static void unpack_42_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 42 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 336 bits of data.
	// Input must be at least 42 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 328 to 335
	value = ((uint32_t)input[41] << 24);
	output[41] = (double)(value >> 24);
}

static void unpack_42_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 42 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 336 bits of data.
	// Input must be at least 43 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 329 to 336
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)(input[42] & 0x80) << 17);
	output[41] = (double)(value >> 24);
}

static void unpack_42_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 42 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 336 bits of data.
	// Input must be at least 43 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 329 to 336
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)(input[42] & 0x80) << 17);
	output[41] = (double)(value >> 24);
}

static void unpack_42_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 42 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 336 bits of data.
	// Input must be at least 43 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 330 to 337
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)(input[42] & 0xc0) << 18);
	output[41] = (double)(value >> 24);
}

static void unpack_42_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 42 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 336 bits of data.
	// Input must be at least 43 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 330 to 337
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)(input[42] & 0xc0) << 18);
	output[41] = (double)(value >> 24);
}

static void unpack_42_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 42 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 336 bits of data.
	// Input must be at least 43 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 331 to 338
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)(input[42] & 0xe0) << 19);
	output[41] = (double)(value >> 24);
}

static void unpack_42_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 42 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 336 bits of data.
	// Input must be at least 43 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 331 to 338
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)(input[42] & 0xe0) << 19);
	output[41] = (double)(value >> 24);
}

static void unpack_42_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 42 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 336 bits of data.
	// Input must be at least 43 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 332 to 339
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)(input[42] & 0xf0) << 20);
	output[41] = (double)(value >> 24);
}

static void unpack_42_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 42 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 336 bits of data.
	// Input must be at least 43 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 332 to 339
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)(input[42] & 0xf0) << 20);
	output[41] = (double)(value >> 24);
}

static void unpack_42_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 42 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 336 bits of data.
	// Input must be at least 43 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 333 to 340
	value = ((uint32_t)(input[41] & 0x07) << 29) |
			((uint32_t)(input[42] & 0xf8) << 21);
	output[41] = (double)(value >> 24);
}

static void unpack_42_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 42 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 336 bits of data.
	// Input must be at least 43 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 333 to 340
	value = ((uint32_t)(input[41] & 0x07) << 29) |
			((uint32_t)(input[42] & 0xf8) << 21);
	output[41] = (double)(value >> 24);
}

static void unpack_42_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 42 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 336 bits of data.
	// Input must be at least 43 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 334 to 341
	value = ((uint32_t)(input[41] & 0x03) << 30) |
			((uint32_t)(input[42] & 0xfc) << 22);
	output[41] = (double)(value >> 24);
}

static void unpack_42_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 42 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 336 bits of data.
	// Input must be at least 43 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 334 to 341
	value = ((uint32_t)(input[41] & 0x03) << 30) |
			((uint32_t)(input[42] & 0xfc) << 22);
	output[41] = (double)(value >> 24);
}

static void unpack_42_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 42 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 336 bits of data.
	// Input must be at least 43 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 335 to 342
	value = ((uint32_t)(input[41] & 0x01) << 31) |
			((uint32_t)(input[42] & 0xfe) << 23);
	output[41] = (double)(value >> 24);
}

static void unpack_42_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 42 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 336 bits of data.
	// Input must be at least 43 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 335 to 342
	value = ((uint32_t)(input[41] & 0x01) << 31) |
			((uint32_t)(input[42] & 0xfe) << 23);
	output[41] = (double)(value >> 24);
}

static void unpack_43_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 43 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 344 bits of data.
	// Input must be at least 43 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 328 to 335
	value = ((uint32_t)input[41] << 24);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 336 to 343
	value = ((uint32_t)input[42] << 24);
	output[42] = (double)(value >> 24);
}

static void unpack_43_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 43 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 344 bits of data.
	// Input must be at least 43 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 328 to 335
	value = ((uint32_t)input[41] << 24);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 336 to 343
	value = ((uint32_t)input[42] << 24);
	output[42] = (double)(value >> 24);
}

static void unpack_43_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 43 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 344 bits of data.
	// Input must be at least 44 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 329 to 336
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)(input[42] & 0x80) << 17);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 337 to 344
	value = ((uint32_t)(input[42] & 0x7f) << 25) |
			((uint32_t)(input[43] & 0x80) << 17);
	output[42] = (double)(value >> 24);
}

static void unpack_43_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 43 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 344 bits of data.
	// Input must be at least 44 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 329 to 336
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)(input[42] & 0x80) << 17);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 337 to 344
	value = ((uint32_t)(input[42] & 0x7f) << 25) |
			((uint32_t)(input[43] & 0x80) << 17);
	output[42] = (double)(value >> 24);
}

static void unpack_43_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 43 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 344 bits of data.
	// Input must be at least 44 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 330 to 337
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)(input[42] & 0xc0) << 18);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 338 to 345
	value = ((uint32_t)(input[42] & 0x3f) << 26) |
			((uint32_t)(input[43] & 0xc0) << 18);
	output[42] = (double)(value >> 24);
}

static void unpack_43_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 43 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 344 bits of data.
	// Input must be at least 44 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 330 to 337
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)(input[42] & 0xc0) << 18);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 338 to 345
	value = ((uint32_t)(input[42] & 0x3f) << 26) |
			((uint32_t)(input[43] & 0xc0) << 18);
	output[42] = (double)(value >> 24);
}

static void unpack_43_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 43 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 344 bits of data.
	// Input must be at least 44 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 331 to 338
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)(input[42] & 0xe0) << 19);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 339 to 346
	value = ((uint32_t)(input[42] & 0x1f) << 27) |
			((uint32_t)(input[43] & 0xe0) << 19);
	output[42] = (double)(value >> 24);
}

static void unpack_43_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 43 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 344 bits of data.
	// Input must be at least 44 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 331 to 338
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)(input[42] & 0xe0) << 19);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 339 to 346
	value = ((uint32_t)(input[42] & 0x1f) << 27) |
			((uint32_t)(input[43] & 0xe0) << 19);
	output[42] = (double)(value >> 24);
}

static void unpack_43_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 43 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 344 bits of data.
	// Input must be at least 44 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 332 to 339
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)(input[42] & 0xf0) << 20);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 340 to 347
	value = ((uint32_t)(input[42] & 0x0f) << 28) |
			((uint32_t)(input[43] & 0xf0) << 20);
	output[42] = (double)(value >> 24);
}

static void unpack_43_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 43 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 344 bits of data.
	// Input must be at least 44 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 332 to 339
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)(input[42] & 0xf0) << 20);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 340 to 347
	value = ((uint32_t)(input[42] & 0x0f) << 28) |
			((uint32_t)(input[43] & 0xf0) << 20);
	output[42] = (double)(value >> 24);
}

static void unpack_43_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 43 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 344 bits of data.
	// Input must be at least 44 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 333 to 340
	value = ((uint32_t)(input[41] & 0x07) << 29) |
			((uint32_t)(input[42] & 0xf8) << 21);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 341 to 348
	value = ((uint32_t)(input[42] & 0x07) << 29) |
			((uint32_t)(input[43] & 0xf8) << 21);
	output[42] = (double)(value >> 24);
}

static void unpack_43_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 43 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 344 bits of data.
	// Input must be at least 44 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 333 to 340
	value = ((uint32_t)(input[41] & 0x07) << 29) |
			((uint32_t)(input[42] & 0xf8) << 21);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 341 to 348
	value = ((uint32_t)(input[42] & 0x07) << 29) |
			((uint32_t)(input[43] & 0xf8) << 21);
	output[42] = (double)(value >> 24);
}

static void unpack_43_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 43 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 344 bits of data.
	// Input must be at least 44 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 334 to 341
	value = ((uint32_t)(input[41] & 0x03) << 30) |
			((uint32_t)(input[42] & 0xfc) << 22);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 342 to 349
	value = ((uint32_t)(input[42] & 0x03) << 30) |
			((uint32_t)(input[43] & 0xfc) << 22);
	output[42] = (double)(value >> 24);
}

static void unpack_43_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 43 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 344 bits of data.
	// Input must be at least 44 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 334 to 341
	value = ((uint32_t)(input[41] & 0x03) << 30) |
			((uint32_t)(input[42] & 0xfc) << 22);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 342 to 349
	value = ((uint32_t)(input[42] & 0x03) << 30) |
			((uint32_t)(input[43] & 0xfc) << 22);
	output[42] = (double)(value >> 24);
}

static void unpack_43_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 43 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 344 bits of data.
	// Input must be at least 44 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 335 to 342
	value = ((uint32_t)(input[41] & 0x01) << 31) |
			((uint32_t)(input[42] & 0xfe) << 23);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 343 to 350
	value = ((uint32_t)(input[42] & 0x01) << 31) |
			((uint32_t)(input[43] & 0xfe) << 23);
	output[42] = (double)(value >> 24);
}

static void unpack_43_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 43 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 344 bits of data.
	// Input must be at least 44 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 335 to 342
	value = ((uint32_t)(input[41] & 0x01) << 31) |
			((uint32_t)(input[42] & 0xfe) << 23);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 343 to 350
	value = ((uint32_t)(input[42] & 0x01) << 31) |
			((uint32_t)(input[43] & 0xfe) << 23);
	output[42] = (double)(value >> 24);
}

static void unpack_44_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 44 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 352 bits of data.
	// Input must be at least 44 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 328 to 335
	value = ((uint32_t)input[41] << 24);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 336 to 343
	value = ((uint32_t)input[42] << 24);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 344 to 351
	value = ((uint32_t)input[43] << 24);
	output[43] = (double)(value >> 24);
}

static void unpack_44_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 44 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 352 bits of data.
	// Input must be at least 44 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 328 to 335
	value = ((uint32_t)input[41] << 24);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 336 to 343
	value = ((uint32_t)input[42] << 24);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 344 to 351
	value = ((uint32_t)input[43] << 24);
	output[43] = (double)(value >> 24);
}

static void unpack_44_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 44 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 352 bits of data.
	// Input must be at least 45 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 329 to 336
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)(input[42] & 0x80) << 17);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 337 to 344
	value = ((uint32_t)(input[42] & 0x7f) << 25) |
			((uint32_t)(input[43] & 0x80) << 17);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 345 to 352
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)(input[44] & 0x80) << 17);
	output[43] = (double)(value >> 24);
}

static void unpack_44_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 44 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 352 bits of data.
	// Input must be at least 45 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 329 to 336
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)(input[42] & 0x80) << 17);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 337 to 344
	value = ((uint32_t)(input[42] & 0x7f) << 25) |
			((uint32_t)(input[43] & 0x80) << 17);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 345 to 352
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)(input[44] & 0x80) << 17);
	output[43] = (double)(value >> 24);
}

static void unpack_44_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 44 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 352 bits of data.
	// Input must be at least 45 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 330 to 337
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)(input[42] & 0xc0) << 18);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 338 to 345
	value = ((uint32_t)(input[42] & 0x3f) << 26) |
			((uint32_t)(input[43] & 0xc0) << 18);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 346 to 353
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)(input[44] & 0xc0) << 18);
	output[43] = (double)(value >> 24);
}

static void unpack_44_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 44 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 352 bits of data.
	// Input must be at least 45 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 330 to 337
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)(input[42] & 0xc0) << 18);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 338 to 345
	value = ((uint32_t)(input[42] & 0x3f) << 26) |
			((uint32_t)(input[43] & 0xc0) << 18);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 346 to 353
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)(input[44] & 0xc0) << 18);
	output[43] = (double)(value >> 24);
}

static void unpack_44_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 44 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 352 bits of data.
	// Input must be at least 45 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 331 to 338
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)(input[42] & 0xe0) << 19);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 339 to 346
	value = ((uint32_t)(input[42] & 0x1f) << 27) |
			((uint32_t)(input[43] & 0xe0) << 19);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 347 to 354
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)(input[44] & 0xe0) << 19);
	output[43] = (double)(value >> 24);
}

static void unpack_44_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 44 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 352 bits of data.
	// Input must be at least 45 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 331 to 338
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)(input[42] & 0xe0) << 19);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 339 to 346
	value = ((uint32_t)(input[42] & 0x1f) << 27) |
			((uint32_t)(input[43] & 0xe0) << 19);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 347 to 354
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)(input[44] & 0xe0) << 19);
	output[43] = (double)(value >> 24);
}

static void unpack_44_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 44 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 352 bits of data.
	// Input must be at least 45 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 332 to 339
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)(input[42] & 0xf0) << 20);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 340 to 347
	value = ((uint32_t)(input[42] & 0x0f) << 28) |
			((uint32_t)(input[43] & 0xf0) << 20);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 348 to 355
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)(input[44] & 0xf0) << 20);
	output[43] = (double)(value >> 24);
}

static void unpack_44_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 44 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 352 bits of data.
	// Input must be at least 45 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 332 to 339
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)(input[42] & 0xf0) << 20);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 340 to 347
	value = ((uint32_t)(input[42] & 0x0f) << 28) |
			((uint32_t)(input[43] & 0xf0) << 20);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 348 to 355
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)(input[44] & 0xf0) << 20);
	output[43] = (double)(value >> 24);
}

static void unpack_44_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 44 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 352 bits of data.
	// Input must be at least 45 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 333 to 340
	value = ((uint32_t)(input[41] & 0x07) << 29) |
			((uint32_t)(input[42] & 0xf8) << 21);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 341 to 348
	value = ((uint32_t)(input[42] & 0x07) << 29) |
			((uint32_t)(input[43] & 0xf8) << 21);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 349 to 356
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)(input[44] & 0xf8) << 21);
	output[43] = (double)(value >> 24);
}

static void unpack_44_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 44 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 352 bits of data.
	// Input must be at least 45 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 333 to 340
	value = ((uint32_t)(input[41] & 0x07) << 29) |
			((uint32_t)(input[42] & 0xf8) << 21);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 341 to 348
	value = ((uint32_t)(input[42] & 0x07) << 29) |
			((uint32_t)(input[43] & 0xf8) << 21);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 349 to 356
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)(input[44] & 0xf8) << 21);
	output[43] = (double)(value >> 24);
}

static void unpack_44_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 44 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 352 bits of data.
	// Input must be at least 45 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 334 to 341
	value = ((uint32_t)(input[41] & 0x03) << 30) |
			((uint32_t)(input[42] & 0xfc) << 22);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 342 to 349
	value = ((uint32_t)(input[42] & 0x03) << 30) |
			((uint32_t)(input[43] & 0xfc) << 22);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 350 to 357
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)(input[44] & 0xfc) << 22);
	output[43] = (double)(value >> 24);
}

static void unpack_44_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 44 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 352 bits of data.
	// Input must be at least 45 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 334 to 341
	value = ((uint32_t)(input[41] & 0x03) << 30) |
			((uint32_t)(input[42] & 0xfc) << 22);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 342 to 349
	value = ((uint32_t)(input[42] & 0x03) << 30) |
			((uint32_t)(input[43] & 0xfc) << 22);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 350 to 357
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)(input[44] & 0xfc) << 22);
	output[43] = (double)(value >> 24);
}

static void unpack_44_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 44 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 352 bits of data.
	// Input must be at least 45 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 335 to 342
	value = ((uint32_t)(input[41] & 0x01) << 31) |
			((uint32_t)(input[42] & 0xfe) << 23);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 343 to 350
	value = ((uint32_t)(input[42] & 0x01) << 31) |
			((uint32_t)(input[43] & 0xfe) << 23);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 351 to 358
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)(input[44] & 0xfe) << 23);
	output[43] = (double)(value >> 24);
}

static void unpack_44_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 44 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 352 bits of data.
	// Input must be at least 45 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 335 to 342
	value = ((uint32_t)(input[41] & 0x01) << 31) |
			((uint32_t)(input[42] & 0xfe) << 23);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 343 to 350
	value = ((uint32_t)(input[42] & 0x01) << 31) |
			((uint32_t)(input[43] & 0xfe) << 23);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 351 to 358
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)(input[44] & 0xfe) << 23);
	output[43] = (double)(value >> 24);
}

static void unpack_45_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 45 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 360 bits of data.
	// Input must be at least 45 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 328 to 335
	value = ((uint32_t)input[41] << 24);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 336 to 343
	value = ((uint32_t)input[42] << 24);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 344 to 351
	value = ((uint32_t)input[43] << 24);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 352 to 359
	value = ((uint32_t)input[44] << 24);
	output[44] = (double)(value >> 24);
}

static void unpack_45_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 45 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 360 bits of data.
	// Input must be at least 45 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 328 to 335
	value = ((uint32_t)input[41] << 24);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 336 to 343
	value = ((uint32_t)input[42] << 24);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 344 to 351
	value = ((uint32_t)input[43] << 24);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 352 to 359
	value = ((uint32_t)input[44] << 24);
	output[44] = (double)(value >> 24);
}

static void unpack_45_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 45 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 360 bits of data.
	// Input must be at least 46 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 329 to 336
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)(input[42] & 0x80) << 17);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 337 to 344
	value = ((uint32_t)(input[42] & 0x7f) << 25) |
			((uint32_t)(input[43] & 0x80) << 17);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 345 to 352
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)(input[44] & 0x80) << 17);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 353 to 360
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)(input[45] & 0x80) << 17);
	output[44] = (double)(value >> 24);
}

static void unpack_45_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 45 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 360 bits of data.
	// Input must be at least 46 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 329 to 336
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)(input[42] & 0x80) << 17);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 337 to 344
	value = ((uint32_t)(input[42] & 0x7f) << 25) |
			((uint32_t)(input[43] & 0x80) << 17);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 345 to 352
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)(input[44] & 0x80) << 17);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 353 to 360
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)(input[45] & 0x80) << 17);
	output[44] = (double)(value >> 24);
}

static void unpack_45_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 45 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 360 bits of data.
	// Input must be at least 46 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 330 to 337
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)(input[42] & 0xc0) << 18);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 338 to 345
	value = ((uint32_t)(input[42] & 0x3f) << 26) |
			((uint32_t)(input[43] & 0xc0) << 18);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 346 to 353
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)(input[44] & 0xc0) << 18);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 354 to 361
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)(input[45] & 0xc0) << 18);
	output[44] = (double)(value >> 24);
}

static void unpack_45_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 45 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 360 bits of data.
	// Input must be at least 46 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 330 to 337
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)(input[42] & 0xc0) << 18);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 338 to 345
	value = ((uint32_t)(input[42] & 0x3f) << 26) |
			((uint32_t)(input[43] & 0xc0) << 18);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 346 to 353
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)(input[44] & 0xc0) << 18);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 354 to 361
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)(input[45] & 0xc0) << 18);
	output[44] = (double)(value >> 24);
}

static void unpack_45_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 45 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 360 bits of data.
	// Input must be at least 46 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 331 to 338
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)(input[42] & 0xe0) << 19);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 339 to 346
	value = ((uint32_t)(input[42] & 0x1f) << 27) |
			((uint32_t)(input[43] & 0xe0) << 19);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 347 to 354
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)(input[44] & 0xe0) << 19);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 355 to 362
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)(input[45] & 0xe0) << 19);
	output[44] = (double)(value >> 24);
}

static void unpack_45_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 45 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 360 bits of data.
	// Input must be at least 46 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 331 to 338
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)(input[42] & 0xe0) << 19);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 339 to 346
	value = ((uint32_t)(input[42] & 0x1f) << 27) |
			((uint32_t)(input[43] & 0xe0) << 19);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 347 to 354
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)(input[44] & 0xe0) << 19);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 355 to 362
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)(input[45] & 0xe0) << 19);
	output[44] = (double)(value >> 24);
}

static void unpack_45_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 45 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 360 bits of data.
	// Input must be at least 46 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 332 to 339
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)(input[42] & 0xf0) << 20);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 340 to 347
	value = ((uint32_t)(input[42] & 0x0f) << 28) |
			((uint32_t)(input[43] & 0xf0) << 20);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 348 to 355
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)(input[44] & 0xf0) << 20);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 356 to 363
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)(input[45] & 0xf0) << 20);
	output[44] = (double)(value >> 24);
}

static void unpack_45_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 45 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 360 bits of data.
	// Input must be at least 46 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 332 to 339
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)(input[42] & 0xf0) << 20);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 340 to 347
	value = ((uint32_t)(input[42] & 0x0f) << 28) |
			((uint32_t)(input[43] & 0xf0) << 20);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 348 to 355
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)(input[44] & 0xf0) << 20);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 356 to 363
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)(input[45] & 0xf0) << 20);
	output[44] = (double)(value >> 24);
}

static void unpack_45_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 45 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 360 bits of data.
	// Input must be at least 46 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 333 to 340
	value = ((uint32_t)(input[41] & 0x07) << 29) |
			((uint32_t)(input[42] & 0xf8) << 21);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 341 to 348
	value = ((uint32_t)(input[42] & 0x07) << 29) |
			((uint32_t)(input[43] & 0xf8) << 21);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 349 to 356
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)(input[44] & 0xf8) << 21);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 357 to 364
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)(input[45] & 0xf8) << 21);
	output[44] = (double)(value >> 24);
}

static void unpack_45_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 45 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 360 bits of data.
	// Input must be at least 46 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 333 to 340
	value = ((uint32_t)(input[41] & 0x07) << 29) |
			((uint32_t)(input[42] & 0xf8) << 21);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 341 to 348
	value = ((uint32_t)(input[42] & 0x07) << 29) |
			((uint32_t)(input[43] & 0xf8) << 21);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 349 to 356
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)(input[44] & 0xf8) << 21);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 357 to 364
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)(input[45] & 0xf8) << 21);
	output[44] = (double)(value >> 24);
}

static void unpack_45_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 45 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 360 bits of data.
	// Input must be at least 46 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 334 to 341
	value = ((uint32_t)(input[41] & 0x03) << 30) |
			((uint32_t)(input[42] & 0xfc) << 22);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 342 to 349
	value = ((uint32_t)(input[42] & 0x03) << 30) |
			((uint32_t)(input[43] & 0xfc) << 22);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 350 to 357
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)(input[44] & 0xfc) << 22);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 358 to 365
	value = ((uint32_t)(input[44] & 0x03) << 30) |
			((uint32_t)(input[45] & 0xfc) << 22);
	output[44] = (double)(value >> 24);
}

static void unpack_45_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 45 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 360 bits of data.
	// Input must be at least 46 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 334 to 341
	value = ((uint32_t)(input[41] & 0x03) << 30) |
			((uint32_t)(input[42] & 0xfc) << 22);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 342 to 349
	value = ((uint32_t)(input[42] & 0x03) << 30) |
			((uint32_t)(input[43] & 0xfc) << 22);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 350 to 357
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)(input[44] & 0xfc) << 22);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 358 to 365
	value = ((uint32_t)(input[44] & 0x03) << 30) |
			((uint32_t)(input[45] & 0xfc) << 22);
	output[44] = (double)(value >> 24);
}

static void unpack_45_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 45 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 360 bits of data.
	// Input must be at least 46 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 335 to 342
	value = ((uint32_t)(input[41] & 0x01) << 31) |
			((uint32_t)(input[42] & 0xfe) << 23);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 343 to 350
	value = ((uint32_t)(input[42] & 0x01) << 31) |
			((uint32_t)(input[43] & 0xfe) << 23);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 351 to 358
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)(input[44] & 0xfe) << 23);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 359 to 366
	value = ((uint32_t)(input[44] & 0x01) << 31) |
			((uint32_t)(input[45] & 0xfe) << 23);
	output[44] = (double)(value >> 24);
}

static void unpack_45_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 45 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 360 bits of data.
	// Input must be at least 46 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 335 to 342
	value = ((uint32_t)(input[41] & 0x01) << 31) |
			((uint32_t)(input[42] & 0xfe) << 23);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 343 to 350
	value = ((uint32_t)(input[42] & 0x01) << 31) |
			((uint32_t)(input[43] & 0xfe) << 23);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 351 to 358
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)(input[44] & 0xfe) << 23);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 359 to 366
	value = ((uint32_t)(input[44] & 0x01) << 31) |
			((uint32_t)(input[45] & 0xfe) << 23);
	output[44] = (double)(value >> 24);
}

static void unpack_46_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 46 values into output
	// Values are 8-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 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 328 to 335
	value = ((uint32_t)input[41] << 24);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 336 to 343
	value = ((uint32_t)input[42] << 24);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 344 to 351
	value = ((uint32_t)input[43] << 24);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 352 to 359
	value = ((uint32_t)input[44] << 24);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 360 to 367
	value = ((uint32_t)input[45] << 24);
	output[45] = (double)(value >> 24);
}

static void unpack_46_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 46 values into output
	// Values are 8-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 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 328 to 335
	value = ((uint32_t)input[41] << 24);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 336 to 343
	value = ((uint32_t)input[42] << 24);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 344 to 351
	value = ((uint32_t)input[43] << 24);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 352 to 359
	value = ((uint32_t)input[44] << 24);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 360 to 367
	value = ((uint32_t)input[45] << 24);
	output[45] = (double)(value >> 24);
}

static void unpack_46_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 46 values into output
	// Values are 8-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 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 329 to 336
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)(input[42] & 0x80) << 17);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 337 to 344
	value = ((uint32_t)(input[42] & 0x7f) << 25) |
			((uint32_t)(input[43] & 0x80) << 17);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 345 to 352
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)(input[44] & 0x80) << 17);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 353 to 360
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)(input[45] & 0x80) << 17);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 361 to 368
	value = ((uint32_t)(input[45] & 0x7f) << 25) |
			((uint32_t)(input[46] & 0x80) << 17);
	output[45] = (double)(value >> 24);
}

static void unpack_46_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 46 values into output
	// Values are 8-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 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 329 to 336
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)(input[42] & 0x80) << 17);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 337 to 344
	value = ((uint32_t)(input[42] & 0x7f) << 25) |
			((uint32_t)(input[43] & 0x80) << 17);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 345 to 352
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)(input[44] & 0x80) << 17);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 353 to 360
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)(input[45] & 0x80) << 17);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 361 to 368
	value = ((uint32_t)(input[45] & 0x7f) << 25) |
			((uint32_t)(input[46] & 0x80) << 17);
	output[45] = (double)(value >> 24);
}

static void unpack_46_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 46 values into output
	// Values are 8-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 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 330 to 337
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)(input[42] & 0xc0) << 18);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 338 to 345
	value = ((uint32_t)(input[42] & 0x3f) << 26) |
			((uint32_t)(input[43] & 0xc0) << 18);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 346 to 353
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)(input[44] & 0xc0) << 18);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 354 to 361
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)(input[45] & 0xc0) << 18);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 362 to 369
	value = ((uint32_t)(input[45] & 0x3f) << 26) |
			((uint32_t)(input[46] & 0xc0) << 18);
	output[45] = (double)(value >> 24);
}

static void unpack_46_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 46 values into output
	// Values are 8-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 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 330 to 337
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)(input[42] & 0xc0) << 18);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 338 to 345
	value = ((uint32_t)(input[42] & 0x3f) << 26) |
			((uint32_t)(input[43] & 0xc0) << 18);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 346 to 353
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)(input[44] & 0xc0) << 18);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 354 to 361
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)(input[45] & 0xc0) << 18);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 362 to 369
	value = ((uint32_t)(input[45] & 0x3f) << 26) |
			((uint32_t)(input[46] & 0xc0) << 18);
	output[45] = (double)(value >> 24);
}

static void unpack_46_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 46 values into output
	// Values are 8-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 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 331 to 338
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)(input[42] & 0xe0) << 19);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 339 to 346
	value = ((uint32_t)(input[42] & 0x1f) << 27) |
			((uint32_t)(input[43] & 0xe0) << 19);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 347 to 354
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)(input[44] & 0xe0) << 19);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 355 to 362
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)(input[45] & 0xe0) << 19);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 363 to 370
	value = ((uint32_t)(input[45] & 0x1f) << 27) |
			((uint32_t)(input[46] & 0xe0) << 19);
	output[45] = (double)(value >> 24);
}

static void unpack_46_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 46 values into output
	// Values are 8-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 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 331 to 338
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)(input[42] & 0xe0) << 19);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 339 to 346
	value = ((uint32_t)(input[42] & 0x1f) << 27) |
			((uint32_t)(input[43] & 0xe0) << 19);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 347 to 354
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)(input[44] & 0xe0) << 19);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 355 to 362
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)(input[45] & 0xe0) << 19);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 363 to 370
	value = ((uint32_t)(input[45] & 0x1f) << 27) |
			((uint32_t)(input[46] & 0xe0) << 19);
	output[45] = (double)(value >> 24);
}

static void unpack_46_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 46 values into output
	// Values are 8-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 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 332 to 339
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)(input[42] & 0xf0) << 20);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 340 to 347
	value = ((uint32_t)(input[42] & 0x0f) << 28) |
			((uint32_t)(input[43] & 0xf0) << 20);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 348 to 355
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)(input[44] & 0xf0) << 20);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 356 to 363
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)(input[45] & 0xf0) << 20);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 364 to 371
	value = ((uint32_t)(input[45] & 0x0f) << 28) |
			((uint32_t)(input[46] & 0xf0) << 20);
	output[45] = (double)(value >> 24);
}

static void unpack_46_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 46 values into output
	// Values are 8-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 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 332 to 339
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)(input[42] & 0xf0) << 20);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 340 to 347
	value = ((uint32_t)(input[42] & 0x0f) << 28) |
			((uint32_t)(input[43] & 0xf0) << 20);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 348 to 355
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)(input[44] & 0xf0) << 20);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 356 to 363
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)(input[45] & 0xf0) << 20);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 364 to 371
	value = ((uint32_t)(input[45] & 0x0f) << 28) |
			((uint32_t)(input[46] & 0xf0) << 20);
	output[45] = (double)(value >> 24);
}

static void unpack_46_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 46 values into output
	// Values are 8-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 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 333 to 340
	value = ((uint32_t)(input[41] & 0x07) << 29) |
			((uint32_t)(input[42] & 0xf8) << 21);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 341 to 348
	value = ((uint32_t)(input[42] & 0x07) << 29) |
			((uint32_t)(input[43] & 0xf8) << 21);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 349 to 356
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)(input[44] & 0xf8) << 21);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 357 to 364
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)(input[45] & 0xf8) << 21);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 365 to 372
	value = ((uint32_t)(input[45] & 0x07) << 29) |
			((uint32_t)(input[46] & 0xf8) << 21);
	output[45] = (double)(value >> 24);
}

static void unpack_46_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 46 values into output
	// Values are 8-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 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 333 to 340
	value = ((uint32_t)(input[41] & 0x07) << 29) |
			((uint32_t)(input[42] & 0xf8) << 21);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 341 to 348
	value = ((uint32_t)(input[42] & 0x07) << 29) |
			((uint32_t)(input[43] & 0xf8) << 21);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 349 to 356
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)(input[44] & 0xf8) << 21);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 357 to 364
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)(input[45] & 0xf8) << 21);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 365 to 372
	value = ((uint32_t)(input[45] & 0x07) << 29) |
			((uint32_t)(input[46] & 0xf8) << 21);
	output[45] = (double)(value >> 24);
}

static void unpack_46_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 46 values into output
	// Values are 8-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 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 334 to 341
	value = ((uint32_t)(input[41] & 0x03) << 30) |
			((uint32_t)(input[42] & 0xfc) << 22);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 342 to 349
	value = ((uint32_t)(input[42] & 0x03) << 30) |
			((uint32_t)(input[43] & 0xfc) << 22);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 350 to 357
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)(input[44] & 0xfc) << 22);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 358 to 365
	value = ((uint32_t)(input[44] & 0x03) << 30) |
			((uint32_t)(input[45] & 0xfc) << 22);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 366 to 373
	value = ((uint32_t)(input[45] & 0x03) << 30) |
			((uint32_t)(input[46] & 0xfc) << 22);
	output[45] = (double)(value >> 24);
}

static void unpack_46_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 46 values into output
	// Values are 8-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 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 334 to 341
	value = ((uint32_t)(input[41] & 0x03) << 30) |
			((uint32_t)(input[42] & 0xfc) << 22);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 342 to 349
	value = ((uint32_t)(input[42] & 0x03) << 30) |
			((uint32_t)(input[43] & 0xfc) << 22);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 350 to 357
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)(input[44] & 0xfc) << 22);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 358 to 365
	value = ((uint32_t)(input[44] & 0x03) << 30) |
			((uint32_t)(input[45] & 0xfc) << 22);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 366 to 373
	value = ((uint32_t)(input[45] & 0x03) << 30) |
			((uint32_t)(input[46] & 0xfc) << 22);
	output[45] = (double)(value >> 24);
}

static void unpack_46_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 46 values into output
	// Values are 8-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 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 335 to 342
	value = ((uint32_t)(input[41] & 0x01) << 31) |
			((uint32_t)(input[42] & 0xfe) << 23);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 343 to 350
	value = ((uint32_t)(input[42] & 0x01) << 31) |
			((uint32_t)(input[43] & 0xfe) << 23);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 351 to 358
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)(input[44] & 0xfe) << 23);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 359 to 366
	value = ((uint32_t)(input[44] & 0x01) << 31) |
			((uint32_t)(input[45] & 0xfe) << 23);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 367 to 374
	value = ((uint32_t)(input[45] & 0x01) << 31) |
			((uint32_t)(input[46] & 0xfe) << 23);
	output[45] = (double)(value >> 24);
}

static void unpack_46_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 46 values into output
	// Values are 8-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 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 335 to 342
	value = ((uint32_t)(input[41] & 0x01) << 31) |
			((uint32_t)(input[42] & 0xfe) << 23);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 343 to 350
	value = ((uint32_t)(input[42] & 0x01) << 31) |
			((uint32_t)(input[43] & 0xfe) << 23);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 351 to 358
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)(input[44] & 0xfe) << 23);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 359 to 366
	value = ((uint32_t)(input[44] & 0x01) << 31) |
			((uint32_t)(input[45] & 0xfe) << 23);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 367 to 374
	value = ((uint32_t)(input[45] & 0x01) << 31) |
			((uint32_t)(input[46] & 0xfe) << 23);
	output[45] = (double)(value >> 24);
}

static void unpack_47_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 47 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 376 bits of data.
	// Input must be at least 47 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 328 to 335
	value = ((uint32_t)input[41] << 24);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 336 to 343
	value = ((uint32_t)input[42] << 24);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 344 to 351
	value = ((uint32_t)input[43] << 24);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 352 to 359
	value = ((uint32_t)input[44] << 24);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 360 to 367
	value = ((uint32_t)input[45] << 24);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 368 to 375
	value = ((uint32_t)input[46] << 24);
	output[46] = (double)(value >> 24);
}

static void unpack_47_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 47 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 376 bits of data.
	// Input must be at least 47 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 328 to 335
	value = ((uint32_t)input[41] << 24);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 336 to 343
	value = ((uint32_t)input[42] << 24);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 344 to 351
	value = ((uint32_t)input[43] << 24);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 352 to 359
	value = ((uint32_t)input[44] << 24);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 360 to 367
	value = ((uint32_t)input[45] << 24);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 368 to 375
	value = ((uint32_t)input[46] << 24);
	output[46] = (double)(value >> 24);
}

static void unpack_47_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 47 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 376 bits of data.
	// Input must be at least 48 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 329 to 336
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)(input[42] & 0x80) << 17);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 337 to 344
	value = ((uint32_t)(input[42] & 0x7f) << 25) |
			((uint32_t)(input[43] & 0x80) << 17);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 345 to 352
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)(input[44] & 0x80) << 17);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 353 to 360
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)(input[45] & 0x80) << 17);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 361 to 368
	value = ((uint32_t)(input[45] & 0x7f) << 25) |
			((uint32_t)(input[46] & 0x80) << 17);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 369 to 376
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)(input[47] & 0x80) << 17);
	output[46] = (double)(value >> 24);
}

static void unpack_47_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 47 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 376 bits of data.
	// Input must be at least 48 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 329 to 336
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)(input[42] & 0x80) << 17);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 337 to 344
	value = ((uint32_t)(input[42] & 0x7f) << 25) |
			((uint32_t)(input[43] & 0x80) << 17);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 345 to 352
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)(input[44] & 0x80) << 17);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 353 to 360
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)(input[45] & 0x80) << 17);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 361 to 368
	value = ((uint32_t)(input[45] & 0x7f) << 25) |
			((uint32_t)(input[46] & 0x80) << 17);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 369 to 376
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)(input[47] & 0x80) << 17);
	output[46] = (double)(value >> 24);
}

static void unpack_47_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 47 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 376 bits of data.
	// Input must be at least 48 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 330 to 337
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)(input[42] & 0xc0) << 18);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 338 to 345
	value = ((uint32_t)(input[42] & 0x3f) << 26) |
			((uint32_t)(input[43] & 0xc0) << 18);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 346 to 353
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)(input[44] & 0xc0) << 18);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 354 to 361
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)(input[45] & 0xc0) << 18);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 362 to 369
	value = ((uint32_t)(input[45] & 0x3f) << 26) |
			((uint32_t)(input[46] & 0xc0) << 18);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 370 to 377
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)(input[47] & 0xc0) << 18);
	output[46] = (double)(value >> 24);
}

static void unpack_47_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 47 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 376 bits of data.
	// Input must be at least 48 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 330 to 337
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)(input[42] & 0xc0) << 18);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 338 to 345
	value = ((uint32_t)(input[42] & 0x3f) << 26) |
			((uint32_t)(input[43] & 0xc0) << 18);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 346 to 353
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)(input[44] & 0xc0) << 18);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 354 to 361
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)(input[45] & 0xc0) << 18);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 362 to 369
	value = ((uint32_t)(input[45] & 0x3f) << 26) |
			((uint32_t)(input[46] & 0xc0) << 18);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 370 to 377
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)(input[47] & 0xc0) << 18);
	output[46] = (double)(value >> 24);
}

static void unpack_47_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 47 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 376 bits of data.
	// Input must be at least 48 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 331 to 338
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)(input[42] & 0xe0) << 19);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 339 to 346
	value = ((uint32_t)(input[42] & 0x1f) << 27) |
			((uint32_t)(input[43] & 0xe0) << 19);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 347 to 354
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)(input[44] & 0xe0) << 19);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 355 to 362
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)(input[45] & 0xe0) << 19);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 363 to 370
	value = ((uint32_t)(input[45] & 0x1f) << 27) |
			((uint32_t)(input[46] & 0xe0) << 19);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 371 to 378
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)(input[47] & 0xe0) << 19);
	output[46] = (double)(value >> 24);
}

static void unpack_47_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 47 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 376 bits of data.
	// Input must be at least 48 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 331 to 338
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)(input[42] & 0xe0) << 19);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 339 to 346
	value = ((uint32_t)(input[42] & 0x1f) << 27) |
			((uint32_t)(input[43] & 0xe0) << 19);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 347 to 354
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)(input[44] & 0xe0) << 19);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 355 to 362
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)(input[45] & 0xe0) << 19);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 363 to 370
	value = ((uint32_t)(input[45] & 0x1f) << 27) |
			((uint32_t)(input[46] & 0xe0) << 19);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 371 to 378
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)(input[47] & 0xe0) << 19);
	output[46] = (double)(value >> 24);
}

static void unpack_47_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 47 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 376 bits of data.
	// Input must be at least 48 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 332 to 339
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)(input[42] & 0xf0) << 20);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 340 to 347
	value = ((uint32_t)(input[42] & 0x0f) << 28) |
			((uint32_t)(input[43] & 0xf0) << 20);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 348 to 355
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)(input[44] & 0xf0) << 20);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 356 to 363
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)(input[45] & 0xf0) << 20);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 364 to 371
	value = ((uint32_t)(input[45] & 0x0f) << 28) |
			((uint32_t)(input[46] & 0xf0) << 20);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 372 to 379
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)(input[47] & 0xf0) << 20);
	output[46] = (double)(value >> 24);
}

static void unpack_47_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 47 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 376 bits of data.
	// Input must be at least 48 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 332 to 339
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)(input[42] & 0xf0) << 20);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 340 to 347
	value = ((uint32_t)(input[42] & 0x0f) << 28) |
			((uint32_t)(input[43] & 0xf0) << 20);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 348 to 355
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)(input[44] & 0xf0) << 20);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 356 to 363
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)(input[45] & 0xf0) << 20);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 364 to 371
	value = ((uint32_t)(input[45] & 0x0f) << 28) |
			((uint32_t)(input[46] & 0xf0) << 20);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 372 to 379
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)(input[47] & 0xf0) << 20);
	output[46] = (double)(value >> 24);
}

static void unpack_47_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 47 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 376 bits of data.
	// Input must be at least 48 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 333 to 340
	value = ((uint32_t)(input[41] & 0x07) << 29) |
			((uint32_t)(input[42] & 0xf8) << 21);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 341 to 348
	value = ((uint32_t)(input[42] & 0x07) << 29) |
			((uint32_t)(input[43] & 0xf8) << 21);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 349 to 356
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)(input[44] & 0xf8) << 21);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 357 to 364
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)(input[45] & 0xf8) << 21);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 365 to 372
	value = ((uint32_t)(input[45] & 0x07) << 29) |
			((uint32_t)(input[46] & 0xf8) << 21);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 373 to 380
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)(input[47] & 0xf8) << 21);
	output[46] = (double)(value >> 24);
}

static void unpack_47_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 47 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 376 bits of data.
	// Input must be at least 48 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 333 to 340
	value = ((uint32_t)(input[41] & 0x07) << 29) |
			((uint32_t)(input[42] & 0xf8) << 21);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 341 to 348
	value = ((uint32_t)(input[42] & 0x07) << 29) |
			((uint32_t)(input[43] & 0xf8) << 21);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 349 to 356
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)(input[44] & 0xf8) << 21);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 357 to 364
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)(input[45] & 0xf8) << 21);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 365 to 372
	value = ((uint32_t)(input[45] & 0x07) << 29) |
			((uint32_t)(input[46] & 0xf8) << 21);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 373 to 380
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)(input[47] & 0xf8) << 21);
	output[46] = (double)(value >> 24);
}

static void unpack_47_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 47 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 376 bits of data.
	// Input must be at least 48 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 334 to 341
	value = ((uint32_t)(input[41] & 0x03) << 30) |
			((uint32_t)(input[42] & 0xfc) << 22);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 342 to 349
	value = ((uint32_t)(input[42] & 0x03) << 30) |
			((uint32_t)(input[43] & 0xfc) << 22);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 350 to 357
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)(input[44] & 0xfc) << 22);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 358 to 365
	value = ((uint32_t)(input[44] & 0x03) << 30) |
			((uint32_t)(input[45] & 0xfc) << 22);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 366 to 373
	value = ((uint32_t)(input[45] & 0x03) << 30) |
			((uint32_t)(input[46] & 0xfc) << 22);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 374 to 381
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)(input[47] & 0xfc) << 22);
	output[46] = (double)(value >> 24);
}

static void unpack_47_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 47 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 376 bits of data.
	// Input must be at least 48 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 334 to 341
	value = ((uint32_t)(input[41] & 0x03) << 30) |
			((uint32_t)(input[42] & 0xfc) << 22);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 342 to 349
	value = ((uint32_t)(input[42] & 0x03) << 30) |
			((uint32_t)(input[43] & 0xfc) << 22);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 350 to 357
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)(input[44] & 0xfc) << 22);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 358 to 365
	value = ((uint32_t)(input[44] & 0x03) << 30) |
			((uint32_t)(input[45] & 0xfc) << 22);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 366 to 373
	value = ((uint32_t)(input[45] & 0x03) << 30) |
			((uint32_t)(input[46] & 0xfc) << 22);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 374 to 381
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)(input[47] & 0xfc) << 22);
	output[46] = (double)(value >> 24);
}

static void unpack_47_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 47 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 376 bits of data.
	// Input must be at least 48 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 335 to 342
	value = ((uint32_t)(input[41] & 0x01) << 31) |
			((uint32_t)(input[42] & 0xfe) << 23);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 343 to 350
	value = ((uint32_t)(input[42] & 0x01) << 31) |
			((uint32_t)(input[43] & 0xfe) << 23);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 351 to 358
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)(input[44] & 0xfe) << 23);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 359 to 366
	value = ((uint32_t)(input[44] & 0x01) << 31) |
			((uint32_t)(input[45] & 0xfe) << 23);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 367 to 374
	value = ((uint32_t)(input[45] & 0x01) << 31) |
			((uint32_t)(input[46] & 0xfe) << 23);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 375 to 382
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)(input[47] & 0xfe) << 23);
	output[46] = (double)(value >> 24);
}

static void unpack_47_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 47 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 376 bits of data.
	// Input must be at least 48 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 335 to 342
	value = ((uint32_t)(input[41] & 0x01) << 31) |
			((uint32_t)(input[42] & 0xfe) << 23);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 343 to 350
	value = ((uint32_t)(input[42] & 0x01) << 31) |
			((uint32_t)(input[43] & 0xfe) << 23);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 351 to 358
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)(input[44] & 0xfe) << 23);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 359 to 366
	value = ((uint32_t)(input[44] & 0x01) << 31) |
			((uint32_t)(input[45] & 0xfe) << 23);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 367 to 374
	value = ((uint32_t)(input[45] & 0x01) << 31) |
			((uint32_t)(input[46] & 0xfe) << 23);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 375 to 382
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)(input[47] & 0xfe) << 23);
	output[46] = (double)(value >> 24);
}

static void unpack_48_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 48 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 384 bits of data.
	// Input must be at least 48 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 328 to 335
	value = ((uint32_t)input[41] << 24);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 336 to 343
	value = ((uint32_t)input[42] << 24);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 344 to 351
	value = ((uint32_t)input[43] << 24);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 352 to 359
	value = ((uint32_t)input[44] << 24);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 360 to 367
	value = ((uint32_t)input[45] << 24);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 368 to 375
	value = ((uint32_t)input[46] << 24);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 376 to 383
	value = ((uint32_t)input[47] << 24);
	output[47] = (double)(value >> 24);
}

static void unpack_48_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 48 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 384 bits of data.
	// Input must be at least 48 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 328 to 335
	value = ((uint32_t)input[41] << 24);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 336 to 343
	value = ((uint32_t)input[42] << 24);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 344 to 351
	value = ((uint32_t)input[43] << 24);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 352 to 359
	value = ((uint32_t)input[44] << 24);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 360 to 367
	value = ((uint32_t)input[45] << 24);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 368 to 375
	value = ((uint32_t)input[46] << 24);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 376 to 383
	value = ((uint32_t)input[47] << 24);
	output[47] = (double)(value >> 24);
}

static void unpack_48_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 48 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 384 bits of data.
	// Input must be at least 49 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 329 to 336
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)(input[42] & 0x80) << 17);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 337 to 344
	value = ((uint32_t)(input[42] & 0x7f) << 25) |
			((uint32_t)(input[43] & 0x80) << 17);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 345 to 352
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)(input[44] & 0x80) << 17);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 353 to 360
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)(input[45] & 0x80) << 17);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 361 to 368
	value = ((uint32_t)(input[45] & 0x7f) << 25) |
			((uint32_t)(input[46] & 0x80) << 17);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 369 to 376
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)(input[47] & 0x80) << 17);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 377 to 384
	value = ((uint32_t)(input[47] & 0x7f) << 25) |
			((uint32_t)(input[48] & 0x80) << 17);
	output[47] = (double)(value >> 24);
}

static void unpack_48_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 48 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 384 bits of data.
	// Input must be at least 49 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 329 to 336
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)(input[42] & 0x80) << 17);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 337 to 344
	value = ((uint32_t)(input[42] & 0x7f) << 25) |
			((uint32_t)(input[43] & 0x80) << 17);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 345 to 352
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)(input[44] & 0x80) << 17);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 353 to 360
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)(input[45] & 0x80) << 17);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 361 to 368
	value = ((uint32_t)(input[45] & 0x7f) << 25) |
			((uint32_t)(input[46] & 0x80) << 17);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 369 to 376
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)(input[47] & 0x80) << 17);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 377 to 384
	value = ((uint32_t)(input[47] & 0x7f) << 25) |
			((uint32_t)(input[48] & 0x80) << 17);
	output[47] = (double)(value >> 24);
}

static void unpack_48_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 48 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 384 bits of data.
	// Input must be at least 49 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 330 to 337
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)(input[42] & 0xc0) << 18);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 338 to 345
	value = ((uint32_t)(input[42] & 0x3f) << 26) |
			((uint32_t)(input[43] & 0xc0) << 18);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 346 to 353
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)(input[44] & 0xc0) << 18);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 354 to 361
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)(input[45] & 0xc0) << 18);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 362 to 369
	value = ((uint32_t)(input[45] & 0x3f) << 26) |
			((uint32_t)(input[46] & 0xc0) << 18);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 370 to 377
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)(input[47] & 0xc0) << 18);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 378 to 385
	value = ((uint32_t)(input[47] & 0x3f) << 26) |
			((uint32_t)(input[48] & 0xc0) << 18);
	output[47] = (double)(value >> 24);
}

static void unpack_48_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 48 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 384 bits of data.
	// Input must be at least 49 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 330 to 337
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)(input[42] & 0xc0) << 18);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 338 to 345
	value = ((uint32_t)(input[42] & 0x3f) << 26) |
			((uint32_t)(input[43] & 0xc0) << 18);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 346 to 353
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)(input[44] & 0xc0) << 18);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 354 to 361
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)(input[45] & 0xc0) << 18);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 362 to 369
	value = ((uint32_t)(input[45] & 0x3f) << 26) |
			((uint32_t)(input[46] & 0xc0) << 18);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 370 to 377
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)(input[47] & 0xc0) << 18);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 378 to 385
	value = ((uint32_t)(input[47] & 0x3f) << 26) |
			((uint32_t)(input[48] & 0xc0) << 18);
	output[47] = (double)(value >> 24);
}

static void unpack_48_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 48 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 384 bits of data.
	// Input must be at least 49 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 331 to 338
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)(input[42] & 0xe0) << 19);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 339 to 346
	value = ((uint32_t)(input[42] & 0x1f) << 27) |
			((uint32_t)(input[43] & 0xe0) << 19);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 347 to 354
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)(input[44] & 0xe0) << 19);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 355 to 362
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)(input[45] & 0xe0) << 19);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 363 to 370
	value = ((uint32_t)(input[45] & 0x1f) << 27) |
			((uint32_t)(input[46] & 0xe0) << 19);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 371 to 378
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)(input[47] & 0xe0) << 19);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 379 to 386
	value = ((uint32_t)(input[47] & 0x1f) << 27) |
			((uint32_t)(input[48] & 0xe0) << 19);
	output[47] = (double)(value >> 24);
}

static void unpack_48_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 48 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 384 bits of data.
	// Input must be at least 49 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 331 to 338
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)(input[42] & 0xe0) << 19);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 339 to 346
	value = ((uint32_t)(input[42] & 0x1f) << 27) |
			((uint32_t)(input[43] & 0xe0) << 19);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 347 to 354
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)(input[44] & 0xe0) << 19);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 355 to 362
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)(input[45] & 0xe0) << 19);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 363 to 370
	value = ((uint32_t)(input[45] & 0x1f) << 27) |
			((uint32_t)(input[46] & 0xe0) << 19);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 371 to 378
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)(input[47] & 0xe0) << 19);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 379 to 386
	value = ((uint32_t)(input[47] & 0x1f) << 27) |
			((uint32_t)(input[48] & 0xe0) << 19);
	output[47] = (double)(value >> 24);
}

static void unpack_48_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 48 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 384 bits of data.
	// Input must be at least 49 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 332 to 339
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)(input[42] & 0xf0) << 20);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 340 to 347
	value = ((uint32_t)(input[42] & 0x0f) << 28) |
			((uint32_t)(input[43] & 0xf0) << 20);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 348 to 355
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)(input[44] & 0xf0) << 20);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 356 to 363
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)(input[45] & 0xf0) << 20);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 364 to 371
	value = ((uint32_t)(input[45] & 0x0f) << 28) |
			((uint32_t)(input[46] & 0xf0) << 20);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 372 to 379
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)(input[47] & 0xf0) << 20);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 380 to 387
	value = ((uint32_t)(input[47] & 0x0f) << 28) |
			((uint32_t)(input[48] & 0xf0) << 20);
	output[47] = (double)(value >> 24);
}

static void unpack_48_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 48 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 384 bits of data.
	// Input must be at least 49 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 332 to 339
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)(input[42] & 0xf0) << 20);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 340 to 347
	value = ((uint32_t)(input[42] & 0x0f) << 28) |
			((uint32_t)(input[43] & 0xf0) << 20);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 348 to 355
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)(input[44] & 0xf0) << 20);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 356 to 363
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)(input[45] & 0xf0) << 20);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 364 to 371
	value = ((uint32_t)(input[45] & 0x0f) << 28) |
			((uint32_t)(input[46] & 0xf0) << 20);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 372 to 379
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)(input[47] & 0xf0) << 20);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 380 to 387
	value = ((uint32_t)(input[47] & 0x0f) << 28) |
			((uint32_t)(input[48] & 0xf0) << 20);
	output[47] = (double)(value >> 24);
}

static void unpack_48_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 48 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 384 bits of data.
	// Input must be at least 49 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 333 to 340
	value = ((uint32_t)(input[41] & 0x07) << 29) |
			((uint32_t)(input[42] & 0xf8) << 21);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 341 to 348
	value = ((uint32_t)(input[42] & 0x07) << 29) |
			((uint32_t)(input[43] & 0xf8) << 21);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 349 to 356
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)(input[44] & 0xf8) << 21);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 357 to 364
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)(input[45] & 0xf8) << 21);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 365 to 372
	value = ((uint32_t)(input[45] & 0x07) << 29) |
			((uint32_t)(input[46] & 0xf8) << 21);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 373 to 380
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)(input[47] & 0xf8) << 21);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 381 to 388
	value = ((uint32_t)(input[47] & 0x07) << 29) |
			((uint32_t)(input[48] & 0xf8) << 21);
	output[47] = (double)(value >> 24);
}

static void unpack_48_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 48 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 384 bits of data.
	// Input must be at least 49 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 333 to 340
	value = ((uint32_t)(input[41] & 0x07) << 29) |
			((uint32_t)(input[42] & 0xf8) << 21);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 341 to 348
	value = ((uint32_t)(input[42] & 0x07) << 29) |
			((uint32_t)(input[43] & 0xf8) << 21);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 349 to 356
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)(input[44] & 0xf8) << 21);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 357 to 364
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)(input[45] & 0xf8) << 21);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 365 to 372
	value = ((uint32_t)(input[45] & 0x07) << 29) |
			((uint32_t)(input[46] & 0xf8) << 21);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 373 to 380
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)(input[47] & 0xf8) << 21);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 381 to 388
	value = ((uint32_t)(input[47] & 0x07) << 29) |
			((uint32_t)(input[48] & 0xf8) << 21);
	output[47] = (double)(value >> 24);
}

static void unpack_48_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 48 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 384 bits of data.
	// Input must be at least 49 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 334 to 341
	value = ((uint32_t)(input[41] & 0x03) << 30) |
			((uint32_t)(input[42] & 0xfc) << 22);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 342 to 349
	value = ((uint32_t)(input[42] & 0x03) << 30) |
			((uint32_t)(input[43] & 0xfc) << 22);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 350 to 357
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)(input[44] & 0xfc) << 22);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 358 to 365
	value = ((uint32_t)(input[44] & 0x03) << 30) |
			((uint32_t)(input[45] & 0xfc) << 22);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 366 to 373
	value = ((uint32_t)(input[45] & 0x03) << 30) |
			((uint32_t)(input[46] & 0xfc) << 22);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 374 to 381
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)(input[47] & 0xfc) << 22);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 382 to 389
	value = ((uint32_t)(input[47] & 0x03) << 30) |
			((uint32_t)(input[48] & 0xfc) << 22);
	output[47] = (double)(value >> 24);
}

static void unpack_48_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 48 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 384 bits of data.
	// Input must be at least 49 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 334 to 341
	value = ((uint32_t)(input[41] & 0x03) << 30) |
			((uint32_t)(input[42] & 0xfc) << 22);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 342 to 349
	value = ((uint32_t)(input[42] & 0x03) << 30) |
			((uint32_t)(input[43] & 0xfc) << 22);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 350 to 357
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)(input[44] & 0xfc) << 22);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 358 to 365
	value = ((uint32_t)(input[44] & 0x03) << 30) |
			((uint32_t)(input[45] & 0xfc) << 22);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 366 to 373
	value = ((uint32_t)(input[45] & 0x03) << 30) |
			((uint32_t)(input[46] & 0xfc) << 22);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 374 to 381
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)(input[47] & 0xfc) << 22);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 382 to 389
	value = ((uint32_t)(input[47] & 0x03) << 30) |
			((uint32_t)(input[48] & 0xfc) << 22);
	output[47] = (double)(value >> 24);
}

static void unpack_48_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 48 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 384 bits of data.
	// Input must be at least 49 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 335 to 342
	value = ((uint32_t)(input[41] & 0x01) << 31) |
			((uint32_t)(input[42] & 0xfe) << 23);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 343 to 350
	value = ((uint32_t)(input[42] & 0x01) << 31) |
			((uint32_t)(input[43] & 0xfe) << 23);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 351 to 358
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)(input[44] & 0xfe) << 23);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 359 to 366
	value = ((uint32_t)(input[44] & 0x01) << 31) |
			((uint32_t)(input[45] & 0xfe) << 23);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 367 to 374
	value = ((uint32_t)(input[45] & 0x01) << 31) |
			((uint32_t)(input[46] & 0xfe) << 23);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 375 to 382
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)(input[47] & 0xfe) << 23);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 383 to 390
	value = ((uint32_t)(input[47] & 0x01) << 31) |
			((uint32_t)(input[48] & 0xfe) << 23);
	output[47] = (double)(value >> 24);
}

static void unpack_48_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 48 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 384 bits of data.
	// Input must be at least 49 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 335 to 342
	value = ((uint32_t)(input[41] & 0x01) << 31) |
			((uint32_t)(input[42] & 0xfe) << 23);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 343 to 350
	value = ((uint32_t)(input[42] & 0x01) << 31) |
			((uint32_t)(input[43] & 0xfe) << 23);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 351 to 358
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)(input[44] & 0xfe) << 23);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 359 to 366
	value = ((uint32_t)(input[44] & 0x01) << 31) |
			((uint32_t)(input[45] & 0xfe) << 23);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 367 to 374
	value = ((uint32_t)(input[45] & 0x01) << 31) |
			((uint32_t)(input[46] & 0xfe) << 23);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 375 to 382
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)(input[47] & 0xfe) << 23);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 383 to 390
	value = ((uint32_t)(input[47] & 0x01) << 31) |
			((uint32_t)(input[48] & 0xfe) << 23);
	output[47] = (double)(value >> 24);
}

static void unpack_49_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 49 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 392 bits of data.
	// Input must be at least 49 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 328 to 335
	value = ((uint32_t)input[41] << 24);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 336 to 343
	value = ((uint32_t)input[42] << 24);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 344 to 351
	value = ((uint32_t)input[43] << 24);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 352 to 359
	value = ((uint32_t)input[44] << 24);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 360 to 367
	value = ((uint32_t)input[45] << 24);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 368 to 375
	value = ((uint32_t)input[46] << 24);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 376 to 383
	value = ((uint32_t)input[47] << 24);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 384 to 391
	value = ((uint32_t)input[48] << 24);
	output[48] = (double)(value >> 24);
}

static void unpack_49_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 49 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 392 bits of data.
	// Input must be at least 49 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 328 to 335
	value = ((uint32_t)input[41] << 24);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 336 to 343
	value = ((uint32_t)input[42] << 24);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 344 to 351
	value = ((uint32_t)input[43] << 24);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 352 to 359
	value = ((uint32_t)input[44] << 24);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 360 to 367
	value = ((uint32_t)input[45] << 24);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 368 to 375
	value = ((uint32_t)input[46] << 24);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 376 to 383
	value = ((uint32_t)input[47] << 24);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 384 to 391
	value = ((uint32_t)input[48] << 24);
	output[48] = (double)(value >> 24);
}

static void unpack_49_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 49 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 392 bits of data.
	// Input must be at least 50 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 329 to 336
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)(input[42] & 0x80) << 17);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 337 to 344
	value = ((uint32_t)(input[42] & 0x7f) << 25) |
			((uint32_t)(input[43] & 0x80) << 17);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 345 to 352
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)(input[44] & 0x80) << 17);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 353 to 360
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)(input[45] & 0x80) << 17);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 361 to 368
	value = ((uint32_t)(input[45] & 0x7f) << 25) |
			((uint32_t)(input[46] & 0x80) << 17);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 369 to 376
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)(input[47] & 0x80) << 17);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 377 to 384
	value = ((uint32_t)(input[47] & 0x7f) << 25) |
			((uint32_t)(input[48] & 0x80) << 17);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 385 to 392
	value = ((uint32_t)(input[48] & 0x7f) << 25) |
			((uint32_t)(input[49] & 0x80) << 17);
	output[48] = (double)(value >> 24);
}

static void unpack_49_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 49 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 392 bits of data.
	// Input must be at least 50 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 329 to 336
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)(input[42] & 0x80) << 17);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 337 to 344
	value = ((uint32_t)(input[42] & 0x7f) << 25) |
			((uint32_t)(input[43] & 0x80) << 17);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 345 to 352
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)(input[44] & 0x80) << 17);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 353 to 360
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)(input[45] & 0x80) << 17);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 361 to 368
	value = ((uint32_t)(input[45] & 0x7f) << 25) |
			((uint32_t)(input[46] & 0x80) << 17);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 369 to 376
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)(input[47] & 0x80) << 17);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 377 to 384
	value = ((uint32_t)(input[47] & 0x7f) << 25) |
			((uint32_t)(input[48] & 0x80) << 17);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 385 to 392
	value = ((uint32_t)(input[48] & 0x7f) << 25) |
			((uint32_t)(input[49] & 0x80) << 17);
	output[48] = (double)(value >> 24);
}

static void unpack_49_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 49 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 392 bits of data.
	// Input must be at least 50 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 330 to 337
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)(input[42] & 0xc0) << 18);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 338 to 345
	value = ((uint32_t)(input[42] & 0x3f) << 26) |
			((uint32_t)(input[43] & 0xc0) << 18);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 346 to 353
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)(input[44] & 0xc0) << 18);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 354 to 361
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)(input[45] & 0xc0) << 18);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 362 to 369
	value = ((uint32_t)(input[45] & 0x3f) << 26) |
			((uint32_t)(input[46] & 0xc0) << 18);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 370 to 377
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)(input[47] & 0xc0) << 18);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 378 to 385
	value = ((uint32_t)(input[47] & 0x3f) << 26) |
			((uint32_t)(input[48] & 0xc0) << 18);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 386 to 393
	value = ((uint32_t)(input[48] & 0x3f) << 26) |
			((uint32_t)(input[49] & 0xc0) << 18);
	output[48] = (double)(value >> 24);
}

static void unpack_49_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 49 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 392 bits of data.
	// Input must be at least 50 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 330 to 337
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)(input[42] & 0xc0) << 18);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 338 to 345
	value = ((uint32_t)(input[42] & 0x3f) << 26) |
			((uint32_t)(input[43] & 0xc0) << 18);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 346 to 353
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)(input[44] & 0xc0) << 18);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 354 to 361
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)(input[45] & 0xc0) << 18);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 362 to 369
	value = ((uint32_t)(input[45] & 0x3f) << 26) |
			((uint32_t)(input[46] & 0xc0) << 18);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 370 to 377
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)(input[47] & 0xc0) << 18);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 378 to 385
	value = ((uint32_t)(input[47] & 0x3f) << 26) |
			((uint32_t)(input[48] & 0xc0) << 18);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 386 to 393
	value = ((uint32_t)(input[48] & 0x3f) << 26) |
			((uint32_t)(input[49] & 0xc0) << 18);
	output[48] = (double)(value >> 24);
}

static void unpack_49_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 49 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 392 bits of data.
	// Input must be at least 50 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 331 to 338
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)(input[42] & 0xe0) << 19);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 339 to 346
	value = ((uint32_t)(input[42] & 0x1f) << 27) |
			((uint32_t)(input[43] & 0xe0) << 19);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 347 to 354
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)(input[44] & 0xe0) << 19);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 355 to 362
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)(input[45] & 0xe0) << 19);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 363 to 370
	value = ((uint32_t)(input[45] & 0x1f) << 27) |
			((uint32_t)(input[46] & 0xe0) << 19);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 371 to 378
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)(input[47] & 0xe0) << 19);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 379 to 386
	value = ((uint32_t)(input[47] & 0x1f) << 27) |
			((uint32_t)(input[48] & 0xe0) << 19);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 387 to 394
	value = ((uint32_t)(input[48] & 0x1f) << 27) |
			((uint32_t)(input[49] & 0xe0) << 19);
	output[48] = (double)(value >> 24);
}

static void unpack_49_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 49 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 392 bits of data.
	// Input must be at least 50 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 331 to 338
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)(input[42] & 0xe0) << 19);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 339 to 346
	value = ((uint32_t)(input[42] & 0x1f) << 27) |
			((uint32_t)(input[43] & 0xe0) << 19);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 347 to 354
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)(input[44] & 0xe0) << 19);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 355 to 362
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)(input[45] & 0xe0) << 19);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 363 to 370
	value = ((uint32_t)(input[45] & 0x1f) << 27) |
			((uint32_t)(input[46] & 0xe0) << 19);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 371 to 378
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)(input[47] & 0xe0) << 19);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 379 to 386
	value = ((uint32_t)(input[47] & 0x1f) << 27) |
			((uint32_t)(input[48] & 0xe0) << 19);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 387 to 394
	value = ((uint32_t)(input[48] & 0x1f) << 27) |
			((uint32_t)(input[49] & 0xe0) << 19);
	output[48] = (double)(value >> 24);
}

static void unpack_49_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 49 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 392 bits of data.
	// Input must be at least 50 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 332 to 339
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)(input[42] & 0xf0) << 20);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 340 to 347
	value = ((uint32_t)(input[42] & 0x0f) << 28) |
			((uint32_t)(input[43] & 0xf0) << 20);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 348 to 355
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)(input[44] & 0xf0) << 20);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 356 to 363
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)(input[45] & 0xf0) << 20);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 364 to 371
	value = ((uint32_t)(input[45] & 0x0f) << 28) |
			((uint32_t)(input[46] & 0xf0) << 20);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 372 to 379
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)(input[47] & 0xf0) << 20);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 380 to 387
	value = ((uint32_t)(input[47] & 0x0f) << 28) |
			((uint32_t)(input[48] & 0xf0) << 20);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 388 to 395
	value = ((uint32_t)(input[48] & 0x0f) << 28) |
			((uint32_t)(input[49] & 0xf0) << 20);
	output[48] = (double)(value >> 24);
}

static void unpack_49_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 49 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 392 bits of data.
	// Input must be at least 50 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 332 to 339
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)(input[42] & 0xf0) << 20);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 340 to 347
	value = ((uint32_t)(input[42] & 0x0f) << 28) |
			((uint32_t)(input[43] & 0xf0) << 20);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 348 to 355
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)(input[44] & 0xf0) << 20);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 356 to 363
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)(input[45] & 0xf0) << 20);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 364 to 371
	value = ((uint32_t)(input[45] & 0x0f) << 28) |
			((uint32_t)(input[46] & 0xf0) << 20);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 372 to 379
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)(input[47] & 0xf0) << 20);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 380 to 387
	value = ((uint32_t)(input[47] & 0x0f) << 28) |
			((uint32_t)(input[48] & 0xf0) << 20);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 388 to 395
	value = ((uint32_t)(input[48] & 0x0f) << 28) |
			((uint32_t)(input[49] & 0xf0) << 20);
	output[48] = (double)(value >> 24);
}

static void unpack_49_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 49 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 392 bits of data.
	// Input must be at least 50 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 333 to 340
	value = ((uint32_t)(input[41] & 0x07) << 29) |
			((uint32_t)(input[42] & 0xf8) << 21);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 341 to 348
	value = ((uint32_t)(input[42] & 0x07) << 29) |
			((uint32_t)(input[43] & 0xf8) << 21);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 349 to 356
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)(input[44] & 0xf8) << 21);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 357 to 364
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)(input[45] & 0xf8) << 21);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 365 to 372
	value = ((uint32_t)(input[45] & 0x07) << 29) |
			((uint32_t)(input[46] & 0xf8) << 21);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 373 to 380
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)(input[47] & 0xf8) << 21);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 381 to 388
	value = ((uint32_t)(input[47] & 0x07) << 29) |
			((uint32_t)(input[48] & 0xf8) << 21);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 389 to 396
	value = ((uint32_t)(input[48] & 0x07) << 29) |
			((uint32_t)(input[49] & 0xf8) << 21);
	output[48] = (double)(value >> 24);
}

static void unpack_49_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 49 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 392 bits of data.
	// Input must be at least 50 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 333 to 340
	value = ((uint32_t)(input[41] & 0x07) << 29) |
			((uint32_t)(input[42] & 0xf8) << 21);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 341 to 348
	value = ((uint32_t)(input[42] & 0x07) << 29) |
			((uint32_t)(input[43] & 0xf8) << 21);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 349 to 356
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)(input[44] & 0xf8) << 21);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 357 to 364
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)(input[45] & 0xf8) << 21);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 365 to 372
	value = ((uint32_t)(input[45] & 0x07) << 29) |
			((uint32_t)(input[46] & 0xf8) << 21);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 373 to 380
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)(input[47] & 0xf8) << 21);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 381 to 388
	value = ((uint32_t)(input[47] & 0x07) << 29) |
			((uint32_t)(input[48] & 0xf8) << 21);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 389 to 396
	value = ((uint32_t)(input[48] & 0x07) << 29) |
			((uint32_t)(input[49] & 0xf8) << 21);
	output[48] = (double)(value >> 24);
}

static void unpack_49_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 49 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 392 bits of data.
	// Input must be at least 50 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 334 to 341
	value = ((uint32_t)(input[41] & 0x03) << 30) |
			((uint32_t)(input[42] & 0xfc) << 22);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 342 to 349
	value = ((uint32_t)(input[42] & 0x03) << 30) |
			((uint32_t)(input[43] & 0xfc) << 22);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 350 to 357
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)(input[44] & 0xfc) << 22);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 358 to 365
	value = ((uint32_t)(input[44] & 0x03) << 30) |
			((uint32_t)(input[45] & 0xfc) << 22);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 366 to 373
	value = ((uint32_t)(input[45] & 0x03) << 30) |
			((uint32_t)(input[46] & 0xfc) << 22);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 374 to 381
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)(input[47] & 0xfc) << 22);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 382 to 389
	value = ((uint32_t)(input[47] & 0x03) << 30) |
			((uint32_t)(input[48] & 0xfc) << 22);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 390 to 397
	value = ((uint32_t)(input[48] & 0x03) << 30) |
			((uint32_t)(input[49] & 0xfc) << 22);
	output[48] = (double)(value >> 24);
}

static void unpack_49_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 49 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 392 bits of data.
	// Input must be at least 50 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 334 to 341
	value = ((uint32_t)(input[41] & 0x03) << 30) |
			((uint32_t)(input[42] & 0xfc) << 22);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 342 to 349
	value = ((uint32_t)(input[42] & 0x03) << 30) |
			((uint32_t)(input[43] & 0xfc) << 22);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 350 to 357
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)(input[44] & 0xfc) << 22);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 358 to 365
	value = ((uint32_t)(input[44] & 0x03) << 30) |
			((uint32_t)(input[45] & 0xfc) << 22);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 366 to 373
	value = ((uint32_t)(input[45] & 0x03) << 30) |
			((uint32_t)(input[46] & 0xfc) << 22);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 374 to 381
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)(input[47] & 0xfc) << 22);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 382 to 389
	value = ((uint32_t)(input[47] & 0x03) << 30) |
			((uint32_t)(input[48] & 0xfc) << 22);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 390 to 397
	value = ((uint32_t)(input[48] & 0x03) << 30) |
			((uint32_t)(input[49] & 0xfc) << 22);
	output[48] = (double)(value >> 24);
}

static void unpack_49_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 49 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 392 bits of data.
	// Input must be at least 50 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 335 to 342
	value = ((uint32_t)(input[41] & 0x01) << 31) |
			((uint32_t)(input[42] & 0xfe) << 23);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 343 to 350
	value = ((uint32_t)(input[42] & 0x01) << 31) |
			((uint32_t)(input[43] & 0xfe) << 23);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 351 to 358
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)(input[44] & 0xfe) << 23);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 359 to 366
	value = ((uint32_t)(input[44] & 0x01) << 31) |
			((uint32_t)(input[45] & 0xfe) << 23);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 367 to 374
	value = ((uint32_t)(input[45] & 0x01) << 31) |
			((uint32_t)(input[46] & 0xfe) << 23);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 375 to 382
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)(input[47] & 0xfe) << 23);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 383 to 390
	value = ((uint32_t)(input[47] & 0x01) << 31) |
			((uint32_t)(input[48] & 0xfe) << 23);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 391 to 398
	value = ((uint32_t)(input[48] & 0x01) << 31) |
			((uint32_t)(input[49] & 0xfe) << 23);
	output[48] = (double)(value >> 24);
}

static void unpack_49_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 49 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 392 bits of data.
	// Input must be at least 50 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 335 to 342
	value = ((uint32_t)(input[41] & 0x01) << 31) |
			((uint32_t)(input[42] & 0xfe) << 23);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 343 to 350
	value = ((uint32_t)(input[42] & 0x01) << 31) |
			((uint32_t)(input[43] & 0xfe) << 23);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 351 to 358
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)(input[44] & 0xfe) << 23);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 359 to 366
	value = ((uint32_t)(input[44] & 0x01) << 31) |
			((uint32_t)(input[45] & 0xfe) << 23);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 367 to 374
	value = ((uint32_t)(input[45] & 0x01) << 31) |
			((uint32_t)(input[46] & 0xfe) << 23);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 375 to 382
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)(input[47] & 0xfe) << 23);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 383 to 390
	value = ((uint32_t)(input[47] & 0x01) << 31) |
			((uint32_t)(input[48] & 0xfe) << 23);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 391 to 398
	value = ((uint32_t)(input[48] & 0x01) << 31) |
			((uint32_t)(input[49] & 0xfe) << 23);
	output[48] = (double)(value >> 24);
}

static void unpack_50_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 50 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 400 bits of data.
	// Input must be at least 50 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 328 to 335
	value = ((uint32_t)input[41] << 24);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 336 to 343
	value = ((uint32_t)input[42] << 24);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 344 to 351
	value = ((uint32_t)input[43] << 24);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 352 to 359
	value = ((uint32_t)input[44] << 24);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 360 to 367
	value = ((uint32_t)input[45] << 24);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 368 to 375
	value = ((uint32_t)input[46] << 24);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 376 to 383
	value = ((uint32_t)input[47] << 24);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 384 to 391
	value = ((uint32_t)input[48] << 24);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 392 to 399
	value = ((uint32_t)input[49] << 24);
	output[49] = (double)(value >> 24);
}

static void unpack_50_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 50 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 400 bits of data.
	// Input must be at least 50 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 328 to 335
	value = ((uint32_t)input[41] << 24);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 336 to 343
	value = ((uint32_t)input[42] << 24);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 344 to 351
	value = ((uint32_t)input[43] << 24);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 352 to 359
	value = ((uint32_t)input[44] << 24);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 360 to 367
	value = ((uint32_t)input[45] << 24);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 368 to 375
	value = ((uint32_t)input[46] << 24);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 376 to 383
	value = ((uint32_t)input[47] << 24);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 384 to 391
	value = ((uint32_t)input[48] << 24);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 392 to 399
	value = ((uint32_t)input[49] << 24);
	output[49] = (double)(value >> 24);
}

static void unpack_50_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 50 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 400 bits of data.
	// Input must be at least 51 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 329 to 336
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)(input[42] & 0x80) << 17);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 337 to 344
	value = ((uint32_t)(input[42] & 0x7f) << 25) |
			((uint32_t)(input[43] & 0x80) << 17);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 345 to 352
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)(input[44] & 0x80) << 17);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 353 to 360
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)(input[45] & 0x80) << 17);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 361 to 368
	value = ((uint32_t)(input[45] & 0x7f) << 25) |
			((uint32_t)(input[46] & 0x80) << 17);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 369 to 376
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)(input[47] & 0x80) << 17);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 377 to 384
	value = ((uint32_t)(input[47] & 0x7f) << 25) |
			((uint32_t)(input[48] & 0x80) << 17);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 385 to 392
	value = ((uint32_t)(input[48] & 0x7f) << 25) |
			((uint32_t)(input[49] & 0x80) << 17);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 393 to 400
	value = ((uint32_t)(input[49] & 0x7f) << 25) |
			((uint32_t)(input[50] & 0x80) << 17);
	output[49] = (double)(value >> 24);
}

static void unpack_50_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 50 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 400 bits of data.
	// Input must be at least 51 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 329 to 336
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)(input[42] & 0x80) << 17);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 337 to 344
	value = ((uint32_t)(input[42] & 0x7f) << 25) |
			((uint32_t)(input[43] & 0x80) << 17);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 345 to 352
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)(input[44] & 0x80) << 17);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 353 to 360
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)(input[45] & 0x80) << 17);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 361 to 368
	value = ((uint32_t)(input[45] & 0x7f) << 25) |
			((uint32_t)(input[46] & 0x80) << 17);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 369 to 376
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)(input[47] & 0x80) << 17);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 377 to 384
	value = ((uint32_t)(input[47] & 0x7f) << 25) |
			((uint32_t)(input[48] & 0x80) << 17);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 385 to 392
	value = ((uint32_t)(input[48] & 0x7f) << 25) |
			((uint32_t)(input[49] & 0x80) << 17);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 393 to 400
	value = ((uint32_t)(input[49] & 0x7f) << 25) |
			((uint32_t)(input[50] & 0x80) << 17);
	output[49] = (double)(value >> 24);
}

static void unpack_50_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 50 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 400 bits of data.
	// Input must be at least 51 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 330 to 337
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)(input[42] & 0xc0) << 18);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 338 to 345
	value = ((uint32_t)(input[42] & 0x3f) << 26) |
			((uint32_t)(input[43] & 0xc0) << 18);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 346 to 353
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)(input[44] & 0xc0) << 18);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 354 to 361
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)(input[45] & 0xc0) << 18);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 362 to 369
	value = ((uint32_t)(input[45] & 0x3f) << 26) |
			((uint32_t)(input[46] & 0xc0) << 18);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 370 to 377
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)(input[47] & 0xc0) << 18);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 378 to 385
	value = ((uint32_t)(input[47] & 0x3f) << 26) |
			((uint32_t)(input[48] & 0xc0) << 18);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 386 to 393
	value = ((uint32_t)(input[48] & 0x3f) << 26) |
			((uint32_t)(input[49] & 0xc0) << 18);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 394 to 401
	value = ((uint32_t)(input[49] & 0x3f) << 26) |
			((uint32_t)(input[50] & 0xc0) << 18);
	output[49] = (double)(value >> 24);
}

static void unpack_50_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 50 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 400 bits of data.
	// Input must be at least 51 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 330 to 337
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)(input[42] & 0xc0) << 18);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 338 to 345
	value = ((uint32_t)(input[42] & 0x3f) << 26) |
			((uint32_t)(input[43] & 0xc0) << 18);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 346 to 353
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)(input[44] & 0xc0) << 18);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 354 to 361
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)(input[45] & 0xc0) << 18);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 362 to 369
	value = ((uint32_t)(input[45] & 0x3f) << 26) |
			((uint32_t)(input[46] & 0xc0) << 18);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 370 to 377
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)(input[47] & 0xc0) << 18);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 378 to 385
	value = ((uint32_t)(input[47] & 0x3f) << 26) |
			((uint32_t)(input[48] & 0xc0) << 18);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 386 to 393
	value = ((uint32_t)(input[48] & 0x3f) << 26) |
			((uint32_t)(input[49] & 0xc0) << 18);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 394 to 401
	value = ((uint32_t)(input[49] & 0x3f) << 26) |
			((uint32_t)(input[50] & 0xc0) << 18);
	output[49] = (double)(value >> 24);
}

static void unpack_50_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 50 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 400 bits of data.
	// Input must be at least 51 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 331 to 338
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)(input[42] & 0xe0) << 19);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 339 to 346
	value = ((uint32_t)(input[42] & 0x1f) << 27) |
			((uint32_t)(input[43] & 0xe0) << 19);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 347 to 354
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)(input[44] & 0xe0) << 19);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 355 to 362
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)(input[45] & 0xe0) << 19);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 363 to 370
	value = ((uint32_t)(input[45] & 0x1f) << 27) |
			((uint32_t)(input[46] & 0xe0) << 19);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 371 to 378
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)(input[47] & 0xe0) << 19);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 379 to 386
	value = ((uint32_t)(input[47] & 0x1f) << 27) |
			((uint32_t)(input[48] & 0xe0) << 19);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 387 to 394
	value = ((uint32_t)(input[48] & 0x1f) << 27) |
			((uint32_t)(input[49] & 0xe0) << 19);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 395 to 402
	value = ((uint32_t)(input[49] & 0x1f) << 27) |
			((uint32_t)(input[50] & 0xe0) << 19);
	output[49] = (double)(value >> 24);
}

static void unpack_50_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 50 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 400 bits of data.
	// Input must be at least 51 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 331 to 338
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)(input[42] & 0xe0) << 19);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 339 to 346
	value = ((uint32_t)(input[42] & 0x1f) << 27) |
			((uint32_t)(input[43] & 0xe0) << 19);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 347 to 354
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)(input[44] & 0xe0) << 19);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 355 to 362
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)(input[45] & 0xe0) << 19);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 363 to 370
	value = ((uint32_t)(input[45] & 0x1f) << 27) |
			((uint32_t)(input[46] & 0xe0) << 19);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 371 to 378
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)(input[47] & 0xe0) << 19);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 379 to 386
	value = ((uint32_t)(input[47] & 0x1f) << 27) |
			((uint32_t)(input[48] & 0xe0) << 19);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 387 to 394
	value = ((uint32_t)(input[48] & 0x1f) << 27) |
			((uint32_t)(input[49] & 0xe0) << 19);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 395 to 402
	value = ((uint32_t)(input[49] & 0x1f) << 27) |
			((uint32_t)(input[50] & 0xe0) << 19);
	output[49] = (double)(value >> 24);
}

static void unpack_50_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 50 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 400 bits of data.
	// Input must be at least 51 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 332 to 339
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)(input[42] & 0xf0) << 20);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 340 to 347
	value = ((uint32_t)(input[42] & 0x0f) << 28) |
			((uint32_t)(input[43] & 0xf0) << 20);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 348 to 355
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)(input[44] & 0xf0) << 20);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 356 to 363
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)(input[45] & 0xf0) << 20);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 364 to 371
	value = ((uint32_t)(input[45] & 0x0f) << 28) |
			((uint32_t)(input[46] & 0xf0) << 20);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 372 to 379
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)(input[47] & 0xf0) << 20);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 380 to 387
	value = ((uint32_t)(input[47] & 0x0f) << 28) |
			((uint32_t)(input[48] & 0xf0) << 20);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 388 to 395
	value = ((uint32_t)(input[48] & 0x0f) << 28) |
			((uint32_t)(input[49] & 0xf0) << 20);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 396 to 403
	value = ((uint32_t)(input[49] & 0x0f) << 28) |
			((uint32_t)(input[50] & 0xf0) << 20);
	output[49] = (double)(value >> 24);
}

static void unpack_50_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 50 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 400 bits of data.
	// Input must be at least 51 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 332 to 339
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)(input[42] & 0xf0) << 20);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 340 to 347
	value = ((uint32_t)(input[42] & 0x0f) << 28) |
			((uint32_t)(input[43] & 0xf0) << 20);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 348 to 355
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)(input[44] & 0xf0) << 20);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 356 to 363
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)(input[45] & 0xf0) << 20);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 364 to 371
	value = ((uint32_t)(input[45] & 0x0f) << 28) |
			((uint32_t)(input[46] & 0xf0) << 20);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 372 to 379
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)(input[47] & 0xf0) << 20);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 380 to 387
	value = ((uint32_t)(input[47] & 0x0f) << 28) |
			((uint32_t)(input[48] & 0xf0) << 20);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 388 to 395
	value = ((uint32_t)(input[48] & 0x0f) << 28) |
			((uint32_t)(input[49] & 0xf0) << 20);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 396 to 403
	value = ((uint32_t)(input[49] & 0x0f) << 28) |
			((uint32_t)(input[50] & 0xf0) << 20);
	output[49] = (double)(value >> 24);
}

static void unpack_50_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 50 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 400 bits of data.
	// Input must be at least 51 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 333 to 340
	value = ((uint32_t)(input[41] & 0x07) << 29) |
			((uint32_t)(input[42] & 0xf8) << 21);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 341 to 348
	value = ((uint32_t)(input[42] & 0x07) << 29) |
			((uint32_t)(input[43] & 0xf8) << 21);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 349 to 356
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)(input[44] & 0xf8) << 21);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 357 to 364
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)(input[45] & 0xf8) << 21);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 365 to 372
	value = ((uint32_t)(input[45] & 0x07) << 29) |
			((uint32_t)(input[46] & 0xf8) << 21);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 373 to 380
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)(input[47] & 0xf8) << 21);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 381 to 388
	value = ((uint32_t)(input[47] & 0x07) << 29) |
			((uint32_t)(input[48] & 0xf8) << 21);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 389 to 396
	value = ((uint32_t)(input[48] & 0x07) << 29) |
			((uint32_t)(input[49] & 0xf8) << 21);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 397 to 404
	value = ((uint32_t)(input[49] & 0x07) << 29) |
			((uint32_t)(input[50] & 0xf8) << 21);
	output[49] = (double)(value >> 24);
}

static void unpack_50_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 50 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 400 bits of data.
	// Input must be at least 51 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 333 to 340
	value = ((uint32_t)(input[41] & 0x07) << 29) |
			((uint32_t)(input[42] & 0xf8) << 21);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 341 to 348
	value = ((uint32_t)(input[42] & 0x07) << 29) |
			((uint32_t)(input[43] & 0xf8) << 21);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 349 to 356
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)(input[44] & 0xf8) << 21);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 357 to 364
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)(input[45] & 0xf8) << 21);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 365 to 372
	value = ((uint32_t)(input[45] & 0x07) << 29) |
			((uint32_t)(input[46] & 0xf8) << 21);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 373 to 380
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)(input[47] & 0xf8) << 21);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 381 to 388
	value = ((uint32_t)(input[47] & 0x07) << 29) |
			((uint32_t)(input[48] & 0xf8) << 21);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 389 to 396
	value = ((uint32_t)(input[48] & 0x07) << 29) |
			((uint32_t)(input[49] & 0xf8) << 21);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 397 to 404
	value = ((uint32_t)(input[49] & 0x07) << 29) |
			((uint32_t)(input[50] & 0xf8) << 21);
	output[49] = (double)(value >> 24);
}

static void unpack_50_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 50 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 400 bits of data.
	// Input must be at least 51 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 334 to 341
	value = ((uint32_t)(input[41] & 0x03) << 30) |
			((uint32_t)(input[42] & 0xfc) << 22);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 342 to 349
	value = ((uint32_t)(input[42] & 0x03) << 30) |
			((uint32_t)(input[43] & 0xfc) << 22);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 350 to 357
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)(input[44] & 0xfc) << 22);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 358 to 365
	value = ((uint32_t)(input[44] & 0x03) << 30) |
			((uint32_t)(input[45] & 0xfc) << 22);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 366 to 373
	value = ((uint32_t)(input[45] & 0x03) << 30) |
			((uint32_t)(input[46] & 0xfc) << 22);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 374 to 381
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)(input[47] & 0xfc) << 22);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 382 to 389
	value = ((uint32_t)(input[47] & 0x03) << 30) |
			((uint32_t)(input[48] & 0xfc) << 22);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 390 to 397
	value = ((uint32_t)(input[48] & 0x03) << 30) |
			((uint32_t)(input[49] & 0xfc) << 22);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 398 to 405
	value = ((uint32_t)(input[49] & 0x03) << 30) |
			((uint32_t)(input[50] & 0xfc) << 22);
	output[49] = (double)(value >> 24);
}

static void unpack_50_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 50 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 400 bits of data.
	// Input must be at least 51 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 334 to 341
	value = ((uint32_t)(input[41] & 0x03) << 30) |
			((uint32_t)(input[42] & 0xfc) << 22);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 342 to 349
	value = ((uint32_t)(input[42] & 0x03) << 30) |
			((uint32_t)(input[43] & 0xfc) << 22);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 350 to 357
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)(input[44] & 0xfc) << 22);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 358 to 365
	value = ((uint32_t)(input[44] & 0x03) << 30) |
			((uint32_t)(input[45] & 0xfc) << 22);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 366 to 373
	value = ((uint32_t)(input[45] & 0x03) << 30) |
			((uint32_t)(input[46] & 0xfc) << 22);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 374 to 381
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)(input[47] & 0xfc) << 22);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 382 to 389
	value = ((uint32_t)(input[47] & 0x03) << 30) |
			((uint32_t)(input[48] & 0xfc) << 22);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 390 to 397
	value = ((uint32_t)(input[48] & 0x03) << 30) |
			((uint32_t)(input[49] & 0xfc) << 22);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 398 to 405
	value = ((uint32_t)(input[49] & 0x03) << 30) |
			((uint32_t)(input[50] & 0xfc) << 22);
	output[49] = (double)(value >> 24);
}

static void unpack_50_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 50 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 400 bits of data.
	// Input must be at least 51 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 335 to 342
	value = ((uint32_t)(input[41] & 0x01) << 31) |
			((uint32_t)(input[42] & 0xfe) << 23);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 343 to 350
	value = ((uint32_t)(input[42] & 0x01) << 31) |
			((uint32_t)(input[43] & 0xfe) << 23);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 351 to 358
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)(input[44] & 0xfe) << 23);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 359 to 366
	value = ((uint32_t)(input[44] & 0x01) << 31) |
			((uint32_t)(input[45] & 0xfe) << 23);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 367 to 374
	value = ((uint32_t)(input[45] & 0x01) << 31) |
			((uint32_t)(input[46] & 0xfe) << 23);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 375 to 382
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)(input[47] & 0xfe) << 23);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 383 to 390
	value = ((uint32_t)(input[47] & 0x01) << 31) |
			((uint32_t)(input[48] & 0xfe) << 23);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 391 to 398
	value = ((uint32_t)(input[48] & 0x01) << 31) |
			((uint32_t)(input[49] & 0xfe) << 23);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 399 to 406
	value = ((uint32_t)(input[49] & 0x01) << 31) |
			((uint32_t)(input[50] & 0xfe) << 23);
	output[49] = (double)(value >> 24);
}

static void unpack_50_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 50 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 400 bits of data.
	// Input must be at least 51 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 335 to 342
	value = ((uint32_t)(input[41] & 0x01) << 31) |
			((uint32_t)(input[42] & 0xfe) << 23);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 343 to 350
	value = ((uint32_t)(input[42] & 0x01) << 31) |
			((uint32_t)(input[43] & 0xfe) << 23);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 351 to 358
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)(input[44] & 0xfe) << 23);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 359 to 366
	value = ((uint32_t)(input[44] & 0x01) << 31) |
			((uint32_t)(input[45] & 0xfe) << 23);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 367 to 374
	value = ((uint32_t)(input[45] & 0x01) << 31) |
			((uint32_t)(input[46] & 0xfe) << 23);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 375 to 382
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)(input[47] & 0xfe) << 23);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 383 to 390
	value = ((uint32_t)(input[47] & 0x01) << 31) |
			((uint32_t)(input[48] & 0xfe) << 23);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 391 to 398
	value = ((uint32_t)(input[48] & 0x01) << 31) |
			((uint32_t)(input[49] & 0xfe) << 23);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 399 to 406
	value = ((uint32_t)(input[49] & 0x01) << 31) |
			((uint32_t)(input[50] & 0xfe) << 23);
	output[49] = (double)(value >> 24);
}

static void unpack_51_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 51 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 408 bits of data.
	// Input must be at least 51 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 328 to 335
	value = ((uint32_t)input[41] << 24);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 336 to 343
	value = ((uint32_t)input[42] << 24);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 344 to 351
	value = ((uint32_t)input[43] << 24);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 352 to 359
	value = ((uint32_t)input[44] << 24);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 360 to 367
	value = ((uint32_t)input[45] << 24);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 368 to 375
	value = ((uint32_t)input[46] << 24);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 376 to 383
	value = ((uint32_t)input[47] << 24);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 384 to 391
	value = ((uint32_t)input[48] << 24);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 392 to 399
	value = ((uint32_t)input[49] << 24);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 400 to 407
	value = ((uint32_t)input[50] << 24);
	output[50] = (double)(value >> 24);
}

static void unpack_51_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 51 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 408 bits of data.
	// Input must be at least 51 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 328 to 335
	value = ((uint32_t)input[41] << 24);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 336 to 343
	value = ((uint32_t)input[42] << 24);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 344 to 351
	value = ((uint32_t)input[43] << 24);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 352 to 359
	value = ((uint32_t)input[44] << 24);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 360 to 367
	value = ((uint32_t)input[45] << 24);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 368 to 375
	value = ((uint32_t)input[46] << 24);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 376 to 383
	value = ((uint32_t)input[47] << 24);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 384 to 391
	value = ((uint32_t)input[48] << 24);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 392 to 399
	value = ((uint32_t)input[49] << 24);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 400 to 407
	value = ((uint32_t)input[50] << 24);
	output[50] = (double)(value >> 24);
}

static void unpack_51_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 51 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 408 bits of data.
	// Input must be at least 52 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 329 to 336
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)(input[42] & 0x80) << 17);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 337 to 344
	value = ((uint32_t)(input[42] & 0x7f) << 25) |
			((uint32_t)(input[43] & 0x80) << 17);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 345 to 352
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)(input[44] & 0x80) << 17);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 353 to 360
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)(input[45] & 0x80) << 17);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 361 to 368
	value = ((uint32_t)(input[45] & 0x7f) << 25) |
			((uint32_t)(input[46] & 0x80) << 17);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 369 to 376
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)(input[47] & 0x80) << 17);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 377 to 384
	value = ((uint32_t)(input[47] & 0x7f) << 25) |
			((uint32_t)(input[48] & 0x80) << 17);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 385 to 392
	value = ((uint32_t)(input[48] & 0x7f) << 25) |
			((uint32_t)(input[49] & 0x80) << 17);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 393 to 400
	value = ((uint32_t)(input[49] & 0x7f) << 25) |
			((uint32_t)(input[50] & 0x80) << 17);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 401 to 408
	value = ((uint32_t)(input[50] & 0x7f) << 25) |
			((uint32_t)(input[51] & 0x80) << 17);
	output[50] = (double)(value >> 24);
}

static void unpack_51_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 51 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 408 bits of data.
	// Input must be at least 52 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 329 to 336
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)(input[42] & 0x80) << 17);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 337 to 344
	value = ((uint32_t)(input[42] & 0x7f) << 25) |
			((uint32_t)(input[43] & 0x80) << 17);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 345 to 352
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)(input[44] & 0x80) << 17);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 353 to 360
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)(input[45] & 0x80) << 17);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 361 to 368
	value = ((uint32_t)(input[45] & 0x7f) << 25) |
			((uint32_t)(input[46] & 0x80) << 17);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 369 to 376
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)(input[47] & 0x80) << 17);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 377 to 384
	value = ((uint32_t)(input[47] & 0x7f) << 25) |
			((uint32_t)(input[48] & 0x80) << 17);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 385 to 392
	value = ((uint32_t)(input[48] & 0x7f) << 25) |
			((uint32_t)(input[49] & 0x80) << 17);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 393 to 400
	value = ((uint32_t)(input[49] & 0x7f) << 25) |
			((uint32_t)(input[50] & 0x80) << 17);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 401 to 408
	value = ((uint32_t)(input[50] & 0x7f) << 25) |
			((uint32_t)(input[51] & 0x80) << 17);
	output[50] = (double)(value >> 24);
}

static void unpack_51_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 51 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 408 bits of data.
	// Input must be at least 52 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 330 to 337
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)(input[42] & 0xc0) << 18);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 338 to 345
	value = ((uint32_t)(input[42] & 0x3f) << 26) |
			((uint32_t)(input[43] & 0xc0) << 18);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 346 to 353
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)(input[44] & 0xc0) << 18);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 354 to 361
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)(input[45] & 0xc0) << 18);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 362 to 369
	value = ((uint32_t)(input[45] & 0x3f) << 26) |
			((uint32_t)(input[46] & 0xc0) << 18);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 370 to 377
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)(input[47] & 0xc0) << 18);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 378 to 385
	value = ((uint32_t)(input[47] & 0x3f) << 26) |
			((uint32_t)(input[48] & 0xc0) << 18);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 386 to 393
	value = ((uint32_t)(input[48] & 0x3f) << 26) |
			((uint32_t)(input[49] & 0xc0) << 18);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 394 to 401
	value = ((uint32_t)(input[49] & 0x3f) << 26) |
			((uint32_t)(input[50] & 0xc0) << 18);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 402 to 409
	value = ((uint32_t)(input[50] & 0x3f) << 26) |
			((uint32_t)(input[51] & 0xc0) << 18);
	output[50] = (double)(value >> 24);
}

static void unpack_51_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 51 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 408 bits of data.
	// Input must be at least 52 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 330 to 337
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)(input[42] & 0xc0) << 18);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 338 to 345
	value = ((uint32_t)(input[42] & 0x3f) << 26) |
			((uint32_t)(input[43] & 0xc0) << 18);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 346 to 353
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)(input[44] & 0xc0) << 18);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 354 to 361
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)(input[45] & 0xc0) << 18);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 362 to 369
	value = ((uint32_t)(input[45] & 0x3f) << 26) |
			((uint32_t)(input[46] & 0xc0) << 18);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 370 to 377
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)(input[47] & 0xc0) << 18);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 378 to 385
	value = ((uint32_t)(input[47] & 0x3f) << 26) |
			((uint32_t)(input[48] & 0xc0) << 18);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 386 to 393
	value = ((uint32_t)(input[48] & 0x3f) << 26) |
			((uint32_t)(input[49] & 0xc0) << 18);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 394 to 401
	value = ((uint32_t)(input[49] & 0x3f) << 26) |
			((uint32_t)(input[50] & 0xc0) << 18);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 402 to 409
	value = ((uint32_t)(input[50] & 0x3f) << 26) |
			((uint32_t)(input[51] & 0xc0) << 18);
	output[50] = (double)(value >> 24);
}

static void unpack_51_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 51 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 408 bits of data.
	// Input must be at least 52 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 331 to 338
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)(input[42] & 0xe0) << 19);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 339 to 346
	value = ((uint32_t)(input[42] & 0x1f) << 27) |
			((uint32_t)(input[43] & 0xe0) << 19);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 347 to 354
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)(input[44] & 0xe0) << 19);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 355 to 362
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)(input[45] & 0xe0) << 19);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 363 to 370
	value = ((uint32_t)(input[45] & 0x1f) << 27) |
			((uint32_t)(input[46] & 0xe0) << 19);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 371 to 378
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)(input[47] & 0xe0) << 19);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 379 to 386
	value = ((uint32_t)(input[47] & 0x1f) << 27) |
			((uint32_t)(input[48] & 0xe0) << 19);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 387 to 394
	value = ((uint32_t)(input[48] & 0x1f) << 27) |
			((uint32_t)(input[49] & 0xe0) << 19);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 395 to 402
	value = ((uint32_t)(input[49] & 0x1f) << 27) |
			((uint32_t)(input[50] & 0xe0) << 19);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 403 to 410
	value = ((uint32_t)(input[50] & 0x1f) << 27) |
			((uint32_t)(input[51] & 0xe0) << 19);
	output[50] = (double)(value >> 24);
}

static void unpack_51_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 51 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 408 bits of data.
	// Input must be at least 52 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 331 to 338
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)(input[42] & 0xe0) << 19);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 339 to 346
	value = ((uint32_t)(input[42] & 0x1f) << 27) |
			((uint32_t)(input[43] & 0xe0) << 19);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 347 to 354
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)(input[44] & 0xe0) << 19);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 355 to 362
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)(input[45] & 0xe0) << 19);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 363 to 370
	value = ((uint32_t)(input[45] & 0x1f) << 27) |
			((uint32_t)(input[46] & 0xe0) << 19);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 371 to 378
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)(input[47] & 0xe0) << 19);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 379 to 386
	value = ((uint32_t)(input[47] & 0x1f) << 27) |
			((uint32_t)(input[48] & 0xe0) << 19);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 387 to 394
	value = ((uint32_t)(input[48] & 0x1f) << 27) |
			((uint32_t)(input[49] & 0xe0) << 19);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 395 to 402
	value = ((uint32_t)(input[49] & 0x1f) << 27) |
			((uint32_t)(input[50] & 0xe0) << 19);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 403 to 410
	value = ((uint32_t)(input[50] & 0x1f) << 27) |
			((uint32_t)(input[51] & 0xe0) << 19);
	output[50] = (double)(value >> 24);
}

static void unpack_51_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 51 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 408 bits of data.
	// Input must be at least 52 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 332 to 339
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)(input[42] & 0xf0) << 20);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 340 to 347
	value = ((uint32_t)(input[42] & 0x0f) << 28) |
			((uint32_t)(input[43] & 0xf0) << 20);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 348 to 355
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)(input[44] & 0xf0) << 20);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 356 to 363
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)(input[45] & 0xf0) << 20);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 364 to 371
	value = ((uint32_t)(input[45] & 0x0f) << 28) |
			((uint32_t)(input[46] & 0xf0) << 20);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 372 to 379
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)(input[47] & 0xf0) << 20);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 380 to 387
	value = ((uint32_t)(input[47] & 0x0f) << 28) |
			((uint32_t)(input[48] & 0xf0) << 20);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 388 to 395
	value = ((uint32_t)(input[48] & 0x0f) << 28) |
			((uint32_t)(input[49] & 0xf0) << 20);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 396 to 403
	value = ((uint32_t)(input[49] & 0x0f) << 28) |
			((uint32_t)(input[50] & 0xf0) << 20);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 404 to 411
	value = ((uint32_t)(input[50] & 0x0f) << 28) |
			((uint32_t)(input[51] & 0xf0) << 20);
	output[50] = (double)(value >> 24);
}

static void unpack_51_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 51 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 408 bits of data.
	// Input must be at least 52 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 332 to 339
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)(input[42] & 0xf0) << 20);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 340 to 347
	value = ((uint32_t)(input[42] & 0x0f) << 28) |
			((uint32_t)(input[43] & 0xf0) << 20);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 348 to 355
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)(input[44] & 0xf0) << 20);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 356 to 363
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)(input[45] & 0xf0) << 20);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 364 to 371
	value = ((uint32_t)(input[45] & 0x0f) << 28) |
			((uint32_t)(input[46] & 0xf0) << 20);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 372 to 379
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)(input[47] & 0xf0) << 20);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 380 to 387
	value = ((uint32_t)(input[47] & 0x0f) << 28) |
			((uint32_t)(input[48] & 0xf0) << 20);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 388 to 395
	value = ((uint32_t)(input[48] & 0x0f) << 28) |
			((uint32_t)(input[49] & 0xf0) << 20);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 396 to 403
	value = ((uint32_t)(input[49] & 0x0f) << 28) |
			((uint32_t)(input[50] & 0xf0) << 20);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 404 to 411
	value = ((uint32_t)(input[50] & 0x0f) << 28) |
			((uint32_t)(input[51] & 0xf0) << 20);
	output[50] = (double)(value >> 24);
}

static void unpack_51_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 51 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 408 bits of data.
	// Input must be at least 52 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 333 to 340
	value = ((uint32_t)(input[41] & 0x07) << 29) |
			((uint32_t)(input[42] & 0xf8) << 21);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 341 to 348
	value = ((uint32_t)(input[42] & 0x07) << 29) |
			((uint32_t)(input[43] & 0xf8) << 21);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 349 to 356
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)(input[44] & 0xf8) << 21);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 357 to 364
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)(input[45] & 0xf8) << 21);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 365 to 372
	value = ((uint32_t)(input[45] & 0x07) << 29) |
			((uint32_t)(input[46] & 0xf8) << 21);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 373 to 380
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)(input[47] & 0xf8) << 21);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 381 to 388
	value = ((uint32_t)(input[47] & 0x07) << 29) |
			((uint32_t)(input[48] & 0xf8) << 21);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 389 to 396
	value = ((uint32_t)(input[48] & 0x07) << 29) |
			((uint32_t)(input[49] & 0xf8) << 21);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 397 to 404
	value = ((uint32_t)(input[49] & 0x07) << 29) |
			((uint32_t)(input[50] & 0xf8) << 21);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 405 to 412
	value = ((uint32_t)(input[50] & 0x07) << 29) |
			((uint32_t)(input[51] & 0xf8) << 21);
	output[50] = (double)(value >> 24);
}

static void unpack_51_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 51 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 408 bits of data.
	// Input must be at least 52 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 333 to 340
	value = ((uint32_t)(input[41] & 0x07) << 29) |
			((uint32_t)(input[42] & 0xf8) << 21);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 341 to 348
	value = ((uint32_t)(input[42] & 0x07) << 29) |
			((uint32_t)(input[43] & 0xf8) << 21);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 349 to 356
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)(input[44] & 0xf8) << 21);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 357 to 364
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)(input[45] & 0xf8) << 21);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 365 to 372
	value = ((uint32_t)(input[45] & 0x07) << 29) |
			((uint32_t)(input[46] & 0xf8) << 21);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 373 to 380
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)(input[47] & 0xf8) << 21);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 381 to 388
	value = ((uint32_t)(input[47] & 0x07) << 29) |
			((uint32_t)(input[48] & 0xf8) << 21);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 389 to 396
	value = ((uint32_t)(input[48] & 0x07) << 29) |
			((uint32_t)(input[49] & 0xf8) << 21);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 397 to 404
	value = ((uint32_t)(input[49] & 0x07) << 29) |
			((uint32_t)(input[50] & 0xf8) << 21);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 405 to 412
	value = ((uint32_t)(input[50] & 0x07) << 29) |
			((uint32_t)(input[51] & 0xf8) << 21);
	output[50] = (double)(value >> 24);
}

static void unpack_51_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 51 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 408 bits of data.
	// Input must be at least 52 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 334 to 341
	value = ((uint32_t)(input[41] & 0x03) << 30) |
			((uint32_t)(input[42] & 0xfc) << 22);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 342 to 349
	value = ((uint32_t)(input[42] & 0x03) << 30) |
			((uint32_t)(input[43] & 0xfc) << 22);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 350 to 357
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)(input[44] & 0xfc) << 22);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 358 to 365
	value = ((uint32_t)(input[44] & 0x03) << 30) |
			((uint32_t)(input[45] & 0xfc) << 22);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 366 to 373
	value = ((uint32_t)(input[45] & 0x03) << 30) |
			((uint32_t)(input[46] & 0xfc) << 22);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 374 to 381
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)(input[47] & 0xfc) << 22);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 382 to 389
	value = ((uint32_t)(input[47] & 0x03) << 30) |
			((uint32_t)(input[48] & 0xfc) << 22);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 390 to 397
	value = ((uint32_t)(input[48] & 0x03) << 30) |
			((uint32_t)(input[49] & 0xfc) << 22);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 398 to 405
	value = ((uint32_t)(input[49] & 0x03) << 30) |
			((uint32_t)(input[50] & 0xfc) << 22);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 406 to 413
	value = ((uint32_t)(input[50] & 0x03) << 30) |
			((uint32_t)(input[51] & 0xfc) << 22);
	output[50] = (double)(value >> 24);
}

static void unpack_51_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 51 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 408 bits of data.
	// Input must be at least 52 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 334 to 341
	value = ((uint32_t)(input[41] & 0x03) << 30) |
			((uint32_t)(input[42] & 0xfc) << 22);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 342 to 349
	value = ((uint32_t)(input[42] & 0x03) << 30) |
			((uint32_t)(input[43] & 0xfc) << 22);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 350 to 357
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)(input[44] & 0xfc) << 22);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 358 to 365
	value = ((uint32_t)(input[44] & 0x03) << 30) |
			((uint32_t)(input[45] & 0xfc) << 22);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 366 to 373
	value = ((uint32_t)(input[45] & 0x03) << 30) |
			((uint32_t)(input[46] & 0xfc) << 22);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 374 to 381
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)(input[47] & 0xfc) << 22);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 382 to 389
	value = ((uint32_t)(input[47] & 0x03) << 30) |
			((uint32_t)(input[48] & 0xfc) << 22);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 390 to 397
	value = ((uint32_t)(input[48] & 0x03) << 30) |
			((uint32_t)(input[49] & 0xfc) << 22);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 398 to 405
	value = ((uint32_t)(input[49] & 0x03) << 30) |
			((uint32_t)(input[50] & 0xfc) << 22);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 406 to 413
	value = ((uint32_t)(input[50] & 0x03) << 30) |
			((uint32_t)(input[51] & 0xfc) << 22);
	output[50] = (double)(value >> 24);
}

static void unpack_51_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 51 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 408 bits of data.
	// Input must be at least 52 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 335 to 342
	value = ((uint32_t)(input[41] & 0x01) << 31) |
			((uint32_t)(input[42] & 0xfe) << 23);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 343 to 350
	value = ((uint32_t)(input[42] & 0x01) << 31) |
			((uint32_t)(input[43] & 0xfe) << 23);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 351 to 358
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)(input[44] & 0xfe) << 23);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 359 to 366
	value = ((uint32_t)(input[44] & 0x01) << 31) |
			((uint32_t)(input[45] & 0xfe) << 23);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 367 to 374
	value = ((uint32_t)(input[45] & 0x01) << 31) |
			((uint32_t)(input[46] & 0xfe) << 23);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 375 to 382
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)(input[47] & 0xfe) << 23);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 383 to 390
	value = ((uint32_t)(input[47] & 0x01) << 31) |
			((uint32_t)(input[48] & 0xfe) << 23);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 391 to 398
	value = ((uint32_t)(input[48] & 0x01) << 31) |
			((uint32_t)(input[49] & 0xfe) << 23);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 399 to 406
	value = ((uint32_t)(input[49] & 0x01) << 31) |
			((uint32_t)(input[50] & 0xfe) << 23);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 407 to 414
	value = ((uint32_t)(input[50] & 0x01) << 31) |
			((uint32_t)(input[51] & 0xfe) << 23);
	output[50] = (double)(value >> 24);
}

static void unpack_51_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 51 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 408 bits of data.
	// Input must be at least 52 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 335 to 342
	value = ((uint32_t)(input[41] & 0x01) << 31) |
			((uint32_t)(input[42] & 0xfe) << 23);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 343 to 350
	value = ((uint32_t)(input[42] & 0x01) << 31) |
			((uint32_t)(input[43] & 0xfe) << 23);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 351 to 358
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)(input[44] & 0xfe) << 23);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 359 to 366
	value = ((uint32_t)(input[44] & 0x01) << 31) |
			((uint32_t)(input[45] & 0xfe) << 23);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 367 to 374
	value = ((uint32_t)(input[45] & 0x01) << 31) |
			((uint32_t)(input[46] & 0xfe) << 23);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 375 to 382
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)(input[47] & 0xfe) << 23);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 383 to 390
	value = ((uint32_t)(input[47] & 0x01) << 31) |
			((uint32_t)(input[48] & 0xfe) << 23);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 391 to 398
	value = ((uint32_t)(input[48] & 0x01) << 31) |
			((uint32_t)(input[49] & 0xfe) << 23);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 399 to 406
	value = ((uint32_t)(input[49] & 0x01) << 31) |
			((uint32_t)(input[50] & 0xfe) << 23);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 407 to 414
	value = ((uint32_t)(input[50] & 0x01) << 31) |
			((uint32_t)(input[51] & 0xfe) << 23);
	output[50] = (double)(value >> 24);
}

static void unpack_52_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 52 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 416 bits of data.
	// Input must be at least 52 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 328 to 335
	value = ((uint32_t)input[41] << 24);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 336 to 343
	value = ((uint32_t)input[42] << 24);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 344 to 351
	value = ((uint32_t)input[43] << 24);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 352 to 359
	value = ((uint32_t)input[44] << 24);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 360 to 367
	value = ((uint32_t)input[45] << 24);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 368 to 375
	value = ((uint32_t)input[46] << 24);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 376 to 383
	value = ((uint32_t)input[47] << 24);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 384 to 391
	value = ((uint32_t)input[48] << 24);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 392 to 399
	value = ((uint32_t)input[49] << 24);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 400 to 407
	value = ((uint32_t)input[50] << 24);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 408 to 415
	value = ((uint32_t)input[51] << 24);
	output[51] = (double)(value >> 24);
}

static void unpack_52_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 52 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 416 bits of data.
	// Input must be at least 52 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 328 to 335
	value = ((uint32_t)input[41] << 24);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 336 to 343
	value = ((uint32_t)input[42] << 24);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 344 to 351
	value = ((uint32_t)input[43] << 24);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 352 to 359
	value = ((uint32_t)input[44] << 24);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 360 to 367
	value = ((uint32_t)input[45] << 24);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 368 to 375
	value = ((uint32_t)input[46] << 24);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 376 to 383
	value = ((uint32_t)input[47] << 24);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 384 to 391
	value = ((uint32_t)input[48] << 24);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 392 to 399
	value = ((uint32_t)input[49] << 24);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 400 to 407
	value = ((uint32_t)input[50] << 24);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 408 to 415
	value = ((uint32_t)input[51] << 24);
	output[51] = (double)(value >> 24);
}

static void unpack_52_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 52 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 416 bits of data.
	// Input must be at least 53 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 329 to 336
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)(input[42] & 0x80) << 17);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 337 to 344
	value = ((uint32_t)(input[42] & 0x7f) << 25) |
			((uint32_t)(input[43] & 0x80) << 17);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 345 to 352
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)(input[44] & 0x80) << 17);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 353 to 360
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)(input[45] & 0x80) << 17);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 361 to 368
	value = ((uint32_t)(input[45] & 0x7f) << 25) |
			((uint32_t)(input[46] & 0x80) << 17);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 369 to 376
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)(input[47] & 0x80) << 17);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 377 to 384
	value = ((uint32_t)(input[47] & 0x7f) << 25) |
			((uint32_t)(input[48] & 0x80) << 17);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 385 to 392
	value = ((uint32_t)(input[48] & 0x7f) << 25) |
			((uint32_t)(input[49] & 0x80) << 17);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 393 to 400
	value = ((uint32_t)(input[49] & 0x7f) << 25) |
			((uint32_t)(input[50] & 0x80) << 17);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 401 to 408
	value = ((uint32_t)(input[50] & 0x7f) << 25) |
			((uint32_t)(input[51] & 0x80) << 17);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 409 to 416
	value = ((uint32_t)(input[51] & 0x7f) << 25) |
			((uint32_t)(input[52] & 0x80) << 17);
	output[51] = (double)(value >> 24);
}

static void unpack_52_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 52 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 416 bits of data.
	// Input must be at least 53 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 329 to 336
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)(input[42] & 0x80) << 17);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 337 to 344
	value = ((uint32_t)(input[42] & 0x7f) << 25) |
			((uint32_t)(input[43] & 0x80) << 17);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 345 to 352
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)(input[44] & 0x80) << 17);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 353 to 360
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)(input[45] & 0x80) << 17);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 361 to 368
	value = ((uint32_t)(input[45] & 0x7f) << 25) |
			((uint32_t)(input[46] & 0x80) << 17);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 369 to 376
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)(input[47] & 0x80) << 17);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 377 to 384
	value = ((uint32_t)(input[47] & 0x7f) << 25) |
			((uint32_t)(input[48] & 0x80) << 17);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 385 to 392
	value = ((uint32_t)(input[48] & 0x7f) << 25) |
			((uint32_t)(input[49] & 0x80) << 17);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 393 to 400
	value = ((uint32_t)(input[49] & 0x7f) << 25) |
			((uint32_t)(input[50] & 0x80) << 17);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 401 to 408
	value = ((uint32_t)(input[50] & 0x7f) << 25) |
			((uint32_t)(input[51] & 0x80) << 17);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 409 to 416
	value = ((uint32_t)(input[51] & 0x7f) << 25) |
			((uint32_t)(input[52] & 0x80) << 17);
	output[51] = (double)(value >> 24);
}

static void unpack_52_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 52 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 416 bits of data.
	// Input must be at least 53 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 330 to 337
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)(input[42] & 0xc0) << 18);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 338 to 345
	value = ((uint32_t)(input[42] & 0x3f) << 26) |
			((uint32_t)(input[43] & 0xc0) << 18);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 346 to 353
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)(input[44] & 0xc0) << 18);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 354 to 361
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)(input[45] & 0xc0) << 18);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 362 to 369
	value = ((uint32_t)(input[45] & 0x3f) << 26) |
			((uint32_t)(input[46] & 0xc0) << 18);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 370 to 377
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)(input[47] & 0xc0) << 18);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 378 to 385
	value = ((uint32_t)(input[47] & 0x3f) << 26) |
			((uint32_t)(input[48] & 0xc0) << 18);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 386 to 393
	value = ((uint32_t)(input[48] & 0x3f) << 26) |
			((uint32_t)(input[49] & 0xc0) << 18);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 394 to 401
	value = ((uint32_t)(input[49] & 0x3f) << 26) |
			((uint32_t)(input[50] & 0xc0) << 18);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 402 to 409
	value = ((uint32_t)(input[50] & 0x3f) << 26) |
			((uint32_t)(input[51] & 0xc0) << 18);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 410 to 417
	value = ((uint32_t)(input[51] & 0x3f) << 26) |
			((uint32_t)(input[52] & 0xc0) << 18);
	output[51] = (double)(value >> 24);
}

static void unpack_52_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 52 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 416 bits of data.
	// Input must be at least 53 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 330 to 337
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)(input[42] & 0xc0) << 18);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 338 to 345
	value = ((uint32_t)(input[42] & 0x3f) << 26) |
			((uint32_t)(input[43] & 0xc0) << 18);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 346 to 353
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)(input[44] & 0xc0) << 18);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 354 to 361
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)(input[45] & 0xc0) << 18);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 362 to 369
	value = ((uint32_t)(input[45] & 0x3f) << 26) |
			((uint32_t)(input[46] & 0xc0) << 18);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 370 to 377
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)(input[47] & 0xc0) << 18);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 378 to 385
	value = ((uint32_t)(input[47] & 0x3f) << 26) |
			((uint32_t)(input[48] & 0xc0) << 18);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 386 to 393
	value = ((uint32_t)(input[48] & 0x3f) << 26) |
			((uint32_t)(input[49] & 0xc0) << 18);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 394 to 401
	value = ((uint32_t)(input[49] & 0x3f) << 26) |
			((uint32_t)(input[50] & 0xc0) << 18);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 402 to 409
	value = ((uint32_t)(input[50] & 0x3f) << 26) |
			((uint32_t)(input[51] & 0xc0) << 18);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 410 to 417
	value = ((uint32_t)(input[51] & 0x3f) << 26) |
			((uint32_t)(input[52] & 0xc0) << 18);
	output[51] = (double)(value >> 24);
}

static void unpack_52_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 52 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 416 bits of data.
	// Input must be at least 53 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 331 to 338
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)(input[42] & 0xe0) << 19);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 339 to 346
	value = ((uint32_t)(input[42] & 0x1f) << 27) |
			((uint32_t)(input[43] & 0xe0) << 19);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 347 to 354
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)(input[44] & 0xe0) << 19);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 355 to 362
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)(input[45] & 0xe0) << 19);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 363 to 370
	value = ((uint32_t)(input[45] & 0x1f) << 27) |
			((uint32_t)(input[46] & 0xe0) << 19);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 371 to 378
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)(input[47] & 0xe0) << 19);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 379 to 386
	value = ((uint32_t)(input[47] & 0x1f) << 27) |
			((uint32_t)(input[48] & 0xe0) << 19);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 387 to 394
	value = ((uint32_t)(input[48] & 0x1f) << 27) |
			((uint32_t)(input[49] & 0xe0) << 19);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 395 to 402
	value = ((uint32_t)(input[49] & 0x1f) << 27) |
			((uint32_t)(input[50] & 0xe0) << 19);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 403 to 410
	value = ((uint32_t)(input[50] & 0x1f) << 27) |
			((uint32_t)(input[51] & 0xe0) << 19);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 411 to 418
	value = ((uint32_t)(input[51] & 0x1f) << 27) |
			((uint32_t)(input[52] & 0xe0) << 19);
	output[51] = (double)(value >> 24);
}

static void unpack_52_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 52 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 416 bits of data.
	// Input must be at least 53 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 331 to 338
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)(input[42] & 0xe0) << 19);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 339 to 346
	value = ((uint32_t)(input[42] & 0x1f) << 27) |
			((uint32_t)(input[43] & 0xe0) << 19);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 347 to 354
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)(input[44] & 0xe0) << 19);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 355 to 362
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)(input[45] & 0xe0) << 19);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 363 to 370
	value = ((uint32_t)(input[45] & 0x1f) << 27) |
			((uint32_t)(input[46] & 0xe0) << 19);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 371 to 378
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)(input[47] & 0xe0) << 19);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 379 to 386
	value = ((uint32_t)(input[47] & 0x1f) << 27) |
			((uint32_t)(input[48] & 0xe0) << 19);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 387 to 394
	value = ((uint32_t)(input[48] & 0x1f) << 27) |
			((uint32_t)(input[49] & 0xe0) << 19);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 395 to 402
	value = ((uint32_t)(input[49] & 0x1f) << 27) |
			((uint32_t)(input[50] & 0xe0) << 19);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 403 to 410
	value = ((uint32_t)(input[50] & 0x1f) << 27) |
			((uint32_t)(input[51] & 0xe0) << 19);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 411 to 418
	value = ((uint32_t)(input[51] & 0x1f) << 27) |
			((uint32_t)(input[52] & 0xe0) << 19);
	output[51] = (double)(value >> 24);
}

static void unpack_52_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 52 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 416 bits of data.
	// Input must be at least 53 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 332 to 339
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)(input[42] & 0xf0) << 20);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 340 to 347
	value = ((uint32_t)(input[42] & 0x0f) << 28) |
			((uint32_t)(input[43] & 0xf0) << 20);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 348 to 355
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)(input[44] & 0xf0) << 20);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 356 to 363
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)(input[45] & 0xf0) << 20);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 364 to 371
	value = ((uint32_t)(input[45] & 0x0f) << 28) |
			((uint32_t)(input[46] & 0xf0) << 20);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 372 to 379
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)(input[47] & 0xf0) << 20);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 380 to 387
	value = ((uint32_t)(input[47] & 0x0f) << 28) |
			((uint32_t)(input[48] & 0xf0) << 20);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 388 to 395
	value = ((uint32_t)(input[48] & 0x0f) << 28) |
			((uint32_t)(input[49] & 0xf0) << 20);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 396 to 403
	value = ((uint32_t)(input[49] & 0x0f) << 28) |
			((uint32_t)(input[50] & 0xf0) << 20);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 404 to 411
	value = ((uint32_t)(input[50] & 0x0f) << 28) |
			((uint32_t)(input[51] & 0xf0) << 20);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 412 to 419
	value = ((uint32_t)(input[51] & 0x0f) << 28) |
			((uint32_t)(input[52] & 0xf0) << 20);
	output[51] = (double)(value >> 24);
}

static void unpack_52_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 52 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 416 bits of data.
	// Input must be at least 53 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 332 to 339
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)(input[42] & 0xf0) << 20);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 340 to 347
	value = ((uint32_t)(input[42] & 0x0f) << 28) |
			((uint32_t)(input[43] & 0xf0) << 20);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 348 to 355
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)(input[44] & 0xf0) << 20);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 356 to 363
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)(input[45] & 0xf0) << 20);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 364 to 371
	value = ((uint32_t)(input[45] & 0x0f) << 28) |
			((uint32_t)(input[46] & 0xf0) << 20);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 372 to 379
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)(input[47] & 0xf0) << 20);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 380 to 387
	value = ((uint32_t)(input[47] & 0x0f) << 28) |
			((uint32_t)(input[48] & 0xf0) << 20);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 388 to 395
	value = ((uint32_t)(input[48] & 0x0f) << 28) |
			((uint32_t)(input[49] & 0xf0) << 20);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 396 to 403
	value = ((uint32_t)(input[49] & 0x0f) << 28) |
			((uint32_t)(input[50] & 0xf0) << 20);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 404 to 411
	value = ((uint32_t)(input[50] & 0x0f) << 28) |
			((uint32_t)(input[51] & 0xf0) << 20);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 412 to 419
	value = ((uint32_t)(input[51] & 0x0f) << 28) |
			((uint32_t)(input[52] & 0xf0) << 20);
	output[51] = (double)(value >> 24);
}

static void unpack_52_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 52 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 416 bits of data.
	// Input must be at least 53 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 333 to 340
	value = ((uint32_t)(input[41] & 0x07) << 29) |
			((uint32_t)(input[42] & 0xf8) << 21);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 341 to 348
	value = ((uint32_t)(input[42] & 0x07) << 29) |
			((uint32_t)(input[43] & 0xf8) << 21);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 349 to 356
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)(input[44] & 0xf8) << 21);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 357 to 364
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)(input[45] & 0xf8) << 21);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 365 to 372
	value = ((uint32_t)(input[45] & 0x07) << 29) |
			((uint32_t)(input[46] & 0xf8) << 21);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 373 to 380
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)(input[47] & 0xf8) << 21);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 381 to 388
	value = ((uint32_t)(input[47] & 0x07) << 29) |
			((uint32_t)(input[48] & 0xf8) << 21);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 389 to 396
	value = ((uint32_t)(input[48] & 0x07) << 29) |
			((uint32_t)(input[49] & 0xf8) << 21);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 397 to 404
	value = ((uint32_t)(input[49] & 0x07) << 29) |
			((uint32_t)(input[50] & 0xf8) << 21);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 405 to 412
	value = ((uint32_t)(input[50] & 0x07) << 29) |
			((uint32_t)(input[51] & 0xf8) << 21);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 413 to 420
	value = ((uint32_t)(input[51] & 0x07) << 29) |
			((uint32_t)(input[52] & 0xf8) << 21);
	output[51] = (double)(value >> 24);
}

static void unpack_52_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 52 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 416 bits of data.
	// Input must be at least 53 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 333 to 340
	value = ((uint32_t)(input[41] & 0x07) << 29) |
			((uint32_t)(input[42] & 0xf8) << 21);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 341 to 348
	value = ((uint32_t)(input[42] & 0x07) << 29) |
			((uint32_t)(input[43] & 0xf8) << 21);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 349 to 356
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)(input[44] & 0xf8) << 21);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 357 to 364
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)(input[45] & 0xf8) << 21);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 365 to 372
	value = ((uint32_t)(input[45] & 0x07) << 29) |
			((uint32_t)(input[46] & 0xf8) << 21);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 373 to 380
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)(input[47] & 0xf8) << 21);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 381 to 388
	value = ((uint32_t)(input[47] & 0x07) << 29) |
			((uint32_t)(input[48] & 0xf8) << 21);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 389 to 396
	value = ((uint32_t)(input[48] & 0x07) << 29) |
			((uint32_t)(input[49] & 0xf8) << 21);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 397 to 404
	value = ((uint32_t)(input[49] & 0x07) << 29) |
			((uint32_t)(input[50] & 0xf8) << 21);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 405 to 412
	value = ((uint32_t)(input[50] & 0x07) << 29) |
			((uint32_t)(input[51] & 0xf8) << 21);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 413 to 420
	value = ((uint32_t)(input[51] & 0x07) << 29) |
			((uint32_t)(input[52] & 0xf8) << 21);
	output[51] = (double)(value >> 24);
}

static void unpack_52_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 52 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 416 bits of data.
	// Input must be at least 53 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 334 to 341
	value = ((uint32_t)(input[41] & 0x03) << 30) |
			((uint32_t)(input[42] & 0xfc) << 22);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 342 to 349
	value = ((uint32_t)(input[42] & 0x03) << 30) |
			((uint32_t)(input[43] & 0xfc) << 22);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 350 to 357
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)(input[44] & 0xfc) << 22);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 358 to 365
	value = ((uint32_t)(input[44] & 0x03) << 30) |
			((uint32_t)(input[45] & 0xfc) << 22);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 366 to 373
	value = ((uint32_t)(input[45] & 0x03) << 30) |
			((uint32_t)(input[46] & 0xfc) << 22);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 374 to 381
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)(input[47] & 0xfc) << 22);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 382 to 389
	value = ((uint32_t)(input[47] & 0x03) << 30) |
			((uint32_t)(input[48] & 0xfc) << 22);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 390 to 397
	value = ((uint32_t)(input[48] & 0x03) << 30) |
			((uint32_t)(input[49] & 0xfc) << 22);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 398 to 405
	value = ((uint32_t)(input[49] & 0x03) << 30) |
			((uint32_t)(input[50] & 0xfc) << 22);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 406 to 413
	value = ((uint32_t)(input[50] & 0x03) << 30) |
			((uint32_t)(input[51] & 0xfc) << 22);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 414 to 421
	value = ((uint32_t)(input[51] & 0x03) << 30) |
			((uint32_t)(input[52] & 0xfc) << 22);
	output[51] = (double)(value >> 24);
}

static void unpack_52_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 52 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 416 bits of data.
	// Input must be at least 53 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 334 to 341
	value = ((uint32_t)(input[41] & 0x03) << 30) |
			((uint32_t)(input[42] & 0xfc) << 22);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 342 to 349
	value = ((uint32_t)(input[42] & 0x03) << 30) |
			((uint32_t)(input[43] & 0xfc) << 22);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 350 to 357
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)(input[44] & 0xfc) << 22);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 358 to 365
	value = ((uint32_t)(input[44] & 0x03) << 30) |
			((uint32_t)(input[45] & 0xfc) << 22);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 366 to 373
	value = ((uint32_t)(input[45] & 0x03) << 30) |
			((uint32_t)(input[46] & 0xfc) << 22);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 374 to 381
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)(input[47] & 0xfc) << 22);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 382 to 389
	value = ((uint32_t)(input[47] & 0x03) << 30) |
			((uint32_t)(input[48] & 0xfc) << 22);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 390 to 397
	value = ((uint32_t)(input[48] & 0x03) << 30) |
			((uint32_t)(input[49] & 0xfc) << 22);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 398 to 405
	value = ((uint32_t)(input[49] & 0x03) << 30) |
			((uint32_t)(input[50] & 0xfc) << 22);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 406 to 413
	value = ((uint32_t)(input[50] & 0x03) << 30) |
			((uint32_t)(input[51] & 0xfc) << 22);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 414 to 421
	value = ((uint32_t)(input[51] & 0x03) << 30) |
			((uint32_t)(input[52] & 0xfc) << 22);
	output[51] = (double)(value >> 24);
}

static void unpack_52_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 52 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 416 bits of data.
	// Input must be at least 53 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 335 to 342
	value = ((uint32_t)(input[41] & 0x01) << 31) |
			((uint32_t)(input[42] & 0xfe) << 23);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 343 to 350
	value = ((uint32_t)(input[42] & 0x01) << 31) |
			((uint32_t)(input[43] & 0xfe) << 23);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 351 to 358
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)(input[44] & 0xfe) << 23);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 359 to 366
	value = ((uint32_t)(input[44] & 0x01) << 31) |
			((uint32_t)(input[45] & 0xfe) << 23);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 367 to 374
	value = ((uint32_t)(input[45] & 0x01) << 31) |
			((uint32_t)(input[46] & 0xfe) << 23);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 375 to 382
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)(input[47] & 0xfe) << 23);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 383 to 390
	value = ((uint32_t)(input[47] & 0x01) << 31) |
			((uint32_t)(input[48] & 0xfe) << 23);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 391 to 398
	value = ((uint32_t)(input[48] & 0x01) << 31) |
			((uint32_t)(input[49] & 0xfe) << 23);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 399 to 406
	value = ((uint32_t)(input[49] & 0x01) << 31) |
			((uint32_t)(input[50] & 0xfe) << 23);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 407 to 414
	value = ((uint32_t)(input[50] & 0x01) << 31) |
			((uint32_t)(input[51] & 0xfe) << 23);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 415 to 422
	value = ((uint32_t)(input[51] & 0x01) << 31) |
			((uint32_t)(input[52] & 0xfe) << 23);
	output[51] = (double)(value >> 24);
}

static void unpack_52_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 52 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 416 bits of data.
	// Input must be at least 53 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 335 to 342
	value = ((uint32_t)(input[41] & 0x01) << 31) |
			((uint32_t)(input[42] & 0xfe) << 23);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 343 to 350
	value = ((uint32_t)(input[42] & 0x01) << 31) |
			((uint32_t)(input[43] & 0xfe) << 23);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 351 to 358
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)(input[44] & 0xfe) << 23);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 359 to 366
	value = ((uint32_t)(input[44] & 0x01) << 31) |
			((uint32_t)(input[45] & 0xfe) << 23);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 367 to 374
	value = ((uint32_t)(input[45] & 0x01) << 31) |
			((uint32_t)(input[46] & 0xfe) << 23);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 375 to 382
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)(input[47] & 0xfe) << 23);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 383 to 390
	value = ((uint32_t)(input[47] & 0x01) << 31) |
			((uint32_t)(input[48] & 0xfe) << 23);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 391 to 398
	value = ((uint32_t)(input[48] & 0x01) << 31) |
			((uint32_t)(input[49] & 0xfe) << 23);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 399 to 406
	value = ((uint32_t)(input[49] & 0x01) << 31) |
			((uint32_t)(input[50] & 0xfe) << 23);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 407 to 414
	value = ((uint32_t)(input[50] & 0x01) << 31) |
			((uint32_t)(input[51] & 0xfe) << 23);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 415 to 422
	value = ((uint32_t)(input[51] & 0x01) << 31) |
			((uint32_t)(input[52] & 0xfe) << 23);
	output[51] = (double)(value >> 24);
}

static void unpack_53_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 53 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 424 bits of data.
	// Input must be at least 53 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 328 to 335
	value = ((uint32_t)input[41] << 24);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 336 to 343
	value = ((uint32_t)input[42] << 24);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 344 to 351
	value = ((uint32_t)input[43] << 24);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 352 to 359
	value = ((uint32_t)input[44] << 24);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 360 to 367
	value = ((uint32_t)input[45] << 24);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 368 to 375
	value = ((uint32_t)input[46] << 24);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 376 to 383
	value = ((uint32_t)input[47] << 24);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 384 to 391
	value = ((uint32_t)input[48] << 24);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 392 to 399
	value = ((uint32_t)input[49] << 24);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 400 to 407
	value = ((uint32_t)input[50] << 24);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 408 to 415
	value = ((uint32_t)input[51] << 24);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 416 to 423
	value = ((uint32_t)input[52] << 24);
	output[52] = (double)(value >> 24);
}

static void unpack_53_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 53 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 424 bits of data.
	// Input must be at least 53 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 328 to 335
	value = ((uint32_t)input[41] << 24);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 336 to 343
	value = ((uint32_t)input[42] << 24);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 344 to 351
	value = ((uint32_t)input[43] << 24);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 352 to 359
	value = ((uint32_t)input[44] << 24);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 360 to 367
	value = ((uint32_t)input[45] << 24);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 368 to 375
	value = ((uint32_t)input[46] << 24);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 376 to 383
	value = ((uint32_t)input[47] << 24);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 384 to 391
	value = ((uint32_t)input[48] << 24);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 392 to 399
	value = ((uint32_t)input[49] << 24);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 400 to 407
	value = ((uint32_t)input[50] << 24);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 408 to 415
	value = ((uint32_t)input[51] << 24);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 416 to 423
	value = ((uint32_t)input[52] << 24);
	output[52] = (double)(value >> 24);
}

static void unpack_53_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 53 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 424 bits of data.
	// Input must be at least 54 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 329 to 336
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)(input[42] & 0x80) << 17);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 337 to 344
	value = ((uint32_t)(input[42] & 0x7f) << 25) |
			((uint32_t)(input[43] & 0x80) << 17);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 345 to 352
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)(input[44] & 0x80) << 17);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 353 to 360
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)(input[45] & 0x80) << 17);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 361 to 368
	value = ((uint32_t)(input[45] & 0x7f) << 25) |
			((uint32_t)(input[46] & 0x80) << 17);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 369 to 376
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)(input[47] & 0x80) << 17);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 377 to 384
	value = ((uint32_t)(input[47] & 0x7f) << 25) |
			((uint32_t)(input[48] & 0x80) << 17);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 385 to 392
	value = ((uint32_t)(input[48] & 0x7f) << 25) |
			((uint32_t)(input[49] & 0x80) << 17);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 393 to 400
	value = ((uint32_t)(input[49] & 0x7f) << 25) |
			((uint32_t)(input[50] & 0x80) << 17);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 401 to 408
	value = ((uint32_t)(input[50] & 0x7f) << 25) |
			((uint32_t)(input[51] & 0x80) << 17);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 409 to 416
	value = ((uint32_t)(input[51] & 0x7f) << 25) |
			((uint32_t)(input[52] & 0x80) << 17);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 417 to 424
	value = ((uint32_t)(input[52] & 0x7f) << 25) |
			((uint32_t)(input[53] & 0x80) << 17);
	output[52] = (double)(value >> 24);
}

static void unpack_53_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 53 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 424 bits of data.
	// Input must be at least 54 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 329 to 336
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)(input[42] & 0x80) << 17);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 337 to 344
	value = ((uint32_t)(input[42] & 0x7f) << 25) |
			((uint32_t)(input[43] & 0x80) << 17);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 345 to 352
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)(input[44] & 0x80) << 17);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 353 to 360
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)(input[45] & 0x80) << 17);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 361 to 368
	value = ((uint32_t)(input[45] & 0x7f) << 25) |
			((uint32_t)(input[46] & 0x80) << 17);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 369 to 376
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)(input[47] & 0x80) << 17);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 377 to 384
	value = ((uint32_t)(input[47] & 0x7f) << 25) |
			((uint32_t)(input[48] & 0x80) << 17);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 385 to 392
	value = ((uint32_t)(input[48] & 0x7f) << 25) |
			((uint32_t)(input[49] & 0x80) << 17);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 393 to 400
	value = ((uint32_t)(input[49] & 0x7f) << 25) |
			((uint32_t)(input[50] & 0x80) << 17);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 401 to 408
	value = ((uint32_t)(input[50] & 0x7f) << 25) |
			((uint32_t)(input[51] & 0x80) << 17);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 409 to 416
	value = ((uint32_t)(input[51] & 0x7f) << 25) |
			((uint32_t)(input[52] & 0x80) << 17);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 417 to 424
	value = ((uint32_t)(input[52] & 0x7f) << 25) |
			((uint32_t)(input[53] & 0x80) << 17);
	output[52] = (double)(value >> 24);
}

static void unpack_53_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 53 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 424 bits of data.
	// Input must be at least 54 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 330 to 337
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)(input[42] & 0xc0) << 18);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 338 to 345
	value = ((uint32_t)(input[42] & 0x3f) << 26) |
			((uint32_t)(input[43] & 0xc0) << 18);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 346 to 353
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)(input[44] & 0xc0) << 18);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 354 to 361
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)(input[45] & 0xc0) << 18);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 362 to 369
	value = ((uint32_t)(input[45] & 0x3f) << 26) |
			((uint32_t)(input[46] & 0xc0) << 18);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 370 to 377
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)(input[47] & 0xc0) << 18);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 378 to 385
	value = ((uint32_t)(input[47] & 0x3f) << 26) |
			((uint32_t)(input[48] & 0xc0) << 18);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 386 to 393
	value = ((uint32_t)(input[48] & 0x3f) << 26) |
			((uint32_t)(input[49] & 0xc0) << 18);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 394 to 401
	value = ((uint32_t)(input[49] & 0x3f) << 26) |
			((uint32_t)(input[50] & 0xc0) << 18);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 402 to 409
	value = ((uint32_t)(input[50] & 0x3f) << 26) |
			((uint32_t)(input[51] & 0xc0) << 18);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 410 to 417
	value = ((uint32_t)(input[51] & 0x3f) << 26) |
			((uint32_t)(input[52] & 0xc0) << 18);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 418 to 425
	value = ((uint32_t)(input[52] & 0x3f) << 26) |
			((uint32_t)(input[53] & 0xc0) << 18);
	output[52] = (double)(value >> 24);
}

static void unpack_53_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 53 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 424 bits of data.
	// Input must be at least 54 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 330 to 337
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)(input[42] & 0xc0) << 18);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 338 to 345
	value = ((uint32_t)(input[42] & 0x3f) << 26) |
			((uint32_t)(input[43] & 0xc0) << 18);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 346 to 353
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)(input[44] & 0xc0) << 18);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 354 to 361
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)(input[45] & 0xc0) << 18);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 362 to 369
	value = ((uint32_t)(input[45] & 0x3f) << 26) |
			((uint32_t)(input[46] & 0xc0) << 18);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 370 to 377
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)(input[47] & 0xc0) << 18);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 378 to 385
	value = ((uint32_t)(input[47] & 0x3f) << 26) |
			((uint32_t)(input[48] & 0xc0) << 18);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 386 to 393
	value = ((uint32_t)(input[48] & 0x3f) << 26) |
			((uint32_t)(input[49] & 0xc0) << 18);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 394 to 401
	value = ((uint32_t)(input[49] & 0x3f) << 26) |
			((uint32_t)(input[50] & 0xc0) << 18);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 402 to 409
	value = ((uint32_t)(input[50] & 0x3f) << 26) |
			((uint32_t)(input[51] & 0xc0) << 18);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 410 to 417
	value = ((uint32_t)(input[51] & 0x3f) << 26) |
			((uint32_t)(input[52] & 0xc0) << 18);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 418 to 425
	value = ((uint32_t)(input[52] & 0x3f) << 26) |
			((uint32_t)(input[53] & 0xc0) << 18);
	output[52] = (double)(value >> 24);
}

static void unpack_53_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 53 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 424 bits of data.
	// Input must be at least 54 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 331 to 338
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)(input[42] & 0xe0) << 19);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 339 to 346
	value = ((uint32_t)(input[42] & 0x1f) << 27) |
			((uint32_t)(input[43] & 0xe0) << 19);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 347 to 354
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)(input[44] & 0xe0) << 19);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 355 to 362
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)(input[45] & 0xe0) << 19);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 363 to 370
	value = ((uint32_t)(input[45] & 0x1f) << 27) |
			((uint32_t)(input[46] & 0xe0) << 19);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 371 to 378
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)(input[47] & 0xe0) << 19);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 379 to 386
	value = ((uint32_t)(input[47] & 0x1f) << 27) |
			((uint32_t)(input[48] & 0xe0) << 19);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 387 to 394
	value = ((uint32_t)(input[48] & 0x1f) << 27) |
			((uint32_t)(input[49] & 0xe0) << 19);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 395 to 402
	value = ((uint32_t)(input[49] & 0x1f) << 27) |
			((uint32_t)(input[50] & 0xe0) << 19);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 403 to 410
	value = ((uint32_t)(input[50] & 0x1f) << 27) |
			((uint32_t)(input[51] & 0xe0) << 19);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 411 to 418
	value = ((uint32_t)(input[51] & 0x1f) << 27) |
			((uint32_t)(input[52] & 0xe0) << 19);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 419 to 426
	value = ((uint32_t)(input[52] & 0x1f) << 27) |
			((uint32_t)(input[53] & 0xe0) << 19);
	output[52] = (double)(value >> 24);
}

static void unpack_53_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 53 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 424 bits of data.
	// Input must be at least 54 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 331 to 338
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)(input[42] & 0xe0) << 19);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 339 to 346
	value = ((uint32_t)(input[42] & 0x1f) << 27) |
			((uint32_t)(input[43] & 0xe0) << 19);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 347 to 354
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)(input[44] & 0xe0) << 19);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 355 to 362
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)(input[45] & 0xe0) << 19);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 363 to 370
	value = ((uint32_t)(input[45] & 0x1f) << 27) |
			((uint32_t)(input[46] & 0xe0) << 19);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 371 to 378
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)(input[47] & 0xe0) << 19);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 379 to 386
	value = ((uint32_t)(input[47] & 0x1f) << 27) |
			((uint32_t)(input[48] & 0xe0) << 19);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 387 to 394
	value = ((uint32_t)(input[48] & 0x1f) << 27) |
			((uint32_t)(input[49] & 0xe0) << 19);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 395 to 402
	value = ((uint32_t)(input[49] & 0x1f) << 27) |
			((uint32_t)(input[50] & 0xe0) << 19);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 403 to 410
	value = ((uint32_t)(input[50] & 0x1f) << 27) |
			((uint32_t)(input[51] & 0xe0) << 19);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 411 to 418
	value = ((uint32_t)(input[51] & 0x1f) << 27) |
			((uint32_t)(input[52] & 0xe0) << 19);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 419 to 426
	value = ((uint32_t)(input[52] & 0x1f) << 27) |
			((uint32_t)(input[53] & 0xe0) << 19);
	output[52] = (double)(value >> 24);
}

static void unpack_53_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 53 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 424 bits of data.
	// Input must be at least 54 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 332 to 339
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)(input[42] & 0xf0) << 20);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 340 to 347
	value = ((uint32_t)(input[42] & 0x0f) << 28) |
			((uint32_t)(input[43] & 0xf0) << 20);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 348 to 355
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)(input[44] & 0xf0) << 20);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 356 to 363
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)(input[45] & 0xf0) << 20);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 364 to 371
	value = ((uint32_t)(input[45] & 0x0f) << 28) |
			((uint32_t)(input[46] & 0xf0) << 20);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 372 to 379
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)(input[47] & 0xf0) << 20);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 380 to 387
	value = ((uint32_t)(input[47] & 0x0f) << 28) |
			((uint32_t)(input[48] & 0xf0) << 20);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 388 to 395
	value = ((uint32_t)(input[48] & 0x0f) << 28) |
			((uint32_t)(input[49] & 0xf0) << 20);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 396 to 403
	value = ((uint32_t)(input[49] & 0x0f) << 28) |
			((uint32_t)(input[50] & 0xf0) << 20);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 404 to 411
	value = ((uint32_t)(input[50] & 0x0f) << 28) |
			((uint32_t)(input[51] & 0xf0) << 20);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 412 to 419
	value = ((uint32_t)(input[51] & 0x0f) << 28) |
			((uint32_t)(input[52] & 0xf0) << 20);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 420 to 427
	value = ((uint32_t)(input[52] & 0x0f) << 28) |
			((uint32_t)(input[53] & 0xf0) << 20);
	output[52] = (double)(value >> 24);
}

static void unpack_53_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 53 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 424 bits of data.
	// Input must be at least 54 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 332 to 339
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)(input[42] & 0xf0) << 20);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 340 to 347
	value = ((uint32_t)(input[42] & 0x0f) << 28) |
			((uint32_t)(input[43] & 0xf0) << 20);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 348 to 355
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)(input[44] & 0xf0) << 20);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 356 to 363
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)(input[45] & 0xf0) << 20);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 364 to 371
	value = ((uint32_t)(input[45] & 0x0f) << 28) |
			((uint32_t)(input[46] & 0xf0) << 20);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 372 to 379
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)(input[47] & 0xf0) << 20);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 380 to 387
	value = ((uint32_t)(input[47] & 0x0f) << 28) |
			((uint32_t)(input[48] & 0xf0) << 20);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 388 to 395
	value = ((uint32_t)(input[48] & 0x0f) << 28) |
			((uint32_t)(input[49] & 0xf0) << 20);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 396 to 403
	value = ((uint32_t)(input[49] & 0x0f) << 28) |
			((uint32_t)(input[50] & 0xf0) << 20);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 404 to 411
	value = ((uint32_t)(input[50] & 0x0f) << 28) |
			((uint32_t)(input[51] & 0xf0) << 20);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 412 to 419
	value = ((uint32_t)(input[51] & 0x0f) << 28) |
			((uint32_t)(input[52] & 0xf0) << 20);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 420 to 427
	value = ((uint32_t)(input[52] & 0x0f) << 28) |
			((uint32_t)(input[53] & 0xf0) << 20);
	output[52] = (double)(value >> 24);
}

static void unpack_53_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 53 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 424 bits of data.
	// Input must be at least 54 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 333 to 340
	value = ((uint32_t)(input[41] & 0x07) << 29) |
			((uint32_t)(input[42] & 0xf8) << 21);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 341 to 348
	value = ((uint32_t)(input[42] & 0x07) << 29) |
			((uint32_t)(input[43] & 0xf8) << 21);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 349 to 356
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)(input[44] & 0xf8) << 21);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 357 to 364
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)(input[45] & 0xf8) << 21);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 365 to 372
	value = ((uint32_t)(input[45] & 0x07) << 29) |
			((uint32_t)(input[46] & 0xf8) << 21);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 373 to 380
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)(input[47] & 0xf8) << 21);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 381 to 388
	value = ((uint32_t)(input[47] & 0x07) << 29) |
			((uint32_t)(input[48] & 0xf8) << 21);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 389 to 396
	value = ((uint32_t)(input[48] & 0x07) << 29) |
			((uint32_t)(input[49] & 0xf8) << 21);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 397 to 404
	value = ((uint32_t)(input[49] & 0x07) << 29) |
			((uint32_t)(input[50] & 0xf8) << 21);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 405 to 412
	value = ((uint32_t)(input[50] & 0x07) << 29) |
			((uint32_t)(input[51] & 0xf8) << 21);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 413 to 420
	value = ((uint32_t)(input[51] & 0x07) << 29) |
			((uint32_t)(input[52] & 0xf8) << 21);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 421 to 428
	value = ((uint32_t)(input[52] & 0x07) << 29) |
			((uint32_t)(input[53] & 0xf8) << 21);
	output[52] = (double)(value >> 24);
}

static void unpack_53_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 53 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 424 bits of data.
	// Input must be at least 54 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 333 to 340
	value = ((uint32_t)(input[41] & 0x07) << 29) |
			((uint32_t)(input[42] & 0xf8) << 21);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 341 to 348
	value = ((uint32_t)(input[42] & 0x07) << 29) |
			((uint32_t)(input[43] & 0xf8) << 21);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 349 to 356
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)(input[44] & 0xf8) << 21);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 357 to 364
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)(input[45] & 0xf8) << 21);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 365 to 372
	value = ((uint32_t)(input[45] & 0x07) << 29) |
			((uint32_t)(input[46] & 0xf8) << 21);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 373 to 380
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)(input[47] & 0xf8) << 21);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 381 to 388
	value = ((uint32_t)(input[47] & 0x07) << 29) |
			((uint32_t)(input[48] & 0xf8) << 21);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 389 to 396
	value = ((uint32_t)(input[48] & 0x07) << 29) |
			((uint32_t)(input[49] & 0xf8) << 21);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 397 to 404
	value = ((uint32_t)(input[49] & 0x07) << 29) |
			((uint32_t)(input[50] & 0xf8) << 21);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 405 to 412
	value = ((uint32_t)(input[50] & 0x07) << 29) |
			((uint32_t)(input[51] & 0xf8) << 21);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 413 to 420
	value = ((uint32_t)(input[51] & 0x07) << 29) |
			((uint32_t)(input[52] & 0xf8) << 21);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 421 to 428
	value = ((uint32_t)(input[52] & 0x07) << 29) |
			((uint32_t)(input[53] & 0xf8) << 21);
	output[52] = (double)(value >> 24);
}

static void unpack_53_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 53 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 424 bits of data.
	// Input must be at least 54 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 334 to 341
	value = ((uint32_t)(input[41] & 0x03) << 30) |
			((uint32_t)(input[42] & 0xfc) << 22);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 342 to 349
	value = ((uint32_t)(input[42] & 0x03) << 30) |
			((uint32_t)(input[43] & 0xfc) << 22);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 350 to 357
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)(input[44] & 0xfc) << 22);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 358 to 365
	value = ((uint32_t)(input[44] & 0x03) << 30) |
			((uint32_t)(input[45] & 0xfc) << 22);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 366 to 373
	value = ((uint32_t)(input[45] & 0x03) << 30) |
			((uint32_t)(input[46] & 0xfc) << 22);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 374 to 381
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)(input[47] & 0xfc) << 22);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 382 to 389
	value = ((uint32_t)(input[47] & 0x03) << 30) |
			((uint32_t)(input[48] & 0xfc) << 22);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 390 to 397
	value = ((uint32_t)(input[48] & 0x03) << 30) |
			((uint32_t)(input[49] & 0xfc) << 22);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 398 to 405
	value = ((uint32_t)(input[49] & 0x03) << 30) |
			((uint32_t)(input[50] & 0xfc) << 22);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 406 to 413
	value = ((uint32_t)(input[50] & 0x03) << 30) |
			((uint32_t)(input[51] & 0xfc) << 22);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 414 to 421
	value = ((uint32_t)(input[51] & 0x03) << 30) |
			((uint32_t)(input[52] & 0xfc) << 22);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 422 to 429
	value = ((uint32_t)(input[52] & 0x03) << 30) |
			((uint32_t)(input[53] & 0xfc) << 22);
	output[52] = (double)(value >> 24);
}

static void unpack_53_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 53 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 424 bits of data.
	// Input must be at least 54 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 334 to 341
	value = ((uint32_t)(input[41] & 0x03) << 30) |
			((uint32_t)(input[42] & 0xfc) << 22);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 342 to 349
	value = ((uint32_t)(input[42] & 0x03) << 30) |
			((uint32_t)(input[43] & 0xfc) << 22);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 350 to 357
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)(input[44] & 0xfc) << 22);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 358 to 365
	value = ((uint32_t)(input[44] & 0x03) << 30) |
			((uint32_t)(input[45] & 0xfc) << 22);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 366 to 373
	value = ((uint32_t)(input[45] & 0x03) << 30) |
			((uint32_t)(input[46] & 0xfc) << 22);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 374 to 381
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)(input[47] & 0xfc) << 22);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 382 to 389
	value = ((uint32_t)(input[47] & 0x03) << 30) |
			((uint32_t)(input[48] & 0xfc) << 22);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 390 to 397
	value = ((uint32_t)(input[48] & 0x03) << 30) |
			((uint32_t)(input[49] & 0xfc) << 22);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 398 to 405
	value = ((uint32_t)(input[49] & 0x03) << 30) |
			((uint32_t)(input[50] & 0xfc) << 22);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 406 to 413
	value = ((uint32_t)(input[50] & 0x03) << 30) |
			((uint32_t)(input[51] & 0xfc) << 22);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 414 to 421
	value = ((uint32_t)(input[51] & 0x03) << 30) |
			((uint32_t)(input[52] & 0xfc) << 22);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 422 to 429
	value = ((uint32_t)(input[52] & 0x03) << 30) |
			((uint32_t)(input[53] & 0xfc) << 22);
	output[52] = (double)(value >> 24);
}

static void unpack_53_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 53 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 424 bits of data.
	// Input must be at least 54 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 335 to 342
	value = ((uint32_t)(input[41] & 0x01) << 31) |
			((uint32_t)(input[42] & 0xfe) << 23);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 343 to 350
	value = ((uint32_t)(input[42] & 0x01) << 31) |
			((uint32_t)(input[43] & 0xfe) << 23);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 351 to 358
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)(input[44] & 0xfe) << 23);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 359 to 366
	value = ((uint32_t)(input[44] & 0x01) << 31) |
			((uint32_t)(input[45] & 0xfe) << 23);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 367 to 374
	value = ((uint32_t)(input[45] & 0x01) << 31) |
			((uint32_t)(input[46] & 0xfe) << 23);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 375 to 382
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)(input[47] & 0xfe) << 23);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 383 to 390
	value = ((uint32_t)(input[47] & 0x01) << 31) |
			((uint32_t)(input[48] & 0xfe) << 23);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 391 to 398
	value = ((uint32_t)(input[48] & 0x01) << 31) |
			((uint32_t)(input[49] & 0xfe) << 23);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 399 to 406
	value = ((uint32_t)(input[49] & 0x01) << 31) |
			((uint32_t)(input[50] & 0xfe) << 23);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 407 to 414
	value = ((uint32_t)(input[50] & 0x01) << 31) |
			((uint32_t)(input[51] & 0xfe) << 23);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 415 to 422
	value = ((uint32_t)(input[51] & 0x01) << 31) |
			((uint32_t)(input[52] & 0xfe) << 23);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 423 to 430
	value = ((uint32_t)(input[52] & 0x01) << 31) |
			((uint32_t)(input[53] & 0xfe) << 23);
	output[52] = (double)(value >> 24);
}

static void unpack_53_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 53 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 424 bits of data.
	// Input must be at least 54 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 335 to 342
	value = ((uint32_t)(input[41] & 0x01) << 31) |
			((uint32_t)(input[42] & 0xfe) << 23);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 343 to 350
	value = ((uint32_t)(input[42] & 0x01) << 31) |
			((uint32_t)(input[43] & 0xfe) << 23);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 351 to 358
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)(input[44] & 0xfe) << 23);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 359 to 366
	value = ((uint32_t)(input[44] & 0x01) << 31) |
			((uint32_t)(input[45] & 0xfe) << 23);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 367 to 374
	value = ((uint32_t)(input[45] & 0x01) << 31) |
			((uint32_t)(input[46] & 0xfe) << 23);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 375 to 382
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)(input[47] & 0xfe) << 23);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 383 to 390
	value = ((uint32_t)(input[47] & 0x01) << 31) |
			((uint32_t)(input[48] & 0xfe) << 23);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 391 to 398
	value = ((uint32_t)(input[48] & 0x01) << 31) |
			((uint32_t)(input[49] & 0xfe) << 23);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 399 to 406
	value = ((uint32_t)(input[49] & 0x01) << 31) |
			((uint32_t)(input[50] & 0xfe) << 23);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 407 to 414
	value = ((uint32_t)(input[50] & 0x01) << 31) |
			((uint32_t)(input[51] & 0xfe) << 23);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 415 to 422
	value = ((uint32_t)(input[51] & 0x01) << 31) |
			((uint32_t)(input[52] & 0xfe) << 23);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 423 to 430
	value = ((uint32_t)(input[52] & 0x01) << 31) |
			((uint32_t)(input[53] & 0xfe) << 23);
	output[52] = (double)(value >> 24);
}

static void unpack_54_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 54 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 432 bits of data.
	// Input must be at least 54 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 328 to 335
	value = ((uint32_t)input[41] << 24);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 336 to 343
	value = ((uint32_t)input[42] << 24);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 344 to 351
	value = ((uint32_t)input[43] << 24);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 352 to 359
	value = ((uint32_t)input[44] << 24);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 360 to 367
	value = ((uint32_t)input[45] << 24);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 368 to 375
	value = ((uint32_t)input[46] << 24);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 376 to 383
	value = ((uint32_t)input[47] << 24);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 384 to 391
	value = ((uint32_t)input[48] << 24);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 392 to 399
	value = ((uint32_t)input[49] << 24);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 400 to 407
	value = ((uint32_t)input[50] << 24);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 408 to 415
	value = ((uint32_t)input[51] << 24);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 416 to 423
	value = ((uint32_t)input[52] << 24);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 424 to 431
	value = ((uint32_t)input[53] << 24);
	output[53] = (double)(value >> 24);
}

static void unpack_54_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 54 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 432 bits of data.
	// Input must be at least 54 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 328 to 335
	value = ((uint32_t)input[41] << 24);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 336 to 343
	value = ((uint32_t)input[42] << 24);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 344 to 351
	value = ((uint32_t)input[43] << 24);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 352 to 359
	value = ((uint32_t)input[44] << 24);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 360 to 367
	value = ((uint32_t)input[45] << 24);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 368 to 375
	value = ((uint32_t)input[46] << 24);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 376 to 383
	value = ((uint32_t)input[47] << 24);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 384 to 391
	value = ((uint32_t)input[48] << 24);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 392 to 399
	value = ((uint32_t)input[49] << 24);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 400 to 407
	value = ((uint32_t)input[50] << 24);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 408 to 415
	value = ((uint32_t)input[51] << 24);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 416 to 423
	value = ((uint32_t)input[52] << 24);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 424 to 431
	value = ((uint32_t)input[53] << 24);
	output[53] = (double)(value >> 24);
}

static void unpack_54_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 54 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 432 bits of data.
	// Input must be at least 55 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 329 to 336
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)(input[42] & 0x80) << 17);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 337 to 344
	value = ((uint32_t)(input[42] & 0x7f) << 25) |
			((uint32_t)(input[43] & 0x80) << 17);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 345 to 352
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)(input[44] & 0x80) << 17);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 353 to 360
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)(input[45] & 0x80) << 17);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 361 to 368
	value = ((uint32_t)(input[45] & 0x7f) << 25) |
			((uint32_t)(input[46] & 0x80) << 17);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 369 to 376
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)(input[47] & 0x80) << 17);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 377 to 384
	value = ((uint32_t)(input[47] & 0x7f) << 25) |
			((uint32_t)(input[48] & 0x80) << 17);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 385 to 392
	value = ((uint32_t)(input[48] & 0x7f) << 25) |
			((uint32_t)(input[49] & 0x80) << 17);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 393 to 400
	value = ((uint32_t)(input[49] & 0x7f) << 25) |
			((uint32_t)(input[50] & 0x80) << 17);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 401 to 408
	value = ((uint32_t)(input[50] & 0x7f) << 25) |
			((uint32_t)(input[51] & 0x80) << 17);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 409 to 416
	value = ((uint32_t)(input[51] & 0x7f) << 25) |
			((uint32_t)(input[52] & 0x80) << 17);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 417 to 424
	value = ((uint32_t)(input[52] & 0x7f) << 25) |
			((uint32_t)(input[53] & 0x80) << 17);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 425 to 432
	value = ((uint32_t)(input[53] & 0x7f) << 25) |
			((uint32_t)(input[54] & 0x80) << 17);
	output[53] = (double)(value >> 24);
}

static void unpack_54_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 54 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 432 bits of data.
	// Input must be at least 55 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 329 to 336
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)(input[42] & 0x80) << 17);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 337 to 344
	value = ((uint32_t)(input[42] & 0x7f) << 25) |
			((uint32_t)(input[43] & 0x80) << 17);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 345 to 352
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)(input[44] & 0x80) << 17);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 353 to 360
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)(input[45] & 0x80) << 17);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 361 to 368
	value = ((uint32_t)(input[45] & 0x7f) << 25) |
			((uint32_t)(input[46] & 0x80) << 17);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 369 to 376
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)(input[47] & 0x80) << 17);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 377 to 384
	value = ((uint32_t)(input[47] & 0x7f) << 25) |
			((uint32_t)(input[48] & 0x80) << 17);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 385 to 392
	value = ((uint32_t)(input[48] & 0x7f) << 25) |
			((uint32_t)(input[49] & 0x80) << 17);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 393 to 400
	value = ((uint32_t)(input[49] & 0x7f) << 25) |
			((uint32_t)(input[50] & 0x80) << 17);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 401 to 408
	value = ((uint32_t)(input[50] & 0x7f) << 25) |
			((uint32_t)(input[51] & 0x80) << 17);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 409 to 416
	value = ((uint32_t)(input[51] & 0x7f) << 25) |
			((uint32_t)(input[52] & 0x80) << 17);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 417 to 424
	value = ((uint32_t)(input[52] & 0x7f) << 25) |
			((uint32_t)(input[53] & 0x80) << 17);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 425 to 432
	value = ((uint32_t)(input[53] & 0x7f) << 25) |
			((uint32_t)(input[54] & 0x80) << 17);
	output[53] = (double)(value >> 24);
}

static void unpack_54_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 54 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 432 bits of data.
	// Input must be at least 55 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 330 to 337
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)(input[42] & 0xc0) << 18);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 338 to 345
	value = ((uint32_t)(input[42] & 0x3f) << 26) |
			((uint32_t)(input[43] & 0xc0) << 18);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 346 to 353
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)(input[44] & 0xc0) << 18);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 354 to 361
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)(input[45] & 0xc0) << 18);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 362 to 369
	value = ((uint32_t)(input[45] & 0x3f) << 26) |
			((uint32_t)(input[46] & 0xc0) << 18);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 370 to 377
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)(input[47] & 0xc0) << 18);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 378 to 385
	value = ((uint32_t)(input[47] & 0x3f) << 26) |
			((uint32_t)(input[48] & 0xc0) << 18);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 386 to 393
	value = ((uint32_t)(input[48] & 0x3f) << 26) |
			((uint32_t)(input[49] & 0xc0) << 18);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 394 to 401
	value = ((uint32_t)(input[49] & 0x3f) << 26) |
			((uint32_t)(input[50] & 0xc0) << 18);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 402 to 409
	value = ((uint32_t)(input[50] & 0x3f) << 26) |
			((uint32_t)(input[51] & 0xc0) << 18);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 410 to 417
	value = ((uint32_t)(input[51] & 0x3f) << 26) |
			((uint32_t)(input[52] & 0xc0) << 18);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 418 to 425
	value = ((uint32_t)(input[52] & 0x3f) << 26) |
			((uint32_t)(input[53] & 0xc0) << 18);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 426 to 433
	value = ((uint32_t)(input[53] & 0x3f) << 26) |
			((uint32_t)(input[54] & 0xc0) << 18);
	output[53] = (double)(value >> 24);
}

static void unpack_54_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 54 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 432 bits of data.
	// Input must be at least 55 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 330 to 337
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)(input[42] & 0xc0) << 18);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 338 to 345
	value = ((uint32_t)(input[42] & 0x3f) << 26) |
			((uint32_t)(input[43] & 0xc0) << 18);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 346 to 353
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)(input[44] & 0xc0) << 18);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 354 to 361
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)(input[45] & 0xc0) << 18);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 362 to 369
	value = ((uint32_t)(input[45] & 0x3f) << 26) |
			((uint32_t)(input[46] & 0xc0) << 18);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 370 to 377
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)(input[47] & 0xc0) << 18);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 378 to 385
	value = ((uint32_t)(input[47] & 0x3f) << 26) |
			((uint32_t)(input[48] & 0xc0) << 18);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 386 to 393
	value = ((uint32_t)(input[48] & 0x3f) << 26) |
			((uint32_t)(input[49] & 0xc0) << 18);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 394 to 401
	value = ((uint32_t)(input[49] & 0x3f) << 26) |
			((uint32_t)(input[50] & 0xc0) << 18);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 402 to 409
	value = ((uint32_t)(input[50] & 0x3f) << 26) |
			((uint32_t)(input[51] & 0xc0) << 18);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 410 to 417
	value = ((uint32_t)(input[51] & 0x3f) << 26) |
			((uint32_t)(input[52] & 0xc0) << 18);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 418 to 425
	value = ((uint32_t)(input[52] & 0x3f) << 26) |
			((uint32_t)(input[53] & 0xc0) << 18);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 426 to 433
	value = ((uint32_t)(input[53] & 0x3f) << 26) |
			((uint32_t)(input[54] & 0xc0) << 18);
	output[53] = (double)(value >> 24);
}

static void unpack_54_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 54 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 432 bits of data.
	// Input must be at least 55 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 331 to 338
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)(input[42] & 0xe0) << 19);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 339 to 346
	value = ((uint32_t)(input[42] & 0x1f) << 27) |
			((uint32_t)(input[43] & 0xe0) << 19);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 347 to 354
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)(input[44] & 0xe0) << 19);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 355 to 362
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)(input[45] & 0xe0) << 19);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 363 to 370
	value = ((uint32_t)(input[45] & 0x1f) << 27) |
			((uint32_t)(input[46] & 0xe0) << 19);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 371 to 378
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)(input[47] & 0xe0) << 19);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 379 to 386
	value = ((uint32_t)(input[47] & 0x1f) << 27) |
			((uint32_t)(input[48] & 0xe0) << 19);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 387 to 394
	value = ((uint32_t)(input[48] & 0x1f) << 27) |
			((uint32_t)(input[49] & 0xe0) << 19);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 395 to 402
	value = ((uint32_t)(input[49] & 0x1f) << 27) |
			((uint32_t)(input[50] & 0xe0) << 19);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 403 to 410
	value = ((uint32_t)(input[50] & 0x1f) << 27) |
			((uint32_t)(input[51] & 0xe0) << 19);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 411 to 418
	value = ((uint32_t)(input[51] & 0x1f) << 27) |
			((uint32_t)(input[52] & 0xe0) << 19);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 419 to 426
	value = ((uint32_t)(input[52] & 0x1f) << 27) |
			((uint32_t)(input[53] & 0xe0) << 19);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 427 to 434
	value = ((uint32_t)(input[53] & 0x1f) << 27) |
			((uint32_t)(input[54] & 0xe0) << 19);
	output[53] = (double)(value >> 24);
}

static void unpack_54_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 54 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 432 bits of data.
	// Input must be at least 55 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 331 to 338
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)(input[42] & 0xe0) << 19);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 339 to 346
	value = ((uint32_t)(input[42] & 0x1f) << 27) |
			((uint32_t)(input[43] & 0xe0) << 19);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 347 to 354
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)(input[44] & 0xe0) << 19);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 355 to 362
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)(input[45] & 0xe0) << 19);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 363 to 370
	value = ((uint32_t)(input[45] & 0x1f) << 27) |
			((uint32_t)(input[46] & 0xe0) << 19);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 371 to 378
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)(input[47] & 0xe0) << 19);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 379 to 386
	value = ((uint32_t)(input[47] & 0x1f) << 27) |
			((uint32_t)(input[48] & 0xe0) << 19);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 387 to 394
	value = ((uint32_t)(input[48] & 0x1f) << 27) |
			((uint32_t)(input[49] & 0xe0) << 19);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 395 to 402
	value = ((uint32_t)(input[49] & 0x1f) << 27) |
			((uint32_t)(input[50] & 0xe0) << 19);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 403 to 410
	value = ((uint32_t)(input[50] & 0x1f) << 27) |
			((uint32_t)(input[51] & 0xe0) << 19);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 411 to 418
	value = ((uint32_t)(input[51] & 0x1f) << 27) |
			((uint32_t)(input[52] & 0xe0) << 19);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 419 to 426
	value = ((uint32_t)(input[52] & 0x1f) << 27) |
			((uint32_t)(input[53] & 0xe0) << 19);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 427 to 434
	value = ((uint32_t)(input[53] & 0x1f) << 27) |
			((uint32_t)(input[54] & 0xe0) << 19);
	output[53] = (double)(value >> 24);
}

static void unpack_54_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 54 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 432 bits of data.
	// Input must be at least 55 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 332 to 339
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)(input[42] & 0xf0) << 20);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 340 to 347
	value = ((uint32_t)(input[42] & 0x0f) << 28) |
			((uint32_t)(input[43] & 0xf0) << 20);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 348 to 355
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)(input[44] & 0xf0) << 20);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 356 to 363
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)(input[45] & 0xf0) << 20);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 364 to 371
	value = ((uint32_t)(input[45] & 0x0f) << 28) |
			((uint32_t)(input[46] & 0xf0) << 20);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 372 to 379
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)(input[47] & 0xf0) << 20);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 380 to 387
	value = ((uint32_t)(input[47] & 0x0f) << 28) |
			((uint32_t)(input[48] & 0xf0) << 20);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 388 to 395
	value = ((uint32_t)(input[48] & 0x0f) << 28) |
			((uint32_t)(input[49] & 0xf0) << 20);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 396 to 403
	value = ((uint32_t)(input[49] & 0x0f) << 28) |
			((uint32_t)(input[50] & 0xf0) << 20);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 404 to 411
	value = ((uint32_t)(input[50] & 0x0f) << 28) |
			((uint32_t)(input[51] & 0xf0) << 20);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 412 to 419
	value = ((uint32_t)(input[51] & 0x0f) << 28) |
			((uint32_t)(input[52] & 0xf0) << 20);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 420 to 427
	value = ((uint32_t)(input[52] & 0x0f) << 28) |
			((uint32_t)(input[53] & 0xf0) << 20);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 428 to 435
	value = ((uint32_t)(input[53] & 0x0f) << 28) |
			((uint32_t)(input[54] & 0xf0) << 20);
	output[53] = (double)(value >> 24);
}

static void unpack_54_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 54 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 432 bits of data.
	// Input must be at least 55 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 332 to 339
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)(input[42] & 0xf0) << 20);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 340 to 347
	value = ((uint32_t)(input[42] & 0x0f) << 28) |
			((uint32_t)(input[43] & 0xf0) << 20);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 348 to 355
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)(input[44] & 0xf0) << 20);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 356 to 363
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)(input[45] & 0xf0) << 20);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 364 to 371
	value = ((uint32_t)(input[45] & 0x0f) << 28) |
			((uint32_t)(input[46] & 0xf0) << 20);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 372 to 379
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)(input[47] & 0xf0) << 20);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 380 to 387
	value = ((uint32_t)(input[47] & 0x0f) << 28) |
			((uint32_t)(input[48] & 0xf0) << 20);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 388 to 395
	value = ((uint32_t)(input[48] & 0x0f) << 28) |
			((uint32_t)(input[49] & 0xf0) << 20);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 396 to 403
	value = ((uint32_t)(input[49] & 0x0f) << 28) |
			((uint32_t)(input[50] & 0xf0) << 20);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 404 to 411
	value = ((uint32_t)(input[50] & 0x0f) << 28) |
			((uint32_t)(input[51] & 0xf0) << 20);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 412 to 419
	value = ((uint32_t)(input[51] & 0x0f) << 28) |
			((uint32_t)(input[52] & 0xf0) << 20);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 420 to 427
	value = ((uint32_t)(input[52] & 0x0f) << 28) |
			((uint32_t)(input[53] & 0xf0) << 20);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 428 to 435
	value = ((uint32_t)(input[53] & 0x0f) << 28) |
			((uint32_t)(input[54] & 0xf0) << 20);
	output[53] = (double)(value >> 24);
}

static void unpack_54_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 54 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 432 bits of data.
	// Input must be at least 55 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 333 to 340
	value = ((uint32_t)(input[41] & 0x07) << 29) |
			((uint32_t)(input[42] & 0xf8) << 21);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 341 to 348
	value = ((uint32_t)(input[42] & 0x07) << 29) |
			((uint32_t)(input[43] & 0xf8) << 21);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 349 to 356
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)(input[44] & 0xf8) << 21);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 357 to 364
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)(input[45] & 0xf8) << 21);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 365 to 372
	value = ((uint32_t)(input[45] & 0x07) << 29) |
			((uint32_t)(input[46] & 0xf8) << 21);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 373 to 380
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)(input[47] & 0xf8) << 21);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 381 to 388
	value = ((uint32_t)(input[47] & 0x07) << 29) |
			((uint32_t)(input[48] & 0xf8) << 21);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 389 to 396
	value = ((uint32_t)(input[48] & 0x07) << 29) |
			((uint32_t)(input[49] & 0xf8) << 21);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 397 to 404
	value = ((uint32_t)(input[49] & 0x07) << 29) |
			((uint32_t)(input[50] & 0xf8) << 21);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 405 to 412
	value = ((uint32_t)(input[50] & 0x07) << 29) |
			((uint32_t)(input[51] & 0xf8) << 21);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 413 to 420
	value = ((uint32_t)(input[51] & 0x07) << 29) |
			((uint32_t)(input[52] & 0xf8) << 21);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 421 to 428
	value = ((uint32_t)(input[52] & 0x07) << 29) |
			((uint32_t)(input[53] & 0xf8) << 21);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 429 to 436
	value = ((uint32_t)(input[53] & 0x07) << 29) |
			((uint32_t)(input[54] & 0xf8) << 21);
	output[53] = (double)(value >> 24);
}

static void unpack_54_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 54 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 432 bits of data.
	// Input must be at least 55 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 333 to 340
	value = ((uint32_t)(input[41] & 0x07) << 29) |
			((uint32_t)(input[42] & 0xf8) << 21);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 341 to 348
	value = ((uint32_t)(input[42] & 0x07) << 29) |
			((uint32_t)(input[43] & 0xf8) << 21);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 349 to 356
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)(input[44] & 0xf8) << 21);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 357 to 364
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)(input[45] & 0xf8) << 21);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 365 to 372
	value = ((uint32_t)(input[45] & 0x07) << 29) |
			((uint32_t)(input[46] & 0xf8) << 21);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 373 to 380
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)(input[47] & 0xf8) << 21);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 381 to 388
	value = ((uint32_t)(input[47] & 0x07) << 29) |
			((uint32_t)(input[48] & 0xf8) << 21);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 389 to 396
	value = ((uint32_t)(input[48] & 0x07) << 29) |
			((uint32_t)(input[49] & 0xf8) << 21);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 397 to 404
	value = ((uint32_t)(input[49] & 0x07) << 29) |
			((uint32_t)(input[50] & 0xf8) << 21);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 405 to 412
	value = ((uint32_t)(input[50] & 0x07) << 29) |
			((uint32_t)(input[51] & 0xf8) << 21);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 413 to 420
	value = ((uint32_t)(input[51] & 0x07) << 29) |
			((uint32_t)(input[52] & 0xf8) << 21);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 421 to 428
	value = ((uint32_t)(input[52] & 0x07) << 29) |
			((uint32_t)(input[53] & 0xf8) << 21);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 429 to 436
	value = ((uint32_t)(input[53] & 0x07) << 29) |
			((uint32_t)(input[54] & 0xf8) << 21);
	output[53] = (double)(value >> 24);
}

static void unpack_54_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 54 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 432 bits of data.
	// Input must be at least 55 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 334 to 341
	value = ((uint32_t)(input[41] & 0x03) << 30) |
			((uint32_t)(input[42] & 0xfc) << 22);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 342 to 349
	value = ((uint32_t)(input[42] & 0x03) << 30) |
			((uint32_t)(input[43] & 0xfc) << 22);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 350 to 357
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)(input[44] & 0xfc) << 22);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 358 to 365
	value = ((uint32_t)(input[44] & 0x03) << 30) |
			((uint32_t)(input[45] & 0xfc) << 22);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 366 to 373
	value = ((uint32_t)(input[45] & 0x03) << 30) |
			((uint32_t)(input[46] & 0xfc) << 22);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 374 to 381
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)(input[47] & 0xfc) << 22);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 382 to 389
	value = ((uint32_t)(input[47] & 0x03) << 30) |
			((uint32_t)(input[48] & 0xfc) << 22);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 390 to 397
	value = ((uint32_t)(input[48] & 0x03) << 30) |
			((uint32_t)(input[49] & 0xfc) << 22);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 398 to 405
	value = ((uint32_t)(input[49] & 0x03) << 30) |
			((uint32_t)(input[50] & 0xfc) << 22);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 406 to 413
	value = ((uint32_t)(input[50] & 0x03) << 30) |
			((uint32_t)(input[51] & 0xfc) << 22);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 414 to 421
	value = ((uint32_t)(input[51] & 0x03) << 30) |
			((uint32_t)(input[52] & 0xfc) << 22);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 422 to 429
	value = ((uint32_t)(input[52] & 0x03) << 30) |
			((uint32_t)(input[53] & 0xfc) << 22);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 430 to 437
	value = ((uint32_t)(input[53] & 0x03) << 30) |
			((uint32_t)(input[54] & 0xfc) << 22);
	output[53] = (double)(value >> 24);
}

static void unpack_54_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 54 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 432 bits of data.
	// Input must be at least 55 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 334 to 341
	value = ((uint32_t)(input[41] & 0x03) << 30) |
			((uint32_t)(input[42] & 0xfc) << 22);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 342 to 349
	value = ((uint32_t)(input[42] & 0x03) << 30) |
			((uint32_t)(input[43] & 0xfc) << 22);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 350 to 357
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)(input[44] & 0xfc) << 22);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 358 to 365
	value = ((uint32_t)(input[44] & 0x03) << 30) |
			((uint32_t)(input[45] & 0xfc) << 22);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 366 to 373
	value = ((uint32_t)(input[45] & 0x03) << 30) |
			((uint32_t)(input[46] & 0xfc) << 22);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 374 to 381
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)(input[47] & 0xfc) << 22);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 382 to 389
	value = ((uint32_t)(input[47] & 0x03) << 30) |
			((uint32_t)(input[48] & 0xfc) << 22);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 390 to 397
	value = ((uint32_t)(input[48] & 0x03) << 30) |
			((uint32_t)(input[49] & 0xfc) << 22);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 398 to 405
	value = ((uint32_t)(input[49] & 0x03) << 30) |
			((uint32_t)(input[50] & 0xfc) << 22);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 406 to 413
	value = ((uint32_t)(input[50] & 0x03) << 30) |
			((uint32_t)(input[51] & 0xfc) << 22);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 414 to 421
	value = ((uint32_t)(input[51] & 0x03) << 30) |
			((uint32_t)(input[52] & 0xfc) << 22);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 422 to 429
	value = ((uint32_t)(input[52] & 0x03) << 30) |
			((uint32_t)(input[53] & 0xfc) << 22);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 430 to 437
	value = ((uint32_t)(input[53] & 0x03) << 30) |
			((uint32_t)(input[54] & 0xfc) << 22);
	output[53] = (double)(value >> 24);
}

static void unpack_54_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 54 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 432 bits of data.
	// Input must be at least 55 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 335 to 342
	value = ((uint32_t)(input[41] & 0x01) << 31) |
			((uint32_t)(input[42] & 0xfe) << 23);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 343 to 350
	value = ((uint32_t)(input[42] & 0x01) << 31) |
			((uint32_t)(input[43] & 0xfe) << 23);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 351 to 358
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)(input[44] & 0xfe) << 23);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 359 to 366
	value = ((uint32_t)(input[44] & 0x01) << 31) |
			((uint32_t)(input[45] & 0xfe) << 23);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 367 to 374
	value = ((uint32_t)(input[45] & 0x01) << 31) |
			((uint32_t)(input[46] & 0xfe) << 23);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 375 to 382
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)(input[47] & 0xfe) << 23);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 383 to 390
	value = ((uint32_t)(input[47] & 0x01) << 31) |
			((uint32_t)(input[48] & 0xfe) << 23);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 391 to 398
	value = ((uint32_t)(input[48] & 0x01) << 31) |
			((uint32_t)(input[49] & 0xfe) << 23);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 399 to 406
	value = ((uint32_t)(input[49] & 0x01) << 31) |
			((uint32_t)(input[50] & 0xfe) << 23);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 407 to 414
	value = ((uint32_t)(input[50] & 0x01) << 31) |
			((uint32_t)(input[51] & 0xfe) << 23);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 415 to 422
	value = ((uint32_t)(input[51] & 0x01) << 31) |
			((uint32_t)(input[52] & 0xfe) << 23);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 423 to 430
	value = ((uint32_t)(input[52] & 0x01) << 31) |
			((uint32_t)(input[53] & 0xfe) << 23);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 431 to 438
	value = ((uint32_t)(input[53] & 0x01) << 31) |
			((uint32_t)(input[54] & 0xfe) << 23);
	output[53] = (double)(value >> 24);
}

static void unpack_54_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 54 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 432 bits of data.
	// Input must be at least 55 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 335 to 342
	value = ((uint32_t)(input[41] & 0x01) << 31) |
			((uint32_t)(input[42] & 0xfe) << 23);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 343 to 350
	value = ((uint32_t)(input[42] & 0x01) << 31) |
			((uint32_t)(input[43] & 0xfe) << 23);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 351 to 358
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)(input[44] & 0xfe) << 23);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 359 to 366
	value = ((uint32_t)(input[44] & 0x01) << 31) |
			((uint32_t)(input[45] & 0xfe) << 23);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 367 to 374
	value = ((uint32_t)(input[45] & 0x01) << 31) |
			((uint32_t)(input[46] & 0xfe) << 23);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 375 to 382
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)(input[47] & 0xfe) << 23);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 383 to 390
	value = ((uint32_t)(input[47] & 0x01) << 31) |
			((uint32_t)(input[48] & 0xfe) << 23);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 391 to 398
	value = ((uint32_t)(input[48] & 0x01) << 31) |
			((uint32_t)(input[49] & 0xfe) << 23);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 399 to 406
	value = ((uint32_t)(input[49] & 0x01) << 31) |
			((uint32_t)(input[50] & 0xfe) << 23);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 407 to 414
	value = ((uint32_t)(input[50] & 0x01) << 31) |
			((uint32_t)(input[51] & 0xfe) << 23);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 415 to 422
	value = ((uint32_t)(input[51] & 0x01) << 31) |
			((uint32_t)(input[52] & 0xfe) << 23);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 423 to 430
	value = ((uint32_t)(input[52] & 0x01) << 31) |
			((uint32_t)(input[53] & 0xfe) << 23);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 431 to 438
	value = ((uint32_t)(input[53] & 0x01) << 31) |
			((uint32_t)(input[54] & 0xfe) << 23);
	output[53] = (double)(value >> 24);
}

static void unpack_55_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 55 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 440 bits of data.
	// Input must be at least 55 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 328 to 335
	value = ((uint32_t)input[41] << 24);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 336 to 343
	value = ((uint32_t)input[42] << 24);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 344 to 351
	value = ((uint32_t)input[43] << 24);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 352 to 359
	value = ((uint32_t)input[44] << 24);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 360 to 367
	value = ((uint32_t)input[45] << 24);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 368 to 375
	value = ((uint32_t)input[46] << 24);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 376 to 383
	value = ((uint32_t)input[47] << 24);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 384 to 391
	value = ((uint32_t)input[48] << 24);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 392 to 399
	value = ((uint32_t)input[49] << 24);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 400 to 407
	value = ((uint32_t)input[50] << 24);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 408 to 415
	value = ((uint32_t)input[51] << 24);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 416 to 423
	value = ((uint32_t)input[52] << 24);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 424 to 431
	value = ((uint32_t)input[53] << 24);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 432 to 439
	value = ((uint32_t)input[54] << 24);
	output[54] = (double)(value >> 24);
}

static void unpack_55_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 55 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 440 bits of data.
	// Input must be at least 55 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 328 to 335
	value = ((uint32_t)input[41] << 24);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 336 to 343
	value = ((uint32_t)input[42] << 24);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 344 to 351
	value = ((uint32_t)input[43] << 24);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 352 to 359
	value = ((uint32_t)input[44] << 24);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 360 to 367
	value = ((uint32_t)input[45] << 24);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 368 to 375
	value = ((uint32_t)input[46] << 24);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 376 to 383
	value = ((uint32_t)input[47] << 24);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 384 to 391
	value = ((uint32_t)input[48] << 24);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 392 to 399
	value = ((uint32_t)input[49] << 24);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 400 to 407
	value = ((uint32_t)input[50] << 24);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 408 to 415
	value = ((uint32_t)input[51] << 24);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 416 to 423
	value = ((uint32_t)input[52] << 24);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 424 to 431
	value = ((uint32_t)input[53] << 24);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 432 to 439
	value = ((uint32_t)input[54] << 24);
	output[54] = (double)(value >> 24);
}

static void unpack_55_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 55 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 440 bits of data.
	// Input must be at least 56 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 329 to 336
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)(input[42] & 0x80) << 17);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 337 to 344
	value = ((uint32_t)(input[42] & 0x7f) << 25) |
			((uint32_t)(input[43] & 0x80) << 17);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 345 to 352
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)(input[44] & 0x80) << 17);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 353 to 360
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)(input[45] & 0x80) << 17);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 361 to 368
	value = ((uint32_t)(input[45] & 0x7f) << 25) |
			((uint32_t)(input[46] & 0x80) << 17);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 369 to 376
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)(input[47] & 0x80) << 17);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 377 to 384
	value = ((uint32_t)(input[47] & 0x7f) << 25) |
			((uint32_t)(input[48] & 0x80) << 17);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 385 to 392
	value = ((uint32_t)(input[48] & 0x7f) << 25) |
			((uint32_t)(input[49] & 0x80) << 17);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 393 to 400
	value = ((uint32_t)(input[49] & 0x7f) << 25) |
			((uint32_t)(input[50] & 0x80) << 17);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 401 to 408
	value = ((uint32_t)(input[50] & 0x7f) << 25) |
			((uint32_t)(input[51] & 0x80) << 17);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 409 to 416
	value = ((uint32_t)(input[51] & 0x7f) << 25) |
			((uint32_t)(input[52] & 0x80) << 17);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 417 to 424
	value = ((uint32_t)(input[52] & 0x7f) << 25) |
			((uint32_t)(input[53] & 0x80) << 17);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 425 to 432
	value = ((uint32_t)(input[53] & 0x7f) << 25) |
			((uint32_t)(input[54] & 0x80) << 17);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 433 to 440
	value = ((uint32_t)(input[54] & 0x7f) << 25) |
			((uint32_t)(input[55] & 0x80) << 17);
	output[54] = (double)(value >> 24);
}

static void unpack_55_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 55 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 440 bits of data.
	// Input must be at least 56 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 329 to 336
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)(input[42] & 0x80) << 17);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 337 to 344
	value = ((uint32_t)(input[42] & 0x7f) << 25) |
			((uint32_t)(input[43] & 0x80) << 17);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 345 to 352
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)(input[44] & 0x80) << 17);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 353 to 360
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)(input[45] & 0x80) << 17);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 361 to 368
	value = ((uint32_t)(input[45] & 0x7f) << 25) |
			((uint32_t)(input[46] & 0x80) << 17);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 369 to 376
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)(input[47] & 0x80) << 17);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 377 to 384
	value = ((uint32_t)(input[47] & 0x7f) << 25) |
			((uint32_t)(input[48] & 0x80) << 17);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 385 to 392
	value = ((uint32_t)(input[48] & 0x7f) << 25) |
			((uint32_t)(input[49] & 0x80) << 17);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 393 to 400
	value = ((uint32_t)(input[49] & 0x7f) << 25) |
			((uint32_t)(input[50] & 0x80) << 17);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 401 to 408
	value = ((uint32_t)(input[50] & 0x7f) << 25) |
			((uint32_t)(input[51] & 0x80) << 17);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 409 to 416
	value = ((uint32_t)(input[51] & 0x7f) << 25) |
			((uint32_t)(input[52] & 0x80) << 17);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 417 to 424
	value = ((uint32_t)(input[52] & 0x7f) << 25) |
			((uint32_t)(input[53] & 0x80) << 17);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 425 to 432
	value = ((uint32_t)(input[53] & 0x7f) << 25) |
			((uint32_t)(input[54] & 0x80) << 17);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 433 to 440
	value = ((uint32_t)(input[54] & 0x7f) << 25) |
			((uint32_t)(input[55] & 0x80) << 17);
	output[54] = (double)(value >> 24);
}

static void unpack_55_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 55 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 440 bits of data.
	// Input must be at least 56 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 330 to 337
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)(input[42] & 0xc0) << 18);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 338 to 345
	value = ((uint32_t)(input[42] & 0x3f) << 26) |
			((uint32_t)(input[43] & 0xc0) << 18);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 346 to 353
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)(input[44] & 0xc0) << 18);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 354 to 361
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)(input[45] & 0xc0) << 18);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 362 to 369
	value = ((uint32_t)(input[45] & 0x3f) << 26) |
			((uint32_t)(input[46] & 0xc0) << 18);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 370 to 377
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)(input[47] & 0xc0) << 18);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 378 to 385
	value = ((uint32_t)(input[47] & 0x3f) << 26) |
			((uint32_t)(input[48] & 0xc0) << 18);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 386 to 393
	value = ((uint32_t)(input[48] & 0x3f) << 26) |
			((uint32_t)(input[49] & 0xc0) << 18);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 394 to 401
	value = ((uint32_t)(input[49] & 0x3f) << 26) |
			((uint32_t)(input[50] & 0xc0) << 18);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 402 to 409
	value = ((uint32_t)(input[50] & 0x3f) << 26) |
			((uint32_t)(input[51] & 0xc0) << 18);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 410 to 417
	value = ((uint32_t)(input[51] & 0x3f) << 26) |
			((uint32_t)(input[52] & 0xc0) << 18);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 418 to 425
	value = ((uint32_t)(input[52] & 0x3f) << 26) |
			((uint32_t)(input[53] & 0xc0) << 18);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 426 to 433
	value = ((uint32_t)(input[53] & 0x3f) << 26) |
			((uint32_t)(input[54] & 0xc0) << 18);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 434 to 441
	value = ((uint32_t)(input[54] & 0x3f) << 26) |
			((uint32_t)(input[55] & 0xc0) << 18);
	output[54] = (double)(value >> 24);
}

static void unpack_55_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 55 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 440 bits of data.
	// Input must be at least 56 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 330 to 337
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)(input[42] & 0xc0) << 18);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 338 to 345
	value = ((uint32_t)(input[42] & 0x3f) << 26) |
			((uint32_t)(input[43] & 0xc0) << 18);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 346 to 353
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)(input[44] & 0xc0) << 18);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 354 to 361
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)(input[45] & 0xc0) << 18);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 362 to 369
	value = ((uint32_t)(input[45] & 0x3f) << 26) |
			((uint32_t)(input[46] & 0xc0) << 18);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 370 to 377
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)(input[47] & 0xc0) << 18);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 378 to 385
	value = ((uint32_t)(input[47] & 0x3f) << 26) |
			((uint32_t)(input[48] & 0xc0) << 18);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 386 to 393
	value = ((uint32_t)(input[48] & 0x3f) << 26) |
			((uint32_t)(input[49] & 0xc0) << 18);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 394 to 401
	value = ((uint32_t)(input[49] & 0x3f) << 26) |
			((uint32_t)(input[50] & 0xc0) << 18);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 402 to 409
	value = ((uint32_t)(input[50] & 0x3f) << 26) |
			((uint32_t)(input[51] & 0xc0) << 18);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 410 to 417
	value = ((uint32_t)(input[51] & 0x3f) << 26) |
			((uint32_t)(input[52] & 0xc0) << 18);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 418 to 425
	value = ((uint32_t)(input[52] & 0x3f) << 26) |
			((uint32_t)(input[53] & 0xc0) << 18);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 426 to 433
	value = ((uint32_t)(input[53] & 0x3f) << 26) |
			((uint32_t)(input[54] & 0xc0) << 18);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 434 to 441
	value = ((uint32_t)(input[54] & 0x3f) << 26) |
			((uint32_t)(input[55] & 0xc0) << 18);
	output[54] = (double)(value >> 24);
}

static void unpack_55_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 55 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 440 bits of data.
	// Input must be at least 56 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 331 to 338
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)(input[42] & 0xe0) << 19);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 339 to 346
	value = ((uint32_t)(input[42] & 0x1f) << 27) |
			((uint32_t)(input[43] & 0xe0) << 19);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 347 to 354
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)(input[44] & 0xe0) << 19);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 355 to 362
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)(input[45] & 0xe0) << 19);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 363 to 370
	value = ((uint32_t)(input[45] & 0x1f) << 27) |
			((uint32_t)(input[46] & 0xe0) << 19);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 371 to 378
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)(input[47] & 0xe0) << 19);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 379 to 386
	value = ((uint32_t)(input[47] & 0x1f) << 27) |
			((uint32_t)(input[48] & 0xe0) << 19);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 387 to 394
	value = ((uint32_t)(input[48] & 0x1f) << 27) |
			((uint32_t)(input[49] & 0xe0) << 19);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 395 to 402
	value = ((uint32_t)(input[49] & 0x1f) << 27) |
			((uint32_t)(input[50] & 0xe0) << 19);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 403 to 410
	value = ((uint32_t)(input[50] & 0x1f) << 27) |
			((uint32_t)(input[51] & 0xe0) << 19);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 411 to 418
	value = ((uint32_t)(input[51] & 0x1f) << 27) |
			((uint32_t)(input[52] & 0xe0) << 19);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 419 to 426
	value = ((uint32_t)(input[52] & 0x1f) << 27) |
			((uint32_t)(input[53] & 0xe0) << 19);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 427 to 434
	value = ((uint32_t)(input[53] & 0x1f) << 27) |
			((uint32_t)(input[54] & 0xe0) << 19);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 435 to 442
	value = ((uint32_t)(input[54] & 0x1f) << 27) |
			((uint32_t)(input[55] & 0xe0) << 19);
	output[54] = (double)(value >> 24);
}

static void unpack_55_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 55 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 440 bits of data.
	// Input must be at least 56 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 331 to 338
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)(input[42] & 0xe0) << 19);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 339 to 346
	value = ((uint32_t)(input[42] & 0x1f) << 27) |
			((uint32_t)(input[43] & 0xe0) << 19);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 347 to 354
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)(input[44] & 0xe0) << 19);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 355 to 362
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)(input[45] & 0xe0) << 19);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 363 to 370
	value = ((uint32_t)(input[45] & 0x1f) << 27) |
			((uint32_t)(input[46] & 0xe0) << 19);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 371 to 378
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)(input[47] & 0xe0) << 19);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 379 to 386
	value = ((uint32_t)(input[47] & 0x1f) << 27) |
			((uint32_t)(input[48] & 0xe0) << 19);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 387 to 394
	value = ((uint32_t)(input[48] & 0x1f) << 27) |
			((uint32_t)(input[49] & 0xe0) << 19);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 395 to 402
	value = ((uint32_t)(input[49] & 0x1f) << 27) |
			((uint32_t)(input[50] & 0xe0) << 19);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 403 to 410
	value = ((uint32_t)(input[50] & 0x1f) << 27) |
			((uint32_t)(input[51] & 0xe0) << 19);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 411 to 418
	value = ((uint32_t)(input[51] & 0x1f) << 27) |
			((uint32_t)(input[52] & 0xe0) << 19);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 419 to 426
	value = ((uint32_t)(input[52] & 0x1f) << 27) |
			((uint32_t)(input[53] & 0xe0) << 19);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 427 to 434
	value = ((uint32_t)(input[53] & 0x1f) << 27) |
			((uint32_t)(input[54] & 0xe0) << 19);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 435 to 442
	value = ((uint32_t)(input[54] & 0x1f) << 27) |
			((uint32_t)(input[55] & 0xe0) << 19);
	output[54] = (double)(value >> 24);
}

static void unpack_55_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 55 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 440 bits of data.
	// Input must be at least 56 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 332 to 339
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)(input[42] & 0xf0) << 20);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 340 to 347
	value = ((uint32_t)(input[42] & 0x0f) << 28) |
			((uint32_t)(input[43] & 0xf0) << 20);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 348 to 355
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)(input[44] & 0xf0) << 20);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 356 to 363
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)(input[45] & 0xf0) << 20);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 364 to 371
	value = ((uint32_t)(input[45] & 0x0f) << 28) |
			((uint32_t)(input[46] & 0xf0) << 20);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 372 to 379
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)(input[47] & 0xf0) << 20);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 380 to 387
	value = ((uint32_t)(input[47] & 0x0f) << 28) |
			((uint32_t)(input[48] & 0xf0) << 20);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 388 to 395
	value = ((uint32_t)(input[48] & 0x0f) << 28) |
			((uint32_t)(input[49] & 0xf0) << 20);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 396 to 403
	value = ((uint32_t)(input[49] & 0x0f) << 28) |
			((uint32_t)(input[50] & 0xf0) << 20);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 404 to 411
	value = ((uint32_t)(input[50] & 0x0f) << 28) |
			((uint32_t)(input[51] & 0xf0) << 20);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 412 to 419
	value = ((uint32_t)(input[51] & 0x0f) << 28) |
			((uint32_t)(input[52] & 0xf0) << 20);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 420 to 427
	value = ((uint32_t)(input[52] & 0x0f) << 28) |
			((uint32_t)(input[53] & 0xf0) << 20);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 428 to 435
	value = ((uint32_t)(input[53] & 0x0f) << 28) |
			((uint32_t)(input[54] & 0xf0) << 20);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 436 to 443
	value = ((uint32_t)(input[54] & 0x0f) << 28) |
			((uint32_t)(input[55] & 0xf0) << 20);
	output[54] = (double)(value >> 24);
}

static void unpack_55_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 55 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 440 bits of data.
	// Input must be at least 56 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 332 to 339
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)(input[42] & 0xf0) << 20);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 340 to 347
	value = ((uint32_t)(input[42] & 0x0f) << 28) |
			((uint32_t)(input[43] & 0xf0) << 20);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 348 to 355
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)(input[44] & 0xf0) << 20);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 356 to 363
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)(input[45] & 0xf0) << 20);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 364 to 371
	value = ((uint32_t)(input[45] & 0x0f) << 28) |
			((uint32_t)(input[46] & 0xf0) << 20);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 372 to 379
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)(input[47] & 0xf0) << 20);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 380 to 387
	value = ((uint32_t)(input[47] & 0x0f) << 28) |
			((uint32_t)(input[48] & 0xf0) << 20);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 388 to 395
	value = ((uint32_t)(input[48] & 0x0f) << 28) |
			((uint32_t)(input[49] & 0xf0) << 20);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 396 to 403
	value = ((uint32_t)(input[49] & 0x0f) << 28) |
			((uint32_t)(input[50] & 0xf0) << 20);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 404 to 411
	value = ((uint32_t)(input[50] & 0x0f) << 28) |
			((uint32_t)(input[51] & 0xf0) << 20);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 412 to 419
	value = ((uint32_t)(input[51] & 0x0f) << 28) |
			((uint32_t)(input[52] & 0xf0) << 20);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 420 to 427
	value = ((uint32_t)(input[52] & 0x0f) << 28) |
			((uint32_t)(input[53] & 0xf0) << 20);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 428 to 435
	value = ((uint32_t)(input[53] & 0x0f) << 28) |
			((uint32_t)(input[54] & 0xf0) << 20);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 436 to 443
	value = ((uint32_t)(input[54] & 0x0f) << 28) |
			((uint32_t)(input[55] & 0xf0) << 20);
	output[54] = (double)(value >> 24);
}

static void unpack_55_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 55 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 440 bits of data.
	// Input must be at least 56 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 333 to 340
	value = ((uint32_t)(input[41] & 0x07) << 29) |
			((uint32_t)(input[42] & 0xf8) << 21);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 341 to 348
	value = ((uint32_t)(input[42] & 0x07) << 29) |
			((uint32_t)(input[43] & 0xf8) << 21);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 349 to 356
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)(input[44] & 0xf8) << 21);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 357 to 364
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)(input[45] & 0xf8) << 21);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 365 to 372
	value = ((uint32_t)(input[45] & 0x07) << 29) |
			((uint32_t)(input[46] & 0xf8) << 21);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 373 to 380
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)(input[47] & 0xf8) << 21);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 381 to 388
	value = ((uint32_t)(input[47] & 0x07) << 29) |
			((uint32_t)(input[48] & 0xf8) << 21);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 389 to 396
	value = ((uint32_t)(input[48] & 0x07) << 29) |
			((uint32_t)(input[49] & 0xf8) << 21);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 397 to 404
	value = ((uint32_t)(input[49] & 0x07) << 29) |
			((uint32_t)(input[50] & 0xf8) << 21);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 405 to 412
	value = ((uint32_t)(input[50] & 0x07) << 29) |
			((uint32_t)(input[51] & 0xf8) << 21);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 413 to 420
	value = ((uint32_t)(input[51] & 0x07) << 29) |
			((uint32_t)(input[52] & 0xf8) << 21);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 421 to 428
	value = ((uint32_t)(input[52] & 0x07) << 29) |
			((uint32_t)(input[53] & 0xf8) << 21);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 429 to 436
	value = ((uint32_t)(input[53] & 0x07) << 29) |
			((uint32_t)(input[54] & 0xf8) << 21);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 437 to 444
	value = ((uint32_t)(input[54] & 0x07) << 29) |
			((uint32_t)(input[55] & 0xf8) << 21);
	output[54] = (double)(value >> 24);
}

static void unpack_55_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 55 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 440 bits of data.
	// Input must be at least 56 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 333 to 340
	value = ((uint32_t)(input[41] & 0x07) << 29) |
			((uint32_t)(input[42] & 0xf8) << 21);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 341 to 348
	value = ((uint32_t)(input[42] & 0x07) << 29) |
			((uint32_t)(input[43] & 0xf8) << 21);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 349 to 356
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)(input[44] & 0xf8) << 21);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 357 to 364
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)(input[45] & 0xf8) << 21);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 365 to 372
	value = ((uint32_t)(input[45] & 0x07) << 29) |
			((uint32_t)(input[46] & 0xf8) << 21);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 373 to 380
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)(input[47] & 0xf8) << 21);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 381 to 388
	value = ((uint32_t)(input[47] & 0x07) << 29) |
			((uint32_t)(input[48] & 0xf8) << 21);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 389 to 396
	value = ((uint32_t)(input[48] & 0x07) << 29) |
			((uint32_t)(input[49] & 0xf8) << 21);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 397 to 404
	value = ((uint32_t)(input[49] & 0x07) << 29) |
			((uint32_t)(input[50] & 0xf8) << 21);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 405 to 412
	value = ((uint32_t)(input[50] & 0x07) << 29) |
			((uint32_t)(input[51] & 0xf8) << 21);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 413 to 420
	value = ((uint32_t)(input[51] & 0x07) << 29) |
			((uint32_t)(input[52] & 0xf8) << 21);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 421 to 428
	value = ((uint32_t)(input[52] & 0x07) << 29) |
			((uint32_t)(input[53] & 0xf8) << 21);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 429 to 436
	value = ((uint32_t)(input[53] & 0x07) << 29) |
			((uint32_t)(input[54] & 0xf8) << 21);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 437 to 444
	value = ((uint32_t)(input[54] & 0x07) << 29) |
			((uint32_t)(input[55] & 0xf8) << 21);
	output[54] = (double)(value >> 24);
}

static void unpack_55_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 55 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 440 bits of data.
	// Input must be at least 56 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 334 to 341
	value = ((uint32_t)(input[41] & 0x03) << 30) |
			((uint32_t)(input[42] & 0xfc) << 22);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 342 to 349
	value = ((uint32_t)(input[42] & 0x03) << 30) |
			((uint32_t)(input[43] & 0xfc) << 22);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 350 to 357
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)(input[44] & 0xfc) << 22);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 358 to 365
	value = ((uint32_t)(input[44] & 0x03) << 30) |
			((uint32_t)(input[45] & 0xfc) << 22);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 366 to 373
	value = ((uint32_t)(input[45] & 0x03) << 30) |
			((uint32_t)(input[46] & 0xfc) << 22);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 374 to 381
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)(input[47] & 0xfc) << 22);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 382 to 389
	value = ((uint32_t)(input[47] & 0x03) << 30) |
			((uint32_t)(input[48] & 0xfc) << 22);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 390 to 397
	value = ((uint32_t)(input[48] & 0x03) << 30) |
			((uint32_t)(input[49] & 0xfc) << 22);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 398 to 405
	value = ((uint32_t)(input[49] & 0x03) << 30) |
			((uint32_t)(input[50] & 0xfc) << 22);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 406 to 413
	value = ((uint32_t)(input[50] & 0x03) << 30) |
			((uint32_t)(input[51] & 0xfc) << 22);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 414 to 421
	value = ((uint32_t)(input[51] & 0x03) << 30) |
			((uint32_t)(input[52] & 0xfc) << 22);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 422 to 429
	value = ((uint32_t)(input[52] & 0x03) << 30) |
			((uint32_t)(input[53] & 0xfc) << 22);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 430 to 437
	value = ((uint32_t)(input[53] & 0x03) << 30) |
			((uint32_t)(input[54] & 0xfc) << 22);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 438 to 445
	value = ((uint32_t)(input[54] & 0x03) << 30) |
			((uint32_t)(input[55] & 0xfc) << 22);
	output[54] = (double)(value >> 24);
}

static void unpack_55_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 55 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 440 bits of data.
	// Input must be at least 56 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 334 to 341
	value = ((uint32_t)(input[41] & 0x03) << 30) |
			((uint32_t)(input[42] & 0xfc) << 22);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 342 to 349
	value = ((uint32_t)(input[42] & 0x03) << 30) |
			((uint32_t)(input[43] & 0xfc) << 22);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 350 to 357
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)(input[44] & 0xfc) << 22);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 358 to 365
	value = ((uint32_t)(input[44] & 0x03) << 30) |
			((uint32_t)(input[45] & 0xfc) << 22);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 366 to 373
	value = ((uint32_t)(input[45] & 0x03) << 30) |
			((uint32_t)(input[46] & 0xfc) << 22);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 374 to 381
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)(input[47] & 0xfc) << 22);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 382 to 389
	value = ((uint32_t)(input[47] & 0x03) << 30) |
			((uint32_t)(input[48] & 0xfc) << 22);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 390 to 397
	value = ((uint32_t)(input[48] & 0x03) << 30) |
			((uint32_t)(input[49] & 0xfc) << 22);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 398 to 405
	value = ((uint32_t)(input[49] & 0x03) << 30) |
			((uint32_t)(input[50] & 0xfc) << 22);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 406 to 413
	value = ((uint32_t)(input[50] & 0x03) << 30) |
			((uint32_t)(input[51] & 0xfc) << 22);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 414 to 421
	value = ((uint32_t)(input[51] & 0x03) << 30) |
			((uint32_t)(input[52] & 0xfc) << 22);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 422 to 429
	value = ((uint32_t)(input[52] & 0x03) << 30) |
			((uint32_t)(input[53] & 0xfc) << 22);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 430 to 437
	value = ((uint32_t)(input[53] & 0x03) << 30) |
			((uint32_t)(input[54] & 0xfc) << 22);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 438 to 445
	value = ((uint32_t)(input[54] & 0x03) << 30) |
			((uint32_t)(input[55] & 0xfc) << 22);
	output[54] = (double)(value >> 24);
}

static void unpack_55_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 55 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 440 bits of data.
	// Input must be at least 56 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 335 to 342
	value = ((uint32_t)(input[41] & 0x01) << 31) |
			((uint32_t)(input[42] & 0xfe) << 23);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 343 to 350
	value = ((uint32_t)(input[42] & 0x01) << 31) |
			((uint32_t)(input[43] & 0xfe) << 23);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 351 to 358
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)(input[44] & 0xfe) << 23);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 359 to 366
	value = ((uint32_t)(input[44] & 0x01) << 31) |
			((uint32_t)(input[45] & 0xfe) << 23);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 367 to 374
	value = ((uint32_t)(input[45] & 0x01) << 31) |
			((uint32_t)(input[46] & 0xfe) << 23);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 375 to 382
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)(input[47] & 0xfe) << 23);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 383 to 390
	value = ((uint32_t)(input[47] & 0x01) << 31) |
			((uint32_t)(input[48] & 0xfe) << 23);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 391 to 398
	value = ((uint32_t)(input[48] & 0x01) << 31) |
			((uint32_t)(input[49] & 0xfe) << 23);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 399 to 406
	value = ((uint32_t)(input[49] & 0x01) << 31) |
			((uint32_t)(input[50] & 0xfe) << 23);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 407 to 414
	value = ((uint32_t)(input[50] & 0x01) << 31) |
			((uint32_t)(input[51] & 0xfe) << 23);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 415 to 422
	value = ((uint32_t)(input[51] & 0x01) << 31) |
			((uint32_t)(input[52] & 0xfe) << 23);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 423 to 430
	value = ((uint32_t)(input[52] & 0x01) << 31) |
			((uint32_t)(input[53] & 0xfe) << 23);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 431 to 438
	value = ((uint32_t)(input[53] & 0x01) << 31) |
			((uint32_t)(input[54] & 0xfe) << 23);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 439 to 446
	value = ((uint32_t)(input[54] & 0x01) << 31) |
			((uint32_t)(input[55] & 0xfe) << 23);
	output[54] = (double)(value >> 24);
}

static void unpack_55_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 55 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 440 bits of data.
	// Input must be at least 56 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 335 to 342
	value = ((uint32_t)(input[41] & 0x01) << 31) |
			((uint32_t)(input[42] & 0xfe) << 23);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 343 to 350
	value = ((uint32_t)(input[42] & 0x01) << 31) |
			((uint32_t)(input[43] & 0xfe) << 23);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 351 to 358
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)(input[44] & 0xfe) << 23);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 359 to 366
	value = ((uint32_t)(input[44] & 0x01) << 31) |
			((uint32_t)(input[45] & 0xfe) << 23);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 367 to 374
	value = ((uint32_t)(input[45] & 0x01) << 31) |
			((uint32_t)(input[46] & 0xfe) << 23);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 375 to 382
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)(input[47] & 0xfe) << 23);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 383 to 390
	value = ((uint32_t)(input[47] & 0x01) << 31) |
			((uint32_t)(input[48] & 0xfe) << 23);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 391 to 398
	value = ((uint32_t)(input[48] & 0x01) << 31) |
			((uint32_t)(input[49] & 0xfe) << 23);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 399 to 406
	value = ((uint32_t)(input[49] & 0x01) << 31) |
			((uint32_t)(input[50] & 0xfe) << 23);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 407 to 414
	value = ((uint32_t)(input[50] & 0x01) << 31) |
			((uint32_t)(input[51] & 0xfe) << 23);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 415 to 422
	value = ((uint32_t)(input[51] & 0x01) << 31) |
			((uint32_t)(input[52] & 0xfe) << 23);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 423 to 430
	value = ((uint32_t)(input[52] & 0x01) << 31) |
			((uint32_t)(input[53] & 0xfe) << 23);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 431 to 438
	value = ((uint32_t)(input[53] & 0x01) << 31) |
			((uint32_t)(input[54] & 0xfe) << 23);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 439 to 446
	value = ((uint32_t)(input[54] & 0x01) << 31) |
			((uint32_t)(input[55] & 0xfe) << 23);
	output[54] = (double)(value >> 24);
}

static void unpack_56_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 56 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 448 bits of data.
	// Input must be at least 56 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 328 to 335
	value = ((uint32_t)input[41] << 24);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 336 to 343
	value = ((uint32_t)input[42] << 24);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 344 to 351
	value = ((uint32_t)input[43] << 24);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 352 to 359
	value = ((uint32_t)input[44] << 24);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 360 to 367
	value = ((uint32_t)input[45] << 24);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 368 to 375
	value = ((uint32_t)input[46] << 24);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 376 to 383
	value = ((uint32_t)input[47] << 24);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 384 to 391
	value = ((uint32_t)input[48] << 24);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 392 to 399
	value = ((uint32_t)input[49] << 24);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 400 to 407
	value = ((uint32_t)input[50] << 24);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 408 to 415
	value = ((uint32_t)input[51] << 24);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 416 to 423
	value = ((uint32_t)input[52] << 24);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 424 to 431
	value = ((uint32_t)input[53] << 24);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 432 to 439
	value = ((uint32_t)input[54] << 24);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 440 to 447
	value = ((uint32_t)input[55] << 24);
	output[55] = (double)(value >> 24);
}

static void unpack_56_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 56 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 448 bits of data.
	// Input must be at least 56 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 328 to 335
	value = ((uint32_t)input[41] << 24);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 336 to 343
	value = ((uint32_t)input[42] << 24);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 344 to 351
	value = ((uint32_t)input[43] << 24);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 352 to 359
	value = ((uint32_t)input[44] << 24);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 360 to 367
	value = ((uint32_t)input[45] << 24);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 368 to 375
	value = ((uint32_t)input[46] << 24);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 376 to 383
	value = ((uint32_t)input[47] << 24);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 384 to 391
	value = ((uint32_t)input[48] << 24);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 392 to 399
	value = ((uint32_t)input[49] << 24);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 400 to 407
	value = ((uint32_t)input[50] << 24);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 408 to 415
	value = ((uint32_t)input[51] << 24);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 416 to 423
	value = ((uint32_t)input[52] << 24);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 424 to 431
	value = ((uint32_t)input[53] << 24);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 432 to 439
	value = ((uint32_t)input[54] << 24);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 440 to 447
	value = ((uint32_t)input[55] << 24);
	output[55] = (double)(value >> 24);
}

static void unpack_56_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 56 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 448 bits of data.
	// Input must be at least 57 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 329 to 336
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)(input[42] & 0x80) << 17);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 337 to 344
	value = ((uint32_t)(input[42] & 0x7f) << 25) |
			((uint32_t)(input[43] & 0x80) << 17);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 345 to 352
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)(input[44] & 0x80) << 17);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 353 to 360
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)(input[45] & 0x80) << 17);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 361 to 368
	value = ((uint32_t)(input[45] & 0x7f) << 25) |
			((uint32_t)(input[46] & 0x80) << 17);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 369 to 376
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)(input[47] & 0x80) << 17);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 377 to 384
	value = ((uint32_t)(input[47] & 0x7f) << 25) |
			((uint32_t)(input[48] & 0x80) << 17);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 385 to 392
	value = ((uint32_t)(input[48] & 0x7f) << 25) |
			((uint32_t)(input[49] & 0x80) << 17);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 393 to 400
	value = ((uint32_t)(input[49] & 0x7f) << 25) |
			((uint32_t)(input[50] & 0x80) << 17);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 401 to 408
	value = ((uint32_t)(input[50] & 0x7f) << 25) |
			((uint32_t)(input[51] & 0x80) << 17);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 409 to 416
	value = ((uint32_t)(input[51] & 0x7f) << 25) |
			((uint32_t)(input[52] & 0x80) << 17);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 417 to 424
	value = ((uint32_t)(input[52] & 0x7f) << 25) |
			((uint32_t)(input[53] & 0x80) << 17);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 425 to 432
	value = ((uint32_t)(input[53] & 0x7f) << 25) |
			((uint32_t)(input[54] & 0x80) << 17);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 433 to 440
	value = ((uint32_t)(input[54] & 0x7f) << 25) |
			((uint32_t)(input[55] & 0x80) << 17);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 441 to 448
	value = ((uint32_t)(input[55] & 0x7f) << 25) |
			((uint32_t)(input[56] & 0x80) << 17);
	output[55] = (double)(value >> 24);
}

static void unpack_56_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 56 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 448 bits of data.
	// Input must be at least 57 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 329 to 336
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)(input[42] & 0x80) << 17);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 337 to 344
	value = ((uint32_t)(input[42] & 0x7f) << 25) |
			((uint32_t)(input[43] & 0x80) << 17);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 345 to 352
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)(input[44] & 0x80) << 17);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 353 to 360
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)(input[45] & 0x80) << 17);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 361 to 368
	value = ((uint32_t)(input[45] & 0x7f) << 25) |
			((uint32_t)(input[46] & 0x80) << 17);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 369 to 376
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)(input[47] & 0x80) << 17);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 377 to 384
	value = ((uint32_t)(input[47] & 0x7f) << 25) |
			((uint32_t)(input[48] & 0x80) << 17);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 385 to 392
	value = ((uint32_t)(input[48] & 0x7f) << 25) |
			((uint32_t)(input[49] & 0x80) << 17);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 393 to 400
	value = ((uint32_t)(input[49] & 0x7f) << 25) |
			((uint32_t)(input[50] & 0x80) << 17);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 401 to 408
	value = ((uint32_t)(input[50] & 0x7f) << 25) |
			((uint32_t)(input[51] & 0x80) << 17);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 409 to 416
	value = ((uint32_t)(input[51] & 0x7f) << 25) |
			((uint32_t)(input[52] & 0x80) << 17);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 417 to 424
	value = ((uint32_t)(input[52] & 0x7f) << 25) |
			((uint32_t)(input[53] & 0x80) << 17);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 425 to 432
	value = ((uint32_t)(input[53] & 0x7f) << 25) |
			((uint32_t)(input[54] & 0x80) << 17);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 433 to 440
	value = ((uint32_t)(input[54] & 0x7f) << 25) |
			((uint32_t)(input[55] & 0x80) << 17);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 441 to 448
	value = ((uint32_t)(input[55] & 0x7f) << 25) |
			((uint32_t)(input[56] & 0x80) << 17);
	output[55] = (double)(value >> 24);
}

static void unpack_56_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 56 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 448 bits of data.
	// Input must be at least 57 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 330 to 337
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)(input[42] & 0xc0) << 18);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 338 to 345
	value = ((uint32_t)(input[42] & 0x3f) << 26) |
			((uint32_t)(input[43] & 0xc0) << 18);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 346 to 353
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)(input[44] & 0xc0) << 18);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 354 to 361
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)(input[45] & 0xc0) << 18);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 362 to 369
	value = ((uint32_t)(input[45] & 0x3f) << 26) |
			((uint32_t)(input[46] & 0xc0) << 18);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 370 to 377
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)(input[47] & 0xc0) << 18);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 378 to 385
	value = ((uint32_t)(input[47] & 0x3f) << 26) |
			((uint32_t)(input[48] & 0xc0) << 18);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 386 to 393
	value = ((uint32_t)(input[48] & 0x3f) << 26) |
			((uint32_t)(input[49] & 0xc0) << 18);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 394 to 401
	value = ((uint32_t)(input[49] & 0x3f) << 26) |
			((uint32_t)(input[50] & 0xc0) << 18);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 402 to 409
	value = ((uint32_t)(input[50] & 0x3f) << 26) |
			((uint32_t)(input[51] & 0xc0) << 18);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 410 to 417
	value = ((uint32_t)(input[51] & 0x3f) << 26) |
			((uint32_t)(input[52] & 0xc0) << 18);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 418 to 425
	value = ((uint32_t)(input[52] & 0x3f) << 26) |
			((uint32_t)(input[53] & 0xc0) << 18);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 426 to 433
	value = ((uint32_t)(input[53] & 0x3f) << 26) |
			((uint32_t)(input[54] & 0xc0) << 18);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 434 to 441
	value = ((uint32_t)(input[54] & 0x3f) << 26) |
			((uint32_t)(input[55] & 0xc0) << 18);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 442 to 449
	value = ((uint32_t)(input[55] & 0x3f) << 26) |
			((uint32_t)(input[56] & 0xc0) << 18);
	output[55] = (double)(value >> 24);
}

static void unpack_56_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 56 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 448 bits of data.
	// Input must be at least 57 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 330 to 337
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)(input[42] & 0xc0) << 18);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 338 to 345
	value = ((uint32_t)(input[42] & 0x3f) << 26) |
			((uint32_t)(input[43] & 0xc0) << 18);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 346 to 353
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)(input[44] & 0xc0) << 18);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 354 to 361
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)(input[45] & 0xc0) << 18);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 362 to 369
	value = ((uint32_t)(input[45] & 0x3f) << 26) |
			((uint32_t)(input[46] & 0xc0) << 18);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 370 to 377
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)(input[47] & 0xc0) << 18);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 378 to 385
	value = ((uint32_t)(input[47] & 0x3f) << 26) |
			((uint32_t)(input[48] & 0xc0) << 18);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 386 to 393
	value = ((uint32_t)(input[48] & 0x3f) << 26) |
			((uint32_t)(input[49] & 0xc0) << 18);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 394 to 401
	value = ((uint32_t)(input[49] & 0x3f) << 26) |
			((uint32_t)(input[50] & 0xc0) << 18);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 402 to 409
	value = ((uint32_t)(input[50] & 0x3f) << 26) |
			((uint32_t)(input[51] & 0xc0) << 18);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 410 to 417
	value = ((uint32_t)(input[51] & 0x3f) << 26) |
			((uint32_t)(input[52] & 0xc0) << 18);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 418 to 425
	value = ((uint32_t)(input[52] & 0x3f) << 26) |
			((uint32_t)(input[53] & 0xc0) << 18);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 426 to 433
	value = ((uint32_t)(input[53] & 0x3f) << 26) |
			((uint32_t)(input[54] & 0xc0) << 18);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 434 to 441
	value = ((uint32_t)(input[54] & 0x3f) << 26) |
			((uint32_t)(input[55] & 0xc0) << 18);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 442 to 449
	value = ((uint32_t)(input[55] & 0x3f) << 26) |
			((uint32_t)(input[56] & 0xc0) << 18);
	output[55] = (double)(value >> 24);
}

static void unpack_56_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 56 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 448 bits of data.
	// Input must be at least 57 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 331 to 338
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)(input[42] & 0xe0) << 19);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 339 to 346
	value = ((uint32_t)(input[42] & 0x1f) << 27) |
			((uint32_t)(input[43] & 0xe0) << 19);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 347 to 354
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)(input[44] & 0xe0) << 19);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 355 to 362
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)(input[45] & 0xe0) << 19);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 363 to 370
	value = ((uint32_t)(input[45] & 0x1f) << 27) |
			((uint32_t)(input[46] & 0xe0) << 19);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 371 to 378
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)(input[47] & 0xe0) << 19);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 379 to 386
	value = ((uint32_t)(input[47] & 0x1f) << 27) |
			((uint32_t)(input[48] & 0xe0) << 19);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 387 to 394
	value = ((uint32_t)(input[48] & 0x1f) << 27) |
			((uint32_t)(input[49] & 0xe0) << 19);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 395 to 402
	value = ((uint32_t)(input[49] & 0x1f) << 27) |
			((uint32_t)(input[50] & 0xe0) << 19);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 403 to 410
	value = ((uint32_t)(input[50] & 0x1f) << 27) |
			((uint32_t)(input[51] & 0xe0) << 19);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 411 to 418
	value = ((uint32_t)(input[51] & 0x1f) << 27) |
			((uint32_t)(input[52] & 0xe0) << 19);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 419 to 426
	value = ((uint32_t)(input[52] & 0x1f) << 27) |
			((uint32_t)(input[53] & 0xe0) << 19);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 427 to 434
	value = ((uint32_t)(input[53] & 0x1f) << 27) |
			((uint32_t)(input[54] & 0xe0) << 19);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 435 to 442
	value = ((uint32_t)(input[54] & 0x1f) << 27) |
			((uint32_t)(input[55] & 0xe0) << 19);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 443 to 450
	value = ((uint32_t)(input[55] & 0x1f) << 27) |
			((uint32_t)(input[56] & 0xe0) << 19);
	output[55] = (double)(value >> 24);
}

static void unpack_56_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 56 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 448 bits of data.
	// Input must be at least 57 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 331 to 338
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)(input[42] & 0xe0) << 19);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 339 to 346
	value = ((uint32_t)(input[42] & 0x1f) << 27) |
			((uint32_t)(input[43] & 0xe0) << 19);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 347 to 354
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)(input[44] & 0xe0) << 19);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 355 to 362
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)(input[45] & 0xe0) << 19);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 363 to 370
	value = ((uint32_t)(input[45] & 0x1f) << 27) |
			((uint32_t)(input[46] & 0xe0) << 19);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 371 to 378
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)(input[47] & 0xe0) << 19);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 379 to 386
	value = ((uint32_t)(input[47] & 0x1f) << 27) |
			((uint32_t)(input[48] & 0xe0) << 19);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 387 to 394
	value = ((uint32_t)(input[48] & 0x1f) << 27) |
			((uint32_t)(input[49] & 0xe0) << 19);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 395 to 402
	value = ((uint32_t)(input[49] & 0x1f) << 27) |
			((uint32_t)(input[50] & 0xe0) << 19);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 403 to 410
	value = ((uint32_t)(input[50] & 0x1f) << 27) |
			((uint32_t)(input[51] & 0xe0) << 19);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 411 to 418
	value = ((uint32_t)(input[51] & 0x1f) << 27) |
			((uint32_t)(input[52] & 0xe0) << 19);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 419 to 426
	value = ((uint32_t)(input[52] & 0x1f) << 27) |
			((uint32_t)(input[53] & 0xe0) << 19);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 427 to 434
	value = ((uint32_t)(input[53] & 0x1f) << 27) |
			((uint32_t)(input[54] & 0xe0) << 19);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 435 to 442
	value = ((uint32_t)(input[54] & 0x1f) << 27) |
			((uint32_t)(input[55] & 0xe0) << 19);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 443 to 450
	value = ((uint32_t)(input[55] & 0x1f) << 27) |
			((uint32_t)(input[56] & 0xe0) << 19);
	output[55] = (double)(value >> 24);
}

static void unpack_56_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 56 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 448 bits of data.
	// Input must be at least 57 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 332 to 339
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)(input[42] & 0xf0) << 20);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 340 to 347
	value = ((uint32_t)(input[42] & 0x0f) << 28) |
			((uint32_t)(input[43] & 0xf0) << 20);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 348 to 355
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)(input[44] & 0xf0) << 20);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 356 to 363
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)(input[45] & 0xf0) << 20);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 364 to 371
	value = ((uint32_t)(input[45] & 0x0f) << 28) |
			((uint32_t)(input[46] & 0xf0) << 20);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 372 to 379
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)(input[47] & 0xf0) << 20);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 380 to 387
	value = ((uint32_t)(input[47] & 0x0f) << 28) |
			((uint32_t)(input[48] & 0xf0) << 20);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 388 to 395
	value = ((uint32_t)(input[48] & 0x0f) << 28) |
			((uint32_t)(input[49] & 0xf0) << 20);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 396 to 403
	value = ((uint32_t)(input[49] & 0x0f) << 28) |
			((uint32_t)(input[50] & 0xf0) << 20);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 404 to 411
	value = ((uint32_t)(input[50] & 0x0f) << 28) |
			((uint32_t)(input[51] & 0xf0) << 20);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 412 to 419
	value = ((uint32_t)(input[51] & 0x0f) << 28) |
			((uint32_t)(input[52] & 0xf0) << 20);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 420 to 427
	value = ((uint32_t)(input[52] & 0x0f) << 28) |
			((uint32_t)(input[53] & 0xf0) << 20);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 428 to 435
	value = ((uint32_t)(input[53] & 0x0f) << 28) |
			((uint32_t)(input[54] & 0xf0) << 20);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 436 to 443
	value = ((uint32_t)(input[54] & 0x0f) << 28) |
			((uint32_t)(input[55] & 0xf0) << 20);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 444 to 451
	value = ((uint32_t)(input[55] & 0x0f) << 28) |
			((uint32_t)(input[56] & 0xf0) << 20);
	output[55] = (double)(value >> 24);
}

static void unpack_56_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 56 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 448 bits of data.
	// Input must be at least 57 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 332 to 339
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)(input[42] & 0xf0) << 20);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 340 to 347
	value = ((uint32_t)(input[42] & 0x0f) << 28) |
			((uint32_t)(input[43] & 0xf0) << 20);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 348 to 355
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)(input[44] & 0xf0) << 20);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 356 to 363
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)(input[45] & 0xf0) << 20);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 364 to 371
	value = ((uint32_t)(input[45] & 0x0f) << 28) |
			((uint32_t)(input[46] & 0xf0) << 20);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 372 to 379
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)(input[47] & 0xf0) << 20);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 380 to 387
	value = ((uint32_t)(input[47] & 0x0f) << 28) |
			((uint32_t)(input[48] & 0xf0) << 20);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 388 to 395
	value = ((uint32_t)(input[48] & 0x0f) << 28) |
			((uint32_t)(input[49] & 0xf0) << 20);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 396 to 403
	value = ((uint32_t)(input[49] & 0x0f) << 28) |
			((uint32_t)(input[50] & 0xf0) << 20);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 404 to 411
	value = ((uint32_t)(input[50] & 0x0f) << 28) |
			((uint32_t)(input[51] & 0xf0) << 20);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 412 to 419
	value = ((uint32_t)(input[51] & 0x0f) << 28) |
			((uint32_t)(input[52] & 0xf0) << 20);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 420 to 427
	value = ((uint32_t)(input[52] & 0x0f) << 28) |
			((uint32_t)(input[53] & 0xf0) << 20);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 428 to 435
	value = ((uint32_t)(input[53] & 0x0f) << 28) |
			((uint32_t)(input[54] & 0xf0) << 20);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 436 to 443
	value = ((uint32_t)(input[54] & 0x0f) << 28) |
			((uint32_t)(input[55] & 0xf0) << 20);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 444 to 451
	value = ((uint32_t)(input[55] & 0x0f) << 28) |
			((uint32_t)(input[56] & 0xf0) << 20);
	output[55] = (double)(value >> 24);
}

static void unpack_56_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 56 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 448 bits of data.
	// Input must be at least 57 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 333 to 340
	value = ((uint32_t)(input[41] & 0x07) << 29) |
			((uint32_t)(input[42] & 0xf8) << 21);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 341 to 348
	value = ((uint32_t)(input[42] & 0x07) << 29) |
			((uint32_t)(input[43] & 0xf8) << 21);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 349 to 356
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)(input[44] & 0xf8) << 21);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 357 to 364
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)(input[45] & 0xf8) << 21);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 365 to 372
	value = ((uint32_t)(input[45] & 0x07) << 29) |
			((uint32_t)(input[46] & 0xf8) << 21);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 373 to 380
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)(input[47] & 0xf8) << 21);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 381 to 388
	value = ((uint32_t)(input[47] & 0x07) << 29) |
			((uint32_t)(input[48] & 0xf8) << 21);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 389 to 396
	value = ((uint32_t)(input[48] & 0x07) << 29) |
			((uint32_t)(input[49] & 0xf8) << 21);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 397 to 404
	value = ((uint32_t)(input[49] & 0x07) << 29) |
			((uint32_t)(input[50] & 0xf8) << 21);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 405 to 412
	value = ((uint32_t)(input[50] & 0x07) << 29) |
			((uint32_t)(input[51] & 0xf8) << 21);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 413 to 420
	value = ((uint32_t)(input[51] & 0x07) << 29) |
			((uint32_t)(input[52] & 0xf8) << 21);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 421 to 428
	value = ((uint32_t)(input[52] & 0x07) << 29) |
			((uint32_t)(input[53] & 0xf8) << 21);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 429 to 436
	value = ((uint32_t)(input[53] & 0x07) << 29) |
			((uint32_t)(input[54] & 0xf8) << 21);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 437 to 444
	value = ((uint32_t)(input[54] & 0x07) << 29) |
			((uint32_t)(input[55] & 0xf8) << 21);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 445 to 452
	value = ((uint32_t)(input[55] & 0x07) << 29) |
			((uint32_t)(input[56] & 0xf8) << 21);
	output[55] = (double)(value >> 24);
}

static void unpack_56_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 56 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 448 bits of data.
	// Input must be at least 57 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 333 to 340
	value = ((uint32_t)(input[41] & 0x07) << 29) |
			((uint32_t)(input[42] & 0xf8) << 21);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 341 to 348
	value = ((uint32_t)(input[42] & 0x07) << 29) |
			((uint32_t)(input[43] & 0xf8) << 21);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 349 to 356
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)(input[44] & 0xf8) << 21);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 357 to 364
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)(input[45] & 0xf8) << 21);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 365 to 372
	value = ((uint32_t)(input[45] & 0x07) << 29) |
			((uint32_t)(input[46] & 0xf8) << 21);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 373 to 380
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)(input[47] & 0xf8) << 21);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 381 to 388
	value = ((uint32_t)(input[47] & 0x07) << 29) |
			((uint32_t)(input[48] & 0xf8) << 21);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 389 to 396
	value = ((uint32_t)(input[48] & 0x07) << 29) |
			((uint32_t)(input[49] & 0xf8) << 21);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 397 to 404
	value = ((uint32_t)(input[49] & 0x07) << 29) |
			((uint32_t)(input[50] & 0xf8) << 21);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 405 to 412
	value = ((uint32_t)(input[50] & 0x07) << 29) |
			((uint32_t)(input[51] & 0xf8) << 21);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 413 to 420
	value = ((uint32_t)(input[51] & 0x07) << 29) |
			((uint32_t)(input[52] & 0xf8) << 21);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 421 to 428
	value = ((uint32_t)(input[52] & 0x07) << 29) |
			((uint32_t)(input[53] & 0xf8) << 21);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 429 to 436
	value = ((uint32_t)(input[53] & 0x07) << 29) |
			((uint32_t)(input[54] & 0xf8) << 21);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 437 to 444
	value = ((uint32_t)(input[54] & 0x07) << 29) |
			((uint32_t)(input[55] & 0xf8) << 21);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 445 to 452
	value = ((uint32_t)(input[55] & 0x07) << 29) |
			((uint32_t)(input[56] & 0xf8) << 21);
	output[55] = (double)(value >> 24);
}

static void unpack_56_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 56 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 448 bits of data.
	// Input must be at least 57 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 334 to 341
	value = ((uint32_t)(input[41] & 0x03) << 30) |
			((uint32_t)(input[42] & 0xfc) << 22);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 342 to 349
	value = ((uint32_t)(input[42] & 0x03) << 30) |
			((uint32_t)(input[43] & 0xfc) << 22);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 350 to 357
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)(input[44] & 0xfc) << 22);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 358 to 365
	value = ((uint32_t)(input[44] & 0x03) << 30) |
			((uint32_t)(input[45] & 0xfc) << 22);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 366 to 373
	value = ((uint32_t)(input[45] & 0x03) << 30) |
			((uint32_t)(input[46] & 0xfc) << 22);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 374 to 381
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)(input[47] & 0xfc) << 22);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 382 to 389
	value = ((uint32_t)(input[47] & 0x03) << 30) |
			((uint32_t)(input[48] & 0xfc) << 22);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 390 to 397
	value = ((uint32_t)(input[48] & 0x03) << 30) |
			((uint32_t)(input[49] & 0xfc) << 22);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 398 to 405
	value = ((uint32_t)(input[49] & 0x03) << 30) |
			((uint32_t)(input[50] & 0xfc) << 22);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 406 to 413
	value = ((uint32_t)(input[50] & 0x03) << 30) |
			((uint32_t)(input[51] & 0xfc) << 22);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 414 to 421
	value = ((uint32_t)(input[51] & 0x03) << 30) |
			((uint32_t)(input[52] & 0xfc) << 22);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 422 to 429
	value = ((uint32_t)(input[52] & 0x03) << 30) |
			((uint32_t)(input[53] & 0xfc) << 22);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 430 to 437
	value = ((uint32_t)(input[53] & 0x03) << 30) |
			((uint32_t)(input[54] & 0xfc) << 22);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 438 to 445
	value = ((uint32_t)(input[54] & 0x03) << 30) |
			((uint32_t)(input[55] & 0xfc) << 22);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 446 to 453
	value = ((uint32_t)(input[55] & 0x03) << 30) |
			((uint32_t)(input[56] & 0xfc) << 22);
	output[55] = (double)(value >> 24);
}

static void unpack_56_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 56 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 448 bits of data.
	// Input must be at least 57 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 334 to 341
	value = ((uint32_t)(input[41] & 0x03) << 30) |
			((uint32_t)(input[42] & 0xfc) << 22);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 342 to 349
	value = ((uint32_t)(input[42] & 0x03) << 30) |
			((uint32_t)(input[43] & 0xfc) << 22);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 350 to 357
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)(input[44] & 0xfc) << 22);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 358 to 365
	value = ((uint32_t)(input[44] & 0x03) << 30) |
			((uint32_t)(input[45] & 0xfc) << 22);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 366 to 373
	value = ((uint32_t)(input[45] & 0x03) << 30) |
			((uint32_t)(input[46] & 0xfc) << 22);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 374 to 381
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)(input[47] & 0xfc) << 22);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 382 to 389
	value = ((uint32_t)(input[47] & 0x03) << 30) |
			((uint32_t)(input[48] & 0xfc) << 22);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 390 to 397
	value = ((uint32_t)(input[48] & 0x03) << 30) |
			((uint32_t)(input[49] & 0xfc) << 22);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 398 to 405
	value = ((uint32_t)(input[49] & 0x03) << 30) |
			((uint32_t)(input[50] & 0xfc) << 22);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 406 to 413
	value = ((uint32_t)(input[50] & 0x03) << 30) |
			((uint32_t)(input[51] & 0xfc) << 22);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 414 to 421
	value = ((uint32_t)(input[51] & 0x03) << 30) |
			((uint32_t)(input[52] & 0xfc) << 22);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 422 to 429
	value = ((uint32_t)(input[52] & 0x03) << 30) |
			((uint32_t)(input[53] & 0xfc) << 22);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 430 to 437
	value = ((uint32_t)(input[53] & 0x03) << 30) |
			((uint32_t)(input[54] & 0xfc) << 22);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 438 to 445
	value = ((uint32_t)(input[54] & 0x03) << 30) |
			((uint32_t)(input[55] & 0xfc) << 22);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 446 to 453
	value = ((uint32_t)(input[55] & 0x03) << 30) |
			((uint32_t)(input[56] & 0xfc) << 22);
	output[55] = (double)(value >> 24);
}

static void unpack_56_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 56 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 448 bits of data.
	// Input must be at least 57 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 335 to 342
	value = ((uint32_t)(input[41] & 0x01) << 31) |
			((uint32_t)(input[42] & 0xfe) << 23);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 343 to 350
	value = ((uint32_t)(input[42] & 0x01) << 31) |
			((uint32_t)(input[43] & 0xfe) << 23);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 351 to 358
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)(input[44] & 0xfe) << 23);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 359 to 366
	value = ((uint32_t)(input[44] & 0x01) << 31) |
			((uint32_t)(input[45] & 0xfe) << 23);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 367 to 374
	value = ((uint32_t)(input[45] & 0x01) << 31) |
			((uint32_t)(input[46] & 0xfe) << 23);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 375 to 382
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)(input[47] & 0xfe) << 23);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 383 to 390
	value = ((uint32_t)(input[47] & 0x01) << 31) |
			((uint32_t)(input[48] & 0xfe) << 23);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 391 to 398
	value = ((uint32_t)(input[48] & 0x01) << 31) |
			((uint32_t)(input[49] & 0xfe) << 23);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 399 to 406
	value = ((uint32_t)(input[49] & 0x01) << 31) |
			((uint32_t)(input[50] & 0xfe) << 23);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 407 to 414
	value = ((uint32_t)(input[50] & 0x01) << 31) |
			((uint32_t)(input[51] & 0xfe) << 23);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 415 to 422
	value = ((uint32_t)(input[51] & 0x01) << 31) |
			((uint32_t)(input[52] & 0xfe) << 23);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 423 to 430
	value = ((uint32_t)(input[52] & 0x01) << 31) |
			((uint32_t)(input[53] & 0xfe) << 23);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 431 to 438
	value = ((uint32_t)(input[53] & 0x01) << 31) |
			((uint32_t)(input[54] & 0xfe) << 23);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 439 to 446
	value = ((uint32_t)(input[54] & 0x01) << 31) |
			((uint32_t)(input[55] & 0xfe) << 23);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 447 to 454
	value = ((uint32_t)(input[55] & 0x01) << 31) |
			((uint32_t)(input[56] & 0xfe) << 23);
	output[55] = (double)(value >> 24);
}

static void unpack_56_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 56 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 448 bits of data.
	// Input must be at least 57 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 335 to 342
	value = ((uint32_t)(input[41] & 0x01) << 31) |
			((uint32_t)(input[42] & 0xfe) << 23);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 343 to 350
	value = ((uint32_t)(input[42] & 0x01) << 31) |
			((uint32_t)(input[43] & 0xfe) << 23);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 351 to 358
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)(input[44] & 0xfe) << 23);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 359 to 366
	value = ((uint32_t)(input[44] & 0x01) << 31) |
			((uint32_t)(input[45] & 0xfe) << 23);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 367 to 374
	value = ((uint32_t)(input[45] & 0x01) << 31) |
			((uint32_t)(input[46] & 0xfe) << 23);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 375 to 382
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)(input[47] & 0xfe) << 23);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 383 to 390
	value = ((uint32_t)(input[47] & 0x01) << 31) |
			((uint32_t)(input[48] & 0xfe) << 23);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 391 to 398
	value = ((uint32_t)(input[48] & 0x01) << 31) |
			((uint32_t)(input[49] & 0xfe) << 23);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 399 to 406
	value = ((uint32_t)(input[49] & 0x01) << 31) |
			((uint32_t)(input[50] & 0xfe) << 23);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 407 to 414
	value = ((uint32_t)(input[50] & 0x01) << 31) |
			((uint32_t)(input[51] & 0xfe) << 23);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 415 to 422
	value = ((uint32_t)(input[51] & 0x01) << 31) |
			((uint32_t)(input[52] & 0xfe) << 23);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 423 to 430
	value = ((uint32_t)(input[52] & 0x01) << 31) |
			((uint32_t)(input[53] & 0xfe) << 23);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 431 to 438
	value = ((uint32_t)(input[53] & 0x01) << 31) |
			((uint32_t)(input[54] & 0xfe) << 23);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 439 to 446
	value = ((uint32_t)(input[54] & 0x01) << 31) |
			((uint32_t)(input[55] & 0xfe) << 23);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 447 to 454
	value = ((uint32_t)(input[55] & 0x01) << 31) |
			((uint32_t)(input[56] & 0xfe) << 23);
	output[55] = (double)(value >> 24);
}

static void unpack_57_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 57 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 456 bits of data.
	// Input must be at least 57 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 328 to 335
	value = ((uint32_t)input[41] << 24);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 336 to 343
	value = ((uint32_t)input[42] << 24);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 344 to 351
	value = ((uint32_t)input[43] << 24);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 352 to 359
	value = ((uint32_t)input[44] << 24);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 360 to 367
	value = ((uint32_t)input[45] << 24);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 368 to 375
	value = ((uint32_t)input[46] << 24);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 376 to 383
	value = ((uint32_t)input[47] << 24);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 384 to 391
	value = ((uint32_t)input[48] << 24);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 392 to 399
	value = ((uint32_t)input[49] << 24);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 400 to 407
	value = ((uint32_t)input[50] << 24);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 408 to 415
	value = ((uint32_t)input[51] << 24);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 416 to 423
	value = ((uint32_t)input[52] << 24);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 424 to 431
	value = ((uint32_t)input[53] << 24);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 432 to 439
	value = ((uint32_t)input[54] << 24);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 440 to 447
	value = ((uint32_t)input[55] << 24);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 448 to 455
	value = ((uint32_t)input[56] << 24);
	output[56] = (double)(value >> 24);
}

static void unpack_57_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 57 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 456 bits of data.
	// Input must be at least 57 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 328 to 335
	value = ((uint32_t)input[41] << 24);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 336 to 343
	value = ((uint32_t)input[42] << 24);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 344 to 351
	value = ((uint32_t)input[43] << 24);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 352 to 359
	value = ((uint32_t)input[44] << 24);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 360 to 367
	value = ((uint32_t)input[45] << 24);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 368 to 375
	value = ((uint32_t)input[46] << 24);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 376 to 383
	value = ((uint32_t)input[47] << 24);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 384 to 391
	value = ((uint32_t)input[48] << 24);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 392 to 399
	value = ((uint32_t)input[49] << 24);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 400 to 407
	value = ((uint32_t)input[50] << 24);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 408 to 415
	value = ((uint32_t)input[51] << 24);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 416 to 423
	value = ((uint32_t)input[52] << 24);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 424 to 431
	value = ((uint32_t)input[53] << 24);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 432 to 439
	value = ((uint32_t)input[54] << 24);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 440 to 447
	value = ((uint32_t)input[55] << 24);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 448 to 455
	value = ((uint32_t)input[56] << 24);
	output[56] = (double)(value >> 24);
}

static void unpack_57_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 57 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 456 bits of data.
	// Input must be at least 58 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 329 to 336
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)(input[42] & 0x80) << 17);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 337 to 344
	value = ((uint32_t)(input[42] & 0x7f) << 25) |
			((uint32_t)(input[43] & 0x80) << 17);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 345 to 352
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)(input[44] & 0x80) << 17);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 353 to 360
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)(input[45] & 0x80) << 17);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 361 to 368
	value = ((uint32_t)(input[45] & 0x7f) << 25) |
			((uint32_t)(input[46] & 0x80) << 17);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 369 to 376
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)(input[47] & 0x80) << 17);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 377 to 384
	value = ((uint32_t)(input[47] & 0x7f) << 25) |
			((uint32_t)(input[48] & 0x80) << 17);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 385 to 392
	value = ((uint32_t)(input[48] & 0x7f) << 25) |
			((uint32_t)(input[49] & 0x80) << 17);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 393 to 400
	value = ((uint32_t)(input[49] & 0x7f) << 25) |
			((uint32_t)(input[50] & 0x80) << 17);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 401 to 408
	value = ((uint32_t)(input[50] & 0x7f) << 25) |
			((uint32_t)(input[51] & 0x80) << 17);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 409 to 416
	value = ((uint32_t)(input[51] & 0x7f) << 25) |
			((uint32_t)(input[52] & 0x80) << 17);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 417 to 424
	value = ((uint32_t)(input[52] & 0x7f) << 25) |
			((uint32_t)(input[53] & 0x80) << 17);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 425 to 432
	value = ((uint32_t)(input[53] & 0x7f) << 25) |
			((uint32_t)(input[54] & 0x80) << 17);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 433 to 440
	value = ((uint32_t)(input[54] & 0x7f) << 25) |
			((uint32_t)(input[55] & 0x80) << 17);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 441 to 448
	value = ((uint32_t)(input[55] & 0x7f) << 25) |
			((uint32_t)(input[56] & 0x80) << 17);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 449 to 456
	value = ((uint32_t)(input[56] & 0x7f) << 25) |
			((uint32_t)(input[57] & 0x80) << 17);
	output[56] = (double)(value >> 24);
}

static void unpack_57_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 57 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 456 bits of data.
	// Input must be at least 58 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 329 to 336
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)(input[42] & 0x80) << 17);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 337 to 344
	value = ((uint32_t)(input[42] & 0x7f) << 25) |
			((uint32_t)(input[43] & 0x80) << 17);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 345 to 352
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)(input[44] & 0x80) << 17);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 353 to 360
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)(input[45] & 0x80) << 17);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 361 to 368
	value = ((uint32_t)(input[45] & 0x7f) << 25) |
			((uint32_t)(input[46] & 0x80) << 17);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 369 to 376
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)(input[47] & 0x80) << 17);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 377 to 384
	value = ((uint32_t)(input[47] & 0x7f) << 25) |
			((uint32_t)(input[48] & 0x80) << 17);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 385 to 392
	value = ((uint32_t)(input[48] & 0x7f) << 25) |
			((uint32_t)(input[49] & 0x80) << 17);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 393 to 400
	value = ((uint32_t)(input[49] & 0x7f) << 25) |
			((uint32_t)(input[50] & 0x80) << 17);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 401 to 408
	value = ((uint32_t)(input[50] & 0x7f) << 25) |
			((uint32_t)(input[51] & 0x80) << 17);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 409 to 416
	value = ((uint32_t)(input[51] & 0x7f) << 25) |
			((uint32_t)(input[52] & 0x80) << 17);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 417 to 424
	value = ((uint32_t)(input[52] & 0x7f) << 25) |
			((uint32_t)(input[53] & 0x80) << 17);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 425 to 432
	value = ((uint32_t)(input[53] & 0x7f) << 25) |
			((uint32_t)(input[54] & 0x80) << 17);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 433 to 440
	value = ((uint32_t)(input[54] & 0x7f) << 25) |
			((uint32_t)(input[55] & 0x80) << 17);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 441 to 448
	value = ((uint32_t)(input[55] & 0x7f) << 25) |
			((uint32_t)(input[56] & 0x80) << 17);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 449 to 456
	value = ((uint32_t)(input[56] & 0x7f) << 25) |
			((uint32_t)(input[57] & 0x80) << 17);
	output[56] = (double)(value >> 24);
}

static void unpack_57_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 57 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 456 bits of data.
	// Input must be at least 58 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 330 to 337
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)(input[42] & 0xc0) << 18);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 338 to 345
	value = ((uint32_t)(input[42] & 0x3f) << 26) |
			((uint32_t)(input[43] & 0xc0) << 18);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 346 to 353
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)(input[44] & 0xc0) << 18);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 354 to 361
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)(input[45] & 0xc0) << 18);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 362 to 369
	value = ((uint32_t)(input[45] & 0x3f) << 26) |
			((uint32_t)(input[46] & 0xc0) << 18);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 370 to 377
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)(input[47] & 0xc0) << 18);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 378 to 385
	value = ((uint32_t)(input[47] & 0x3f) << 26) |
			((uint32_t)(input[48] & 0xc0) << 18);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 386 to 393
	value = ((uint32_t)(input[48] & 0x3f) << 26) |
			((uint32_t)(input[49] & 0xc0) << 18);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 394 to 401
	value = ((uint32_t)(input[49] & 0x3f) << 26) |
			((uint32_t)(input[50] & 0xc0) << 18);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 402 to 409
	value = ((uint32_t)(input[50] & 0x3f) << 26) |
			((uint32_t)(input[51] & 0xc0) << 18);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 410 to 417
	value = ((uint32_t)(input[51] & 0x3f) << 26) |
			((uint32_t)(input[52] & 0xc0) << 18);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 418 to 425
	value = ((uint32_t)(input[52] & 0x3f) << 26) |
			((uint32_t)(input[53] & 0xc0) << 18);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 426 to 433
	value = ((uint32_t)(input[53] & 0x3f) << 26) |
			((uint32_t)(input[54] & 0xc0) << 18);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 434 to 441
	value = ((uint32_t)(input[54] & 0x3f) << 26) |
			((uint32_t)(input[55] & 0xc0) << 18);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 442 to 449
	value = ((uint32_t)(input[55] & 0x3f) << 26) |
			((uint32_t)(input[56] & 0xc0) << 18);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 450 to 457
	value = ((uint32_t)(input[56] & 0x3f) << 26) |
			((uint32_t)(input[57] & 0xc0) << 18);
	output[56] = (double)(value >> 24);
}

static void unpack_57_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 57 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 456 bits of data.
	// Input must be at least 58 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 330 to 337
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)(input[42] & 0xc0) << 18);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 338 to 345
	value = ((uint32_t)(input[42] & 0x3f) << 26) |
			((uint32_t)(input[43] & 0xc0) << 18);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 346 to 353
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)(input[44] & 0xc0) << 18);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 354 to 361
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)(input[45] & 0xc0) << 18);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 362 to 369
	value = ((uint32_t)(input[45] & 0x3f) << 26) |
			((uint32_t)(input[46] & 0xc0) << 18);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 370 to 377
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)(input[47] & 0xc0) << 18);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 378 to 385
	value = ((uint32_t)(input[47] & 0x3f) << 26) |
			((uint32_t)(input[48] & 0xc0) << 18);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 386 to 393
	value = ((uint32_t)(input[48] & 0x3f) << 26) |
			((uint32_t)(input[49] & 0xc0) << 18);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 394 to 401
	value = ((uint32_t)(input[49] & 0x3f) << 26) |
			((uint32_t)(input[50] & 0xc0) << 18);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 402 to 409
	value = ((uint32_t)(input[50] & 0x3f) << 26) |
			((uint32_t)(input[51] & 0xc0) << 18);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 410 to 417
	value = ((uint32_t)(input[51] & 0x3f) << 26) |
			((uint32_t)(input[52] & 0xc0) << 18);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 418 to 425
	value = ((uint32_t)(input[52] & 0x3f) << 26) |
			((uint32_t)(input[53] & 0xc0) << 18);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 426 to 433
	value = ((uint32_t)(input[53] & 0x3f) << 26) |
			((uint32_t)(input[54] & 0xc0) << 18);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 434 to 441
	value = ((uint32_t)(input[54] & 0x3f) << 26) |
			((uint32_t)(input[55] & 0xc0) << 18);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 442 to 449
	value = ((uint32_t)(input[55] & 0x3f) << 26) |
			((uint32_t)(input[56] & 0xc0) << 18);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 450 to 457
	value = ((uint32_t)(input[56] & 0x3f) << 26) |
			((uint32_t)(input[57] & 0xc0) << 18);
	output[56] = (double)(value >> 24);
}

static void unpack_57_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 57 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 456 bits of data.
	// Input must be at least 58 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 331 to 338
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)(input[42] & 0xe0) << 19);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 339 to 346
	value = ((uint32_t)(input[42] & 0x1f) << 27) |
			((uint32_t)(input[43] & 0xe0) << 19);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 347 to 354
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)(input[44] & 0xe0) << 19);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 355 to 362
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)(input[45] & 0xe0) << 19);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 363 to 370
	value = ((uint32_t)(input[45] & 0x1f) << 27) |
			((uint32_t)(input[46] & 0xe0) << 19);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 371 to 378
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)(input[47] & 0xe0) << 19);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 379 to 386
	value = ((uint32_t)(input[47] & 0x1f) << 27) |
			((uint32_t)(input[48] & 0xe0) << 19);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 387 to 394
	value = ((uint32_t)(input[48] & 0x1f) << 27) |
			((uint32_t)(input[49] & 0xe0) << 19);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 395 to 402
	value = ((uint32_t)(input[49] & 0x1f) << 27) |
			((uint32_t)(input[50] & 0xe0) << 19);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 403 to 410
	value = ((uint32_t)(input[50] & 0x1f) << 27) |
			((uint32_t)(input[51] & 0xe0) << 19);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 411 to 418
	value = ((uint32_t)(input[51] & 0x1f) << 27) |
			((uint32_t)(input[52] & 0xe0) << 19);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 419 to 426
	value = ((uint32_t)(input[52] & 0x1f) << 27) |
			((uint32_t)(input[53] & 0xe0) << 19);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 427 to 434
	value = ((uint32_t)(input[53] & 0x1f) << 27) |
			((uint32_t)(input[54] & 0xe0) << 19);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 435 to 442
	value = ((uint32_t)(input[54] & 0x1f) << 27) |
			((uint32_t)(input[55] & 0xe0) << 19);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 443 to 450
	value = ((uint32_t)(input[55] & 0x1f) << 27) |
			((uint32_t)(input[56] & 0xe0) << 19);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 451 to 458
	value = ((uint32_t)(input[56] & 0x1f) << 27) |
			((uint32_t)(input[57] & 0xe0) << 19);
	output[56] = (double)(value >> 24);
}

static void unpack_57_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 57 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 456 bits of data.
	// Input must be at least 58 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 331 to 338
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)(input[42] & 0xe0) << 19);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 339 to 346
	value = ((uint32_t)(input[42] & 0x1f) << 27) |
			((uint32_t)(input[43] & 0xe0) << 19);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 347 to 354
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)(input[44] & 0xe0) << 19);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 355 to 362
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)(input[45] & 0xe0) << 19);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 363 to 370
	value = ((uint32_t)(input[45] & 0x1f) << 27) |
			((uint32_t)(input[46] & 0xe0) << 19);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 371 to 378
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)(input[47] & 0xe0) << 19);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 379 to 386
	value = ((uint32_t)(input[47] & 0x1f) << 27) |
			((uint32_t)(input[48] & 0xe0) << 19);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 387 to 394
	value = ((uint32_t)(input[48] & 0x1f) << 27) |
			((uint32_t)(input[49] & 0xe0) << 19);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 395 to 402
	value = ((uint32_t)(input[49] & 0x1f) << 27) |
			((uint32_t)(input[50] & 0xe0) << 19);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 403 to 410
	value = ((uint32_t)(input[50] & 0x1f) << 27) |
			((uint32_t)(input[51] & 0xe0) << 19);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 411 to 418
	value = ((uint32_t)(input[51] & 0x1f) << 27) |
			((uint32_t)(input[52] & 0xe0) << 19);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 419 to 426
	value = ((uint32_t)(input[52] & 0x1f) << 27) |
			((uint32_t)(input[53] & 0xe0) << 19);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 427 to 434
	value = ((uint32_t)(input[53] & 0x1f) << 27) |
			((uint32_t)(input[54] & 0xe0) << 19);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 435 to 442
	value = ((uint32_t)(input[54] & 0x1f) << 27) |
			((uint32_t)(input[55] & 0xe0) << 19);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 443 to 450
	value = ((uint32_t)(input[55] & 0x1f) << 27) |
			((uint32_t)(input[56] & 0xe0) << 19);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 451 to 458
	value = ((uint32_t)(input[56] & 0x1f) << 27) |
			((uint32_t)(input[57] & 0xe0) << 19);
	output[56] = (double)(value >> 24);
}

static void unpack_57_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 57 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 456 bits of data.
	// Input must be at least 58 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 332 to 339
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)(input[42] & 0xf0) << 20);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 340 to 347
	value = ((uint32_t)(input[42] & 0x0f) << 28) |
			((uint32_t)(input[43] & 0xf0) << 20);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 348 to 355
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)(input[44] & 0xf0) << 20);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 356 to 363
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)(input[45] & 0xf0) << 20);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 364 to 371
	value = ((uint32_t)(input[45] & 0x0f) << 28) |
			((uint32_t)(input[46] & 0xf0) << 20);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 372 to 379
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)(input[47] & 0xf0) << 20);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 380 to 387
	value = ((uint32_t)(input[47] & 0x0f) << 28) |
			((uint32_t)(input[48] & 0xf0) << 20);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 388 to 395
	value = ((uint32_t)(input[48] & 0x0f) << 28) |
			((uint32_t)(input[49] & 0xf0) << 20);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 396 to 403
	value = ((uint32_t)(input[49] & 0x0f) << 28) |
			((uint32_t)(input[50] & 0xf0) << 20);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 404 to 411
	value = ((uint32_t)(input[50] & 0x0f) << 28) |
			((uint32_t)(input[51] & 0xf0) << 20);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 412 to 419
	value = ((uint32_t)(input[51] & 0x0f) << 28) |
			((uint32_t)(input[52] & 0xf0) << 20);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 420 to 427
	value = ((uint32_t)(input[52] & 0x0f) << 28) |
			((uint32_t)(input[53] & 0xf0) << 20);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 428 to 435
	value = ((uint32_t)(input[53] & 0x0f) << 28) |
			((uint32_t)(input[54] & 0xf0) << 20);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 436 to 443
	value = ((uint32_t)(input[54] & 0x0f) << 28) |
			((uint32_t)(input[55] & 0xf0) << 20);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 444 to 451
	value = ((uint32_t)(input[55] & 0x0f) << 28) |
			((uint32_t)(input[56] & 0xf0) << 20);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 452 to 459
	value = ((uint32_t)(input[56] & 0x0f) << 28) |
			((uint32_t)(input[57] & 0xf0) << 20);
	output[56] = (double)(value >> 24);
}

static void unpack_57_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 57 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 456 bits of data.
	// Input must be at least 58 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 332 to 339
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)(input[42] & 0xf0) << 20);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 340 to 347
	value = ((uint32_t)(input[42] & 0x0f) << 28) |
			((uint32_t)(input[43] & 0xf0) << 20);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 348 to 355
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)(input[44] & 0xf0) << 20);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 356 to 363
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)(input[45] & 0xf0) << 20);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 364 to 371
	value = ((uint32_t)(input[45] & 0x0f) << 28) |
			((uint32_t)(input[46] & 0xf0) << 20);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 372 to 379
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)(input[47] & 0xf0) << 20);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 380 to 387
	value = ((uint32_t)(input[47] & 0x0f) << 28) |
			((uint32_t)(input[48] & 0xf0) << 20);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 388 to 395
	value = ((uint32_t)(input[48] & 0x0f) << 28) |
			((uint32_t)(input[49] & 0xf0) << 20);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 396 to 403
	value = ((uint32_t)(input[49] & 0x0f) << 28) |
			((uint32_t)(input[50] & 0xf0) << 20);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 404 to 411
	value = ((uint32_t)(input[50] & 0x0f) << 28) |
			((uint32_t)(input[51] & 0xf0) << 20);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 412 to 419
	value = ((uint32_t)(input[51] & 0x0f) << 28) |
			((uint32_t)(input[52] & 0xf0) << 20);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 420 to 427
	value = ((uint32_t)(input[52] & 0x0f) << 28) |
			((uint32_t)(input[53] & 0xf0) << 20);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 428 to 435
	value = ((uint32_t)(input[53] & 0x0f) << 28) |
			((uint32_t)(input[54] & 0xf0) << 20);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 436 to 443
	value = ((uint32_t)(input[54] & 0x0f) << 28) |
			((uint32_t)(input[55] & 0xf0) << 20);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 444 to 451
	value = ((uint32_t)(input[55] & 0x0f) << 28) |
			((uint32_t)(input[56] & 0xf0) << 20);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 452 to 459
	value = ((uint32_t)(input[56] & 0x0f) << 28) |
			((uint32_t)(input[57] & 0xf0) << 20);
	output[56] = (double)(value >> 24);
}

static void unpack_57_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 57 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 456 bits of data.
	// Input must be at least 58 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 333 to 340
	value = ((uint32_t)(input[41] & 0x07) << 29) |
			((uint32_t)(input[42] & 0xf8) << 21);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 341 to 348
	value = ((uint32_t)(input[42] & 0x07) << 29) |
			((uint32_t)(input[43] & 0xf8) << 21);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 349 to 356
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)(input[44] & 0xf8) << 21);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 357 to 364
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)(input[45] & 0xf8) << 21);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 365 to 372
	value = ((uint32_t)(input[45] & 0x07) << 29) |
			((uint32_t)(input[46] & 0xf8) << 21);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 373 to 380
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)(input[47] & 0xf8) << 21);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 381 to 388
	value = ((uint32_t)(input[47] & 0x07) << 29) |
			((uint32_t)(input[48] & 0xf8) << 21);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 389 to 396
	value = ((uint32_t)(input[48] & 0x07) << 29) |
			((uint32_t)(input[49] & 0xf8) << 21);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 397 to 404
	value = ((uint32_t)(input[49] & 0x07) << 29) |
			((uint32_t)(input[50] & 0xf8) << 21);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 405 to 412
	value = ((uint32_t)(input[50] & 0x07) << 29) |
			((uint32_t)(input[51] & 0xf8) << 21);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 413 to 420
	value = ((uint32_t)(input[51] & 0x07) << 29) |
			((uint32_t)(input[52] & 0xf8) << 21);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 421 to 428
	value = ((uint32_t)(input[52] & 0x07) << 29) |
			((uint32_t)(input[53] & 0xf8) << 21);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 429 to 436
	value = ((uint32_t)(input[53] & 0x07) << 29) |
			((uint32_t)(input[54] & 0xf8) << 21);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 437 to 444
	value = ((uint32_t)(input[54] & 0x07) << 29) |
			((uint32_t)(input[55] & 0xf8) << 21);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 445 to 452
	value = ((uint32_t)(input[55] & 0x07) << 29) |
			((uint32_t)(input[56] & 0xf8) << 21);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 453 to 460
	value = ((uint32_t)(input[56] & 0x07) << 29) |
			((uint32_t)(input[57] & 0xf8) << 21);
	output[56] = (double)(value >> 24);
}

static void unpack_57_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 57 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 456 bits of data.
	// Input must be at least 58 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 333 to 340
	value = ((uint32_t)(input[41] & 0x07) << 29) |
			((uint32_t)(input[42] & 0xf8) << 21);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 341 to 348
	value = ((uint32_t)(input[42] & 0x07) << 29) |
			((uint32_t)(input[43] & 0xf8) << 21);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 349 to 356
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)(input[44] & 0xf8) << 21);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 357 to 364
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)(input[45] & 0xf8) << 21);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 365 to 372
	value = ((uint32_t)(input[45] & 0x07) << 29) |
			((uint32_t)(input[46] & 0xf8) << 21);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 373 to 380
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)(input[47] & 0xf8) << 21);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 381 to 388
	value = ((uint32_t)(input[47] & 0x07) << 29) |
			((uint32_t)(input[48] & 0xf8) << 21);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 389 to 396
	value = ((uint32_t)(input[48] & 0x07) << 29) |
			((uint32_t)(input[49] & 0xf8) << 21);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 397 to 404
	value = ((uint32_t)(input[49] & 0x07) << 29) |
			((uint32_t)(input[50] & 0xf8) << 21);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 405 to 412
	value = ((uint32_t)(input[50] & 0x07) << 29) |
			((uint32_t)(input[51] & 0xf8) << 21);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 413 to 420
	value = ((uint32_t)(input[51] & 0x07) << 29) |
			((uint32_t)(input[52] & 0xf8) << 21);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 421 to 428
	value = ((uint32_t)(input[52] & 0x07) << 29) |
			((uint32_t)(input[53] & 0xf8) << 21);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 429 to 436
	value = ((uint32_t)(input[53] & 0x07) << 29) |
			((uint32_t)(input[54] & 0xf8) << 21);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 437 to 444
	value = ((uint32_t)(input[54] & 0x07) << 29) |
			((uint32_t)(input[55] & 0xf8) << 21);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 445 to 452
	value = ((uint32_t)(input[55] & 0x07) << 29) |
			((uint32_t)(input[56] & 0xf8) << 21);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 453 to 460
	value = ((uint32_t)(input[56] & 0x07) << 29) |
			((uint32_t)(input[57] & 0xf8) << 21);
	output[56] = (double)(value >> 24);
}

static void unpack_57_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 57 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 456 bits of data.
	// Input must be at least 58 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 334 to 341
	value = ((uint32_t)(input[41] & 0x03) << 30) |
			((uint32_t)(input[42] & 0xfc) << 22);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 342 to 349
	value = ((uint32_t)(input[42] & 0x03) << 30) |
			((uint32_t)(input[43] & 0xfc) << 22);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 350 to 357
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)(input[44] & 0xfc) << 22);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 358 to 365
	value = ((uint32_t)(input[44] & 0x03) << 30) |
			((uint32_t)(input[45] & 0xfc) << 22);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 366 to 373
	value = ((uint32_t)(input[45] & 0x03) << 30) |
			((uint32_t)(input[46] & 0xfc) << 22);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 374 to 381
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)(input[47] & 0xfc) << 22);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 382 to 389
	value = ((uint32_t)(input[47] & 0x03) << 30) |
			((uint32_t)(input[48] & 0xfc) << 22);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 390 to 397
	value = ((uint32_t)(input[48] & 0x03) << 30) |
			((uint32_t)(input[49] & 0xfc) << 22);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 398 to 405
	value = ((uint32_t)(input[49] & 0x03) << 30) |
			((uint32_t)(input[50] & 0xfc) << 22);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 406 to 413
	value = ((uint32_t)(input[50] & 0x03) << 30) |
			((uint32_t)(input[51] & 0xfc) << 22);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 414 to 421
	value = ((uint32_t)(input[51] & 0x03) << 30) |
			((uint32_t)(input[52] & 0xfc) << 22);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 422 to 429
	value = ((uint32_t)(input[52] & 0x03) << 30) |
			((uint32_t)(input[53] & 0xfc) << 22);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 430 to 437
	value = ((uint32_t)(input[53] & 0x03) << 30) |
			((uint32_t)(input[54] & 0xfc) << 22);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 438 to 445
	value = ((uint32_t)(input[54] & 0x03) << 30) |
			((uint32_t)(input[55] & 0xfc) << 22);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 446 to 453
	value = ((uint32_t)(input[55] & 0x03) << 30) |
			((uint32_t)(input[56] & 0xfc) << 22);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 454 to 461
	value = ((uint32_t)(input[56] & 0x03) << 30) |
			((uint32_t)(input[57] & 0xfc) << 22);
	output[56] = (double)(value >> 24);
}

static void unpack_57_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 57 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 456 bits of data.
	// Input must be at least 58 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 334 to 341
	value = ((uint32_t)(input[41] & 0x03) << 30) |
			((uint32_t)(input[42] & 0xfc) << 22);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 342 to 349
	value = ((uint32_t)(input[42] & 0x03) << 30) |
			((uint32_t)(input[43] & 0xfc) << 22);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 350 to 357
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)(input[44] & 0xfc) << 22);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 358 to 365
	value = ((uint32_t)(input[44] & 0x03) << 30) |
			((uint32_t)(input[45] & 0xfc) << 22);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 366 to 373
	value = ((uint32_t)(input[45] & 0x03) << 30) |
			((uint32_t)(input[46] & 0xfc) << 22);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 374 to 381
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)(input[47] & 0xfc) << 22);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 382 to 389
	value = ((uint32_t)(input[47] & 0x03) << 30) |
			((uint32_t)(input[48] & 0xfc) << 22);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 390 to 397
	value = ((uint32_t)(input[48] & 0x03) << 30) |
			((uint32_t)(input[49] & 0xfc) << 22);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 398 to 405
	value = ((uint32_t)(input[49] & 0x03) << 30) |
			((uint32_t)(input[50] & 0xfc) << 22);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 406 to 413
	value = ((uint32_t)(input[50] & 0x03) << 30) |
			((uint32_t)(input[51] & 0xfc) << 22);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 414 to 421
	value = ((uint32_t)(input[51] & 0x03) << 30) |
			((uint32_t)(input[52] & 0xfc) << 22);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 422 to 429
	value = ((uint32_t)(input[52] & 0x03) << 30) |
			((uint32_t)(input[53] & 0xfc) << 22);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 430 to 437
	value = ((uint32_t)(input[53] & 0x03) << 30) |
			((uint32_t)(input[54] & 0xfc) << 22);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 438 to 445
	value = ((uint32_t)(input[54] & 0x03) << 30) |
			((uint32_t)(input[55] & 0xfc) << 22);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 446 to 453
	value = ((uint32_t)(input[55] & 0x03) << 30) |
			((uint32_t)(input[56] & 0xfc) << 22);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 454 to 461
	value = ((uint32_t)(input[56] & 0x03) << 30) |
			((uint32_t)(input[57] & 0xfc) << 22);
	output[56] = (double)(value >> 24);
}

static void unpack_57_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 57 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 456 bits of data.
	// Input must be at least 58 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 335 to 342
	value = ((uint32_t)(input[41] & 0x01) << 31) |
			((uint32_t)(input[42] & 0xfe) << 23);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 343 to 350
	value = ((uint32_t)(input[42] & 0x01) << 31) |
			((uint32_t)(input[43] & 0xfe) << 23);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 351 to 358
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)(input[44] & 0xfe) << 23);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 359 to 366
	value = ((uint32_t)(input[44] & 0x01) << 31) |
			((uint32_t)(input[45] & 0xfe) << 23);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 367 to 374
	value = ((uint32_t)(input[45] & 0x01) << 31) |
			((uint32_t)(input[46] & 0xfe) << 23);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 375 to 382
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)(input[47] & 0xfe) << 23);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 383 to 390
	value = ((uint32_t)(input[47] & 0x01) << 31) |
			((uint32_t)(input[48] & 0xfe) << 23);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 391 to 398
	value = ((uint32_t)(input[48] & 0x01) << 31) |
			((uint32_t)(input[49] & 0xfe) << 23);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 399 to 406
	value = ((uint32_t)(input[49] & 0x01) << 31) |
			((uint32_t)(input[50] & 0xfe) << 23);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 407 to 414
	value = ((uint32_t)(input[50] & 0x01) << 31) |
			((uint32_t)(input[51] & 0xfe) << 23);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 415 to 422
	value = ((uint32_t)(input[51] & 0x01) << 31) |
			((uint32_t)(input[52] & 0xfe) << 23);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 423 to 430
	value = ((uint32_t)(input[52] & 0x01) << 31) |
			((uint32_t)(input[53] & 0xfe) << 23);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 431 to 438
	value = ((uint32_t)(input[53] & 0x01) << 31) |
			((uint32_t)(input[54] & 0xfe) << 23);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 439 to 446
	value = ((uint32_t)(input[54] & 0x01) << 31) |
			((uint32_t)(input[55] & 0xfe) << 23);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 447 to 454
	value = ((uint32_t)(input[55] & 0x01) << 31) |
			((uint32_t)(input[56] & 0xfe) << 23);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 455 to 462
	value = ((uint32_t)(input[56] & 0x01) << 31) |
			((uint32_t)(input[57] & 0xfe) << 23);
	output[56] = (double)(value >> 24);
}

static void unpack_57_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 57 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 456 bits of data.
	// Input must be at least 58 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 335 to 342
	value = ((uint32_t)(input[41] & 0x01) << 31) |
			((uint32_t)(input[42] & 0xfe) << 23);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 343 to 350
	value = ((uint32_t)(input[42] & 0x01) << 31) |
			((uint32_t)(input[43] & 0xfe) << 23);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 351 to 358
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)(input[44] & 0xfe) << 23);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 359 to 366
	value = ((uint32_t)(input[44] & 0x01) << 31) |
			((uint32_t)(input[45] & 0xfe) << 23);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 367 to 374
	value = ((uint32_t)(input[45] & 0x01) << 31) |
			((uint32_t)(input[46] & 0xfe) << 23);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 375 to 382
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)(input[47] & 0xfe) << 23);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 383 to 390
	value = ((uint32_t)(input[47] & 0x01) << 31) |
			((uint32_t)(input[48] & 0xfe) << 23);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 391 to 398
	value = ((uint32_t)(input[48] & 0x01) << 31) |
			((uint32_t)(input[49] & 0xfe) << 23);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 399 to 406
	value = ((uint32_t)(input[49] & 0x01) << 31) |
			((uint32_t)(input[50] & 0xfe) << 23);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 407 to 414
	value = ((uint32_t)(input[50] & 0x01) << 31) |
			((uint32_t)(input[51] & 0xfe) << 23);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 415 to 422
	value = ((uint32_t)(input[51] & 0x01) << 31) |
			((uint32_t)(input[52] & 0xfe) << 23);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 423 to 430
	value = ((uint32_t)(input[52] & 0x01) << 31) |
			((uint32_t)(input[53] & 0xfe) << 23);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 431 to 438
	value = ((uint32_t)(input[53] & 0x01) << 31) |
			((uint32_t)(input[54] & 0xfe) << 23);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 439 to 446
	value = ((uint32_t)(input[54] & 0x01) << 31) |
			((uint32_t)(input[55] & 0xfe) << 23);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 447 to 454
	value = ((uint32_t)(input[55] & 0x01) << 31) |
			((uint32_t)(input[56] & 0xfe) << 23);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 455 to 462
	value = ((uint32_t)(input[56] & 0x01) << 31) |
			((uint32_t)(input[57] & 0xfe) << 23);
	output[56] = (double)(value >> 24);
}

static void unpack_58_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 58 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 464 bits of data.
	// Input must be at least 58 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 328 to 335
	value = ((uint32_t)input[41] << 24);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 336 to 343
	value = ((uint32_t)input[42] << 24);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 344 to 351
	value = ((uint32_t)input[43] << 24);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 352 to 359
	value = ((uint32_t)input[44] << 24);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 360 to 367
	value = ((uint32_t)input[45] << 24);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 368 to 375
	value = ((uint32_t)input[46] << 24);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 376 to 383
	value = ((uint32_t)input[47] << 24);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 384 to 391
	value = ((uint32_t)input[48] << 24);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 392 to 399
	value = ((uint32_t)input[49] << 24);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 400 to 407
	value = ((uint32_t)input[50] << 24);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 408 to 415
	value = ((uint32_t)input[51] << 24);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 416 to 423
	value = ((uint32_t)input[52] << 24);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 424 to 431
	value = ((uint32_t)input[53] << 24);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 432 to 439
	value = ((uint32_t)input[54] << 24);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 440 to 447
	value = ((uint32_t)input[55] << 24);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 448 to 455
	value = ((uint32_t)input[56] << 24);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 456 to 463
	value = ((uint32_t)input[57] << 24);
	output[57] = (double)(value >> 24);
}

static void unpack_58_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 58 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 464 bits of data.
	// Input must be at least 58 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 328 to 335
	value = ((uint32_t)input[41] << 24);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 336 to 343
	value = ((uint32_t)input[42] << 24);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 344 to 351
	value = ((uint32_t)input[43] << 24);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 352 to 359
	value = ((uint32_t)input[44] << 24);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 360 to 367
	value = ((uint32_t)input[45] << 24);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 368 to 375
	value = ((uint32_t)input[46] << 24);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 376 to 383
	value = ((uint32_t)input[47] << 24);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 384 to 391
	value = ((uint32_t)input[48] << 24);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 392 to 399
	value = ((uint32_t)input[49] << 24);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 400 to 407
	value = ((uint32_t)input[50] << 24);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 408 to 415
	value = ((uint32_t)input[51] << 24);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 416 to 423
	value = ((uint32_t)input[52] << 24);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 424 to 431
	value = ((uint32_t)input[53] << 24);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 432 to 439
	value = ((uint32_t)input[54] << 24);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 440 to 447
	value = ((uint32_t)input[55] << 24);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 448 to 455
	value = ((uint32_t)input[56] << 24);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 456 to 463
	value = ((uint32_t)input[57] << 24);
	output[57] = (double)(value >> 24);
}

static void unpack_58_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 58 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 464 bits of data.
	// Input must be at least 59 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 329 to 336
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)(input[42] & 0x80) << 17);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 337 to 344
	value = ((uint32_t)(input[42] & 0x7f) << 25) |
			((uint32_t)(input[43] & 0x80) << 17);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 345 to 352
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)(input[44] & 0x80) << 17);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 353 to 360
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)(input[45] & 0x80) << 17);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 361 to 368
	value = ((uint32_t)(input[45] & 0x7f) << 25) |
			((uint32_t)(input[46] & 0x80) << 17);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 369 to 376
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)(input[47] & 0x80) << 17);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 377 to 384
	value = ((uint32_t)(input[47] & 0x7f) << 25) |
			((uint32_t)(input[48] & 0x80) << 17);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 385 to 392
	value = ((uint32_t)(input[48] & 0x7f) << 25) |
			((uint32_t)(input[49] & 0x80) << 17);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 393 to 400
	value = ((uint32_t)(input[49] & 0x7f) << 25) |
			((uint32_t)(input[50] & 0x80) << 17);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 401 to 408
	value = ((uint32_t)(input[50] & 0x7f) << 25) |
			((uint32_t)(input[51] & 0x80) << 17);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 409 to 416
	value = ((uint32_t)(input[51] & 0x7f) << 25) |
			((uint32_t)(input[52] & 0x80) << 17);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 417 to 424
	value = ((uint32_t)(input[52] & 0x7f) << 25) |
			((uint32_t)(input[53] & 0x80) << 17);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 425 to 432
	value = ((uint32_t)(input[53] & 0x7f) << 25) |
			((uint32_t)(input[54] & 0x80) << 17);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 433 to 440
	value = ((uint32_t)(input[54] & 0x7f) << 25) |
			((uint32_t)(input[55] & 0x80) << 17);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 441 to 448
	value = ((uint32_t)(input[55] & 0x7f) << 25) |
			((uint32_t)(input[56] & 0x80) << 17);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 449 to 456
	value = ((uint32_t)(input[56] & 0x7f) << 25) |
			((uint32_t)(input[57] & 0x80) << 17);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 457 to 464
	value = ((uint32_t)(input[57] & 0x7f) << 25) |
			((uint32_t)(input[58] & 0x80) << 17);
	output[57] = (double)(value >> 24);
}

static void unpack_58_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 58 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 464 bits of data.
	// Input must be at least 59 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 329 to 336
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)(input[42] & 0x80) << 17);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 337 to 344
	value = ((uint32_t)(input[42] & 0x7f) << 25) |
			((uint32_t)(input[43] & 0x80) << 17);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 345 to 352
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)(input[44] & 0x80) << 17);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 353 to 360
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)(input[45] & 0x80) << 17);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 361 to 368
	value = ((uint32_t)(input[45] & 0x7f) << 25) |
			((uint32_t)(input[46] & 0x80) << 17);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 369 to 376
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)(input[47] & 0x80) << 17);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 377 to 384
	value = ((uint32_t)(input[47] & 0x7f) << 25) |
			((uint32_t)(input[48] & 0x80) << 17);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 385 to 392
	value = ((uint32_t)(input[48] & 0x7f) << 25) |
			((uint32_t)(input[49] & 0x80) << 17);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 393 to 400
	value = ((uint32_t)(input[49] & 0x7f) << 25) |
			((uint32_t)(input[50] & 0x80) << 17);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 401 to 408
	value = ((uint32_t)(input[50] & 0x7f) << 25) |
			((uint32_t)(input[51] & 0x80) << 17);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 409 to 416
	value = ((uint32_t)(input[51] & 0x7f) << 25) |
			((uint32_t)(input[52] & 0x80) << 17);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 417 to 424
	value = ((uint32_t)(input[52] & 0x7f) << 25) |
			((uint32_t)(input[53] & 0x80) << 17);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 425 to 432
	value = ((uint32_t)(input[53] & 0x7f) << 25) |
			((uint32_t)(input[54] & 0x80) << 17);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 433 to 440
	value = ((uint32_t)(input[54] & 0x7f) << 25) |
			((uint32_t)(input[55] & 0x80) << 17);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 441 to 448
	value = ((uint32_t)(input[55] & 0x7f) << 25) |
			((uint32_t)(input[56] & 0x80) << 17);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 449 to 456
	value = ((uint32_t)(input[56] & 0x7f) << 25) |
			((uint32_t)(input[57] & 0x80) << 17);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 457 to 464
	value = ((uint32_t)(input[57] & 0x7f) << 25) |
			((uint32_t)(input[58] & 0x80) << 17);
	output[57] = (double)(value >> 24);
}

static void unpack_58_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 58 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 464 bits of data.
	// Input must be at least 59 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 330 to 337
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)(input[42] & 0xc0) << 18);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 338 to 345
	value = ((uint32_t)(input[42] & 0x3f) << 26) |
			((uint32_t)(input[43] & 0xc0) << 18);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 346 to 353
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)(input[44] & 0xc0) << 18);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 354 to 361
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)(input[45] & 0xc0) << 18);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 362 to 369
	value = ((uint32_t)(input[45] & 0x3f) << 26) |
			((uint32_t)(input[46] & 0xc0) << 18);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 370 to 377
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)(input[47] & 0xc0) << 18);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 378 to 385
	value = ((uint32_t)(input[47] & 0x3f) << 26) |
			((uint32_t)(input[48] & 0xc0) << 18);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 386 to 393
	value = ((uint32_t)(input[48] & 0x3f) << 26) |
			((uint32_t)(input[49] & 0xc0) << 18);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 394 to 401
	value = ((uint32_t)(input[49] & 0x3f) << 26) |
			((uint32_t)(input[50] & 0xc0) << 18);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 402 to 409
	value = ((uint32_t)(input[50] & 0x3f) << 26) |
			((uint32_t)(input[51] & 0xc0) << 18);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 410 to 417
	value = ((uint32_t)(input[51] & 0x3f) << 26) |
			((uint32_t)(input[52] & 0xc0) << 18);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 418 to 425
	value = ((uint32_t)(input[52] & 0x3f) << 26) |
			((uint32_t)(input[53] & 0xc0) << 18);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 426 to 433
	value = ((uint32_t)(input[53] & 0x3f) << 26) |
			((uint32_t)(input[54] & 0xc0) << 18);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 434 to 441
	value = ((uint32_t)(input[54] & 0x3f) << 26) |
			((uint32_t)(input[55] & 0xc0) << 18);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 442 to 449
	value = ((uint32_t)(input[55] & 0x3f) << 26) |
			((uint32_t)(input[56] & 0xc0) << 18);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 450 to 457
	value = ((uint32_t)(input[56] & 0x3f) << 26) |
			((uint32_t)(input[57] & 0xc0) << 18);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 458 to 465
	value = ((uint32_t)(input[57] & 0x3f) << 26) |
			((uint32_t)(input[58] & 0xc0) << 18);
	output[57] = (double)(value >> 24);
}

static void unpack_58_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 58 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 464 bits of data.
	// Input must be at least 59 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 330 to 337
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)(input[42] & 0xc0) << 18);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 338 to 345
	value = ((uint32_t)(input[42] & 0x3f) << 26) |
			((uint32_t)(input[43] & 0xc0) << 18);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 346 to 353
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)(input[44] & 0xc0) << 18);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 354 to 361
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)(input[45] & 0xc0) << 18);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 362 to 369
	value = ((uint32_t)(input[45] & 0x3f) << 26) |
			((uint32_t)(input[46] & 0xc0) << 18);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 370 to 377
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)(input[47] & 0xc0) << 18);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 378 to 385
	value = ((uint32_t)(input[47] & 0x3f) << 26) |
			((uint32_t)(input[48] & 0xc0) << 18);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 386 to 393
	value = ((uint32_t)(input[48] & 0x3f) << 26) |
			((uint32_t)(input[49] & 0xc0) << 18);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 394 to 401
	value = ((uint32_t)(input[49] & 0x3f) << 26) |
			((uint32_t)(input[50] & 0xc0) << 18);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 402 to 409
	value = ((uint32_t)(input[50] & 0x3f) << 26) |
			((uint32_t)(input[51] & 0xc0) << 18);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 410 to 417
	value = ((uint32_t)(input[51] & 0x3f) << 26) |
			((uint32_t)(input[52] & 0xc0) << 18);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 418 to 425
	value = ((uint32_t)(input[52] & 0x3f) << 26) |
			((uint32_t)(input[53] & 0xc0) << 18);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 426 to 433
	value = ((uint32_t)(input[53] & 0x3f) << 26) |
			((uint32_t)(input[54] & 0xc0) << 18);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 434 to 441
	value = ((uint32_t)(input[54] & 0x3f) << 26) |
			((uint32_t)(input[55] & 0xc0) << 18);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 442 to 449
	value = ((uint32_t)(input[55] & 0x3f) << 26) |
			((uint32_t)(input[56] & 0xc0) << 18);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 450 to 457
	value = ((uint32_t)(input[56] & 0x3f) << 26) |
			((uint32_t)(input[57] & 0xc0) << 18);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 458 to 465
	value = ((uint32_t)(input[57] & 0x3f) << 26) |
			((uint32_t)(input[58] & 0xc0) << 18);
	output[57] = (double)(value >> 24);
}

static void unpack_58_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 58 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 464 bits of data.
	// Input must be at least 59 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 331 to 338
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)(input[42] & 0xe0) << 19);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 339 to 346
	value = ((uint32_t)(input[42] & 0x1f) << 27) |
			((uint32_t)(input[43] & 0xe0) << 19);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 347 to 354
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)(input[44] & 0xe0) << 19);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 355 to 362
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)(input[45] & 0xe0) << 19);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 363 to 370
	value = ((uint32_t)(input[45] & 0x1f) << 27) |
			((uint32_t)(input[46] & 0xe0) << 19);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 371 to 378
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)(input[47] & 0xe0) << 19);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 379 to 386
	value = ((uint32_t)(input[47] & 0x1f) << 27) |
			((uint32_t)(input[48] & 0xe0) << 19);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 387 to 394
	value = ((uint32_t)(input[48] & 0x1f) << 27) |
			((uint32_t)(input[49] & 0xe0) << 19);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 395 to 402
	value = ((uint32_t)(input[49] & 0x1f) << 27) |
			((uint32_t)(input[50] & 0xe0) << 19);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 403 to 410
	value = ((uint32_t)(input[50] & 0x1f) << 27) |
			((uint32_t)(input[51] & 0xe0) << 19);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 411 to 418
	value = ((uint32_t)(input[51] & 0x1f) << 27) |
			((uint32_t)(input[52] & 0xe0) << 19);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 419 to 426
	value = ((uint32_t)(input[52] & 0x1f) << 27) |
			((uint32_t)(input[53] & 0xe0) << 19);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 427 to 434
	value = ((uint32_t)(input[53] & 0x1f) << 27) |
			((uint32_t)(input[54] & 0xe0) << 19);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 435 to 442
	value = ((uint32_t)(input[54] & 0x1f) << 27) |
			((uint32_t)(input[55] & 0xe0) << 19);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 443 to 450
	value = ((uint32_t)(input[55] & 0x1f) << 27) |
			((uint32_t)(input[56] & 0xe0) << 19);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 451 to 458
	value = ((uint32_t)(input[56] & 0x1f) << 27) |
			((uint32_t)(input[57] & 0xe0) << 19);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 459 to 466
	value = ((uint32_t)(input[57] & 0x1f) << 27) |
			((uint32_t)(input[58] & 0xe0) << 19);
	output[57] = (double)(value >> 24);
}

static void unpack_58_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 58 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 464 bits of data.
	// Input must be at least 59 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 331 to 338
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)(input[42] & 0xe0) << 19);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 339 to 346
	value = ((uint32_t)(input[42] & 0x1f) << 27) |
			((uint32_t)(input[43] & 0xe0) << 19);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 347 to 354
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)(input[44] & 0xe0) << 19);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 355 to 362
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)(input[45] & 0xe0) << 19);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 363 to 370
	value = ((uint32_t)(input[45] & 0x1f) << 27) |
			((uint32_t)(input[46] & 0xe0) << 19);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 371 to 378
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)(input[47] & 0xe0) << 19);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 379 to 386
	value = ((uint32_t)(input[47] & 0x1f) << 27) |
			((uint32_t)(input[48] & 0xe0) << 19);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 387 to 394
	value = ((uint32_t)(input[48] & 0x1f) << 27) |
			((uint32_t)(input[49] & 0xe0) << 19);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 395 to 402
	value = ((uint32_t)(input[49] & 0x1f) << 27) |
			((uint32_t)(input[50] & 0xe0) << 19);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 403 to 410
	value = ((uint32_t)(input[50] & 0x1f) << 27) |
			((uint32_t)(input[51] & 0xe0) << 19);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 411 to 418
	value = ((uint32_t)(input[51] & 0x1f) << 27) |
			((uint32_t)(input[52] & 0xe0) << 19);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 419 to 426
	value = ((uint32_t)(input[52] & 0x1f) << 27) |
			((uint32_t)(input[53] & 0xe0) << 19);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 427 to 434
	value = ((uint32_t)(input[53] & 0x1f) << 27) |
			((uint32_t)(input[54] & 0xe0) << 19);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 435 to 442
	value = ((uint32_t)(input[54] & 0x1f) << 27) |
			((uint32_t)(input[55] & 0xe0) << 19);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 443 to 450
	value = ((uint32_t)(input[55] & 0x1f) << 27) |
			((uint32_t)(input[56] & 0xe0) << 19);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 451 to 458
	value = ((uint32_t)(input[56] & 0x1f) << 27) |
			((uint32_t)(input[57] & 0xe0) << 19);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 459 to 466
	value = ((uint32_t)(input[57] & 0x1f) << 27) |
			((uint32_t)(input[58] & 0xe0) << 19);
	output[57] = (double)(value >> 24);
}

static void unpack_58_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 58 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 464 bits of data.
	// Input must be at least 59 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 332 to 339
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)(input[42] & 0xf0) << 20);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 340 to 347
	value = ((uint32_t)(input[42] & 0x0f) << 28) |
			((uint32_t)(input[43] & 0xf0) << 20);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 348 to 355
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)(input[44] & 0xf0) << 20);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 356 to 363
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)(input[45] & 0xf0) << 20);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 364 to 371
	value = ((uint32_t)(input[45] & 0x0f) << 28) |
			((uint32_t)(input[46] & 0xf0) << 20);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 372 to 379
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)(input[47] & 0xf0) << 20);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 380 to 387
	value = ((uint32_t)(input[47] & 0x0f) << 28) |
			((uint32_t)(input[48] & 0xf0) << 20);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 388 to 395
	value = ((uint32_t)(input[48] & 0x0f) << 28) |
			((uint32_t)(input[49] & 0xf0) << 20);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 396 to 403
	value = ((uint32_t)(input[49] & 0x0f) << 28) |
			((uint32_t)(input[50] & 0xf0) << 20);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 404 to 411
	value = ((uint32_t)(input[50] & 0x0f) << 28) |
			((uint32_t)(input[51] & 0xf0) << 20);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 412 to 419
	value = ((uint32_t)(input[51] & 0x0f) << 28) |
			((uint32_t)(input[52] & 0xf0) << 20);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 420 to 427
	value = ((uint32_t)(input[52] & 0x0f) << 28) |
			((uint32_t)(input[53] & 0xf0) << 20);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 428 to 435
	value = ((uint32_t)(input[53] & 0x0f) << 28) |
			((uint32_t)(input[54] & 0xf0) << 20);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 436 to 443
	value = ((uint32_t)(input[54] & 0x0f) << 28) |
			((uint32_t)(input[55] & 0xf0) << 20);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 444 to 451
	value = ((uint32_t)(input[55] & 0x0f) << 28) |
			((uint32_t)(input[56] & 0xf0) << 20);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 452 to 459
	value = ((uint32_t)(input[56] & 0x0f) << 28) |
			((uint32_t)(input[57] & 0xf0) << 20);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 460 to 467
	value = ((uint32_t)(input[57] & 0x0f) << 28) |
			((uint32_t)(input[58] & 0xf0) << 20);
	output[57] = (double)(value >> 24);
}

static void unpack_58_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 58 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 464 bits of data.
	// Input must be at least 59 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 332 to 339
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)(input[42] & 0xf0) << 20);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 340 to 347
	value = ((uint32_t)(input[42] & 0x0f) << 28) |
			((uint32_t)(input[43] & 0xf0) << 20);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 348 to 355
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)(input[44] & 0xf0) << 20);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 356 to 363
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)(input[45] & 0xf0) << 20);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 364 to 371
	value = ((uint32_t)(input[45] & 0x0f) << 28) |
			((uint32_t)(input[46] & 0xf0) << 20);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 372 to 379
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)(input[47] & 0xf0) << 20);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 380 to 387
	value = ((uint32_t)(input[47] & 0x0f) << 28) |
			((uint32_t)(input[48] & 0xf0) << 20);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 388 to 395
	value = ((uint32_t)(input[48] & 0x0f) << 28) |
			((uint32_t)(input[49] & 0xf0) << 20);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 396 to 403
	value = ((uint32_t)(input[49] & 0x0f) << 28) |
			((uint32_t)(input[50] & 0xf0) << 20);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 404 to 411
	value = ((uint32_t)(input[50] & 0x0f) << 28) |
			((uint32_t)(input[51] & 0xf0) << 20);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 412 to 419
	value = ((uint32_t)(input[51] & 0x0f) << 28) |
			((uint32_t)(input[52] & 0xf0) << 20);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 420 to 427
	value = ((uint32_t)(input[52] & 0x0f) << 28) |
			((uint32_t)(input[53] & 0xf0) << 20);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 428 to 435
	value = ((uint32_t)(input[53] & 0x0f) << 28) |
			((uint32_t)(input[54] & 0xf0) << 20);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 436 to 443
	value = ((uint32_t)(input[54] & 0x0f) << 28) |
			((uint32_t)(input[55] & 0xf0) << 20);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 444 to 451
	value = ((uint32_t)(input[55] & 0x0f) << 28) |
			((uint32_t)(input[56] & 0xf0) << 20);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 452 to 459
	value = ((uint32_t)(input[56] & 0x0f) << 28) |
			((uint32_t)(input[57] & 0xf0) << 20);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 460 to 467
	value = ((uint32_t)(input[57] & 0x0f) << 28) |
			((uint32_t)(input[58] & 0xf0) << 20);
	output[57] = (double)(value >> 24);
}

static void unpack_58_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 58 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 464 bits of data.
	// Input must be at least 59 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 333 to 340
	value = ((uint32_t)(input[41] & 0x07) << 29) |
			((uint32_t)(input[42] & 0xf8) << 21);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 341 to 348
	value = ((uint32_t)(input[42] & 0x07) << 29) |
			((uint32_t)(input[43] & 0xf8) << 21);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 349 to 356
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)(input[44] & 0xf8) << 21);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 357 to 364
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)(input[45] & 0xf8) << 21);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 365 to 372
	value = ((uint32_t)(input[45] & 0x07) << 29) |
			((uint32_t)(input[46] & 0xf8) << 21);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 373 to 380
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)(input[47] & 0xf8) << 21);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 381 to 388
	value = ((uint32_t)(input[47] & 0x07) << 29) |
			((uint32_t)(input[48] & 0xf8) << 21);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 389 to 396
	value = ((uint32_t)(input[48] & 0x07) << 29) |
			((uint32_t)(input[49] & 0xf8) << 21);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 397 to 404
	value = ((uint32_t)(input[49] & 0x07) << 29) |
			((uint32_t)(input[50] & 0xf8) << 21);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 405 to 412
	value = ((uint32_t)(input[50] & 0x07) << 29) |
			((uint32_t)(input[51] & 0xf8) << 21);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 413 to 420
	value = ((uint32_t)(input[51] & 0x07) << 29) |
			((uint32_t)(input[52] & 0xf8) << 21);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 421 to 428
	value = ((uint32_t)(input[52] & 0x07) << 29) |
			((uint32_t)(input[53] & 0xf8) << 21);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 429 to 436
	value = ((uint32_t)(input[53] & 0x07) << 29) |
			((uint32_t)(input[54] & 0xf8) << 21);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 437 to 444
	value = ((uint32_t)(input[54] & 0x07) << 29) |
			((uint32_t)(input[55] & 0xf8) << 21);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 445 to 452
	value = ((uint32_t)(input[55] & 0x07) << 29) |
			((uint32_t)(input[56] & 0xf8) << 21);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 453 to 460
	value = ((uint32_t)(input[56] & 0x07) << 29) |
			((uint32_t)(input[57] & 0xf8) << 21);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 461 to 468
	value = ((uint32_t)(input[57] & 0x07) << 29) |
			((uint32_t)(input[58] & 0xf8) << 21);
	output[57] = (double)(value >> 24);
}

static void unpack_58_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 58 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 464 bits of data.
	// Input must be at least 59 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 333 to 340
	value = ((uint32_t)(input[41] & 0x07) << 29) |
			((uint32_t)(input[42] & 0xf8) << 21);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 341 to 348
	value = ((uint32_t)(input[42] & 0x07) << 29) |
			((uint32_t)(input[43] & 0xf8) << 21);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 349 to 356
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)(input[44] & 0xf8) << 21);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 357 to 364
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)(input[45] & 0xf8) << 21);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 365 to 372
	value = ((uint32_t)(input[45] & 0x07) << 29) |
			((uint32_t)(input[46] & 0xf8) << 21);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 373 to 380
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)(input[47] & 0xf8) << 21);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 381 to 388
	value = ((uint32_t)(input[47] & 0x07) << 29) |
			((uint32_t)(input[48] & 0xf8) << 21);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 389 to 396
	value = ((uint32_t)(input[48] & 0x07) << 29) |
			((uint32_t)(input[49] & 0xf8) << 21);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 397 to 404
	value = ((uint32_t)(input[49] & 0x07) << 29) |
			((uint32_t)(input[50] & 0xf8) << 21);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 405 to 412
	value = ((uint32_t)(input[50] & 0x07) << 29) |
			((uint32_t)(input[51] & 0xf8) << 21);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 413 to 420
	value = ((uint32_t)(input[51] & 0x07) << 29) |
			((uint32_t)(input[52] & 0xf8) << 21);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 421 to 428
	value = ((uint32_t)(input[52] & 0x07) << 29) |
			((uint32_t)(input[53] & 0xf8) << 21);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 429 to 436
	value = ((uint32_t)(input[53] & 0x07) << 29) |
			((uint32_t)(input[54] & 0xf8) << 21);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 437 to 444
	value = ((uint32_t)(input[54] & 0x07) << 29) |
			((uint32_t)(input[55] & 0xf8) << 21);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 445 to 452
	value = ((uint32_t)(input[55] & 0x07) << 29) |
			((uint32_t)(input[56] & 0xf8) << 21);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 453 to 460
	value = ((uint32_t)(input[56] & 0x07) << 29) |
			((uint32_t)(input[57] & 0xf8) << 21);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 461 to 468
	value = ((uint32_t)(input[57] & 0x07) << 29) |
			((uint32_t)(input[58] & 0xf8) << 21);
	output[57] = (double)(value >> 24);
}

static void unpack_58_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 58 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 464 bits of data.
	// Input must be at least 59 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 334 to 341
	value = ((uint32_t)(input[41] & 0x03) << 30) |
			((uint32_t)(input[42] & 0xfc) << 22);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 342 to 349
	value = ((uint32_t)(input[42] & 0x03) << 30) |
			((uint32_t)(input[43] & 0xfc) << 22);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 350 to 357
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)(input[44] & 0xfc) << 22);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 358 to 365
	value = ((uint32_t)(input[44] & 0x03) << 30) |
			((uint32_t)(input[45] & 0xfc) << 22);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 366 to 373
	value = ((uint32_t)(input[45] & 0x03) << 30) |
			((uint32_t)(input[46] & 0xfc) << 22);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 374 to 381
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)(input[47] & 0xfc) << 22);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 382 to 389
	value = ((uint32_t)(input[47] & 0x03) << 30) |
			((uint32_t)(input[48] & 0xfc) << 22);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 390 to 397
	value = ((uint32_t)(input[48] & 0x03) << 30) |
			((uint32_t)(input[49] & 0xfc) << 22);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 398 to 405
	value = ((uint32_t)(input[49] & 0x03) << 30) |
			((uint32_t)(input[50] & 0xfc) << 22);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 406 to 413
	value = ((uint32_t)(input[50] & 0x03) << 30) |
			((uint32_t)(input[51] & 0xfc) << 22);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 414 to 421
	value = ((uint32_t)(input[51] & 0x03) << 30) |
			((uint32_t)(input[52] & 0xfc) << 22);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 422 to 429
	value = ((uint32_t)(input[52] & 0x03) << 30) |
			((uint32_t)(input[53] & 0xfc) << 22);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 430 to 437
	value = ((uint32_t)(input[53] & 0x03) << 30) |
			((uint32_t)(input[54] & 0xfc) << 22);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 438 to 445
	value = ((uint32_t)(input[54] & 0x03) << 30) |
			((uint32_t)(input[55] & 0xfc) << 22);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 446 to 453
	value = ((uint32_t)(input[55] & 0x03) << 30) |
			((uint32_t)(input[56] & 0xfc) << 22);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 454 to 461
	value = ((uint32_t)(input[56] & 0x03) << 30) |
			((uint32_t)(input[57] & 0xfc) << 22);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 462 to 469
	value = ((uint32_t)(input[57] & 0x03) << 30) |
			((uint32_t)(input[58] & 0xfc) << 22);
	output[57] = (double)(value >> 24);
}

static void unpack_58_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 58 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 464 bits of data.
	// Input must be at least 59 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 334 to 341
	value = ((uint32_t)(input[41] & 0x03) << 30) |
			((uint32_t)(input[42] & 0xfc) << 22);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 342 to 349
	value = ((uint32_t)(input[42] & 0x03) << 30) |
			((uint32_t)(input[43] & 0xfc) << 22);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 350 to 357
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)(input[44] & 0xfc) << 22);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 358 to 365
	value = ((uint32_t)(input[44] & 0x03) << 30) |
			((uint32_t)(input[45] & 0xfc) << 22);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 366 to 373
	value = ((uint32_t)(input[45] & 0x03) << 30) |
			((uint32_t)(input[46] & 0xfc) << 22);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 374 to 381
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)(input[47] & 0xfc) << 22);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 382 to 389
	value = ((uint32_t)(input[47] & 0x03) << 30) |
			((uint32_t)(input[48] & 0xfc) << 22);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 390 to 397
	value = ((uint32_t)(input[48] & 0x03) << 30) |
			((uint32_t)(input[49] & 0xfc) << 22);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 398 to 405
	value = ((uint32_t)(input[49] & 0x03) << 30) |
			((uint32_t)(input[50] & 0xfc) << 22);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 406 to 413
	value = ((uint32_t)(input[50] & 0x03) << 30) |
			((uint32_t)(input[51] & 0xfc) << 22);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 414 to 421
	value = ((uint32_t)(input[51] & 0x03) << 30) |
			((uint32_t)(input[52] & 0xfc) << 22);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 422 to 429
	value = ((uint32_t)(input[52] & 0x03) << 30) |
			((uint32_t)(input[53] & 0xfc) << 22);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 430 to 437
	value = ((uint32_t)(input[53] & 0x03) << 30) |
			((uint32_t)(input[54] & 0xfc) << 22);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 438 to 445
	value = ((uint32_t)(input[54] & 0x03) << 30) |
			((uint32_t)(input[55] & 0xfc) << 22);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 446 to 453
	value = ((uint32_t)(input[55] & 0x03) << 30) |
			((uint32_t)(input[56] & 0xfc) << 22);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 454 to 461
	value = ((uint32_t)(input[56] & 0x03) << 30) |
			((uint32_t)(input[57] & 0xfc) << 22);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 462 to 469
	value = ((uint32_t)(input[57] & 0x03) << 30) |
			((uint32_t)(input[58] & 0xfc) << 22);
	output[57] = (double)(value >> 24);
}

static void unpack_58_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 58 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 464 bits of data.
	// Input must be at least 59 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 335 to 342
	value = ((uint32_t)(input[41] & 0x01) << 31) |
			((uint32_t)(input[42] & 0xfe) << 23);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 343 to 350
	value = ((uint32_t)(input[42] & 0x01) << 31) |
			((uint32_t)(input[43] & 0xfe) << 23);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 351 to 358
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)(input[44] & 0xfe) << 23);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 359 to 366
	value = ((uint32_t)(input[44] & 0x01) << 31) |
			((uint32_t)(input[45] & 0xfe) << 23);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 367 to 374
	value = ((uint32_t)(input[45] & 0x01) << 31) |
			((uint32_t)(input[46] & 0xfe) << 23);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 375 to 382
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)(input[47] & 0xfe) << 23);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 383 to 390
	value = ((uint32_t)(input[47] & 0x01) << 31) |
			((uint32_t)(input[48] & 0xfe) << 23);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 391 to 398
	value = ((uint32_t)(input[48] & 0x01) << 31) |
			((uint32_t)(input[49] & 0xfe) << 23);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 399 to 406
	value = ((uint32_t)(input[49] & 0x01) << 31) |
			((uint32_t)(input[50] & 0xfe) << 23);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 407 to 414
	value = ((uint32_t)(input[50] & 0x01) << 31) |
			((uint32_t)(input[51] & 0xfe) << 23);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 415 to 422
	value = ((uint32_t)(input[51] & 0x01) << 31) |
			((uint32_t)(input[52] & 0xfe) << 23);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 423 to 430
	value = ((uint32_t)(input[52] & 0x01) << 31) |
			((uint32_t)(input[53] & 0xfe) << 23);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 431 to 438
	value = ((uint32_t)(input[53] & 0x01) << 31) |
			((uint32_t)(input[54] & 0xfe) << 23);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 439 to 446
	value = ((uint32_t)(input[54] & 0x01) << 31) |
			((uint32_t)(input[55] & 0xfe) << 23);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 447 to 454
	value = ((uint32_t)(input[55] & 0x01) << 31) |
			((uint32_t)(input[56] & 0xfe) << 23);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 455 to 462
	value = ((uint32_t)(input[56] & 0x01) << 31) |
			((uint32_t)(input[57] & 0xfe) << 23);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 463 to 470
	value = ((uint32_t)(input[57] & 0x01) << 31) |
			((uint32_t)(input[58] & 0xfe) << 23);
	output[57] = (double)(value >> 24);
}

static void unpack_58_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 58 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 464 bits of data.
	// Input must be at least 59 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 335 to 342
	value = ((uint32_t)(input[41] & 0x01) << 31) |
			((uint32_t)(input[42] & 0xfe) << 23);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 343 to 350
	value = ((uint32_t)(input[42] & 0x01) << 31) |
			((uint32_t)(input[43] & 0xfe) << 23);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 351 to 358
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)(input[44] & 0xfe) << 23);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 359 to 366
	value = ((uint32_t)(input[44] & 0x01) << 31) |
			((uint32_t)(input[45] & 0xfe) << 23);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 367 to 374
	value = ((uint32_t)(input[45] & 0x01) << 31) |
			((uint32_t)(input[46] & 0xfe) << 23);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 375 to 382
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)(input[47] & 0xfe) << 23);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 383 to 390
	value = ((uint32_t)(input[47] & 0x01) << 31) |
			((uint32_t)(input[48] & 0xfe) << 23);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 391 to 398
	value = ((uint32_t)(input[48] & 0x01) << 31) |
			((uint32_t)(input[49] & 0xfe) << 23);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 399 to 406
	value = ((uint32_t)(input[49] & 0x01) << 31) |
			((uint32_t)(input[50] & 0xfe) << 23);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 407 to 414
	value = ((uint32_t)(input[50] & 0x01) << 31) |
			((uint32_t)(input[51] & 0xfe) << 23);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 415 to 422
	value = ((uint32_t)(input[51] & 0x01) << 31) |
			((uint32_t)(input[52] & 0xfe) << 23);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 423 to 430
	value = ((uint32_t)(input[52] & 0x01) << 31) |
			((uint32_t)(input[53] & 0xfe) << 23);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 431 to 438
	value = ((uint32_t)(input[53] & 0x01) << 31) |
			((uint32_t)(input[54] & 0xfe) << 23);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 439 to 446
	value = ((uint32_t)(input[54] & 0x01) << 31) |
			((uint32_t)(input[55] & 0xfe) << 23);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 447 to 454
	value = ((uint32_t)(input[55] & 0x01) << 31) |
			((uint32_t)(input[56] & 0xfe) << 23);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 455 to 462
	value = ((uint32_t)(input[56] & 0x01) << 31) |
			((uint32_t)(input[57] & 0xfe) << 23);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 463 to 470
	value = ((uint32_t)(input[57] & 0x01) << 31) |
			((uint32_t)(input[58] & 0xfe) << 23);
	output[57] = (double)(value >> 24);
}

static void unpack_59_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 59 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 472 bits of data.
	// Input must be at least 59 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 328 to 335
	value = ((uint32_t)input[41] << 24);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 336 to 343
	value = ((uint32_t)input[42] << 24);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 344 to 351
	value = ((uint32_t)input[43] << 24);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 352 to 359
	value = ((uint32_t)input[44] << 24);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 360 to 367
	value = ((uint32_t)input[45] << 24);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 368 to 375
	value = ((uint32_t)input[46] << 24);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 376 to 383
	value = ((uint32_t)input[47] << 24);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 384 to 391
	value = ((uint32_t)input[48] << 24);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 392 to 399
	value = ((uint32_t)input[49] << 24);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 400 to 407
	value = ((uint32_t)input[50] << 24);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 408 to 415
	value = ((uint32_t)input[51] << 24);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 416 to 423
	value = ((uint32_t)input[52] << 24);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 424 to 431
	value = ((uint32_t)input[53] << 24);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 432 to 439
	value = ((uint32_t)input[54] << 24);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 440 to 447
	value = ((uint32_t)input[55] << 24);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 448 to 455
	value = ((uint32_t)input[56] << 24);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 456 to 463
	value = ((uint32_t)input[57] << 24);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 464 to 471
	value = ((uint32_t)input[58] << 24);
	output[58] = (double)(value >> 24);
}

static void unpack_59_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 59 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 472 bits of data.
	// Input must be at least 59 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 328 to 335
	value = ((uint32_t)input[41] << 24);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 336 to 343
	value = ((uint32_t)input[42] << 24);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 344 to 351
	value = ((uint32_t)input[43] << 24);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 352 to 359
	value = ((uint32_t)input[44] << 24);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 360 to 367
	value = ((uint32_t)input[45] << 24);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 368 to 375
	value = ((uint32_t)input[46] << 24);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 376 to 383
	value = ((uint32_t)input[47] << 24);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 384 to 391
	value = ((uint32_t)input[48] << 24);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 392 to 399
	value = ((uint32_t)input[49] << 24);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 400 to 407
	value = ((uint32_t)input[50] << 24);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 408 to 415
	value = ((uint32_t)input[51] << 24);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 416 to 423
	value = ((uint32_t)input[52] << 24);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 424 to 431
	value = ((uint32_t)input[53] << 24);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 432 to 439
	value = ((uint32_t)input[54] << 24);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 440 to 447
	value = ((uint32_t)input[55] << 24);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 448 to 455
	value = ((uint32_t)input[56] << 24);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 456 to 463
	value = ((uint32_t)input[57] << 24);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 464 to 471
	value = ((uint32_t)input[58] << 24);
	output[58] = (double)(value >> 24);
}

static void unpack_59_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 59 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 472 bits of data.
	// Input must be at least 60 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 329 to 336
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)(input[42] & 0x80) << 17);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 337 to 344
	value = ((uint32_t)(input[42] & 0x7f) << 25) |
			((uint32_t)(input[43] & 0x80) << 17);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 345 to 352
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)(input[44] & 0x80) << 17);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 353 to 360
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)(input[45] & 0x80) << 17);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 361 to 368
	value = ((uint32_t)(input[45] & 0x7f) << 25) |
			((uint32_t)(input[46] & 0x80) << 17);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 369 to 376
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)(input[47] & 0x80) << 17);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 377 to 384
	value = ((uint32_t)(input[47] & 0x7f) << 25) |
			((uint32_t)(input[48] & 0x80) << 17);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 385 to 392
	value = ((uint32_t)(input[48] & 0x7f) << 25) |
			((uint32_t)(input[49] & 0x80) << 17);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 393 to 400
	value = ((uint32_t)(input[49] & 0x7f) << 25) |
			((uint32_t)(input[50] & 0x80) << 17);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 401 to 408
	value = ((uint32_t)(input[50] & 0x7f) << 25) |
			((uint32_t)(input[51] & 0x80) << 17);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 409 to 416
	value = ((uint32_t)(input[51] & 0x7f) << 25) |
			((uint32_t)(input[52] & 0x80) << 17);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 417 to 424
	value = ((uint32_t)(input[52] & 0x7f) << 25) |
			((uint32_t)(input[53] & 0x80) << 17);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 425 to 432
	value = ((uint32_t)(input[53] & 0x7f) << 25) |
			((uint32_t)(input[54] & 0x80) << 17);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 433 to 440
	value = ((uint32_t)(input[54] & 0x7f) << 25) |
			((uint32_t)(input[55] & 0x80) << 17);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 441 to 448
	value = ((uint32_t)(input[55] & 0x7f) << 25) |
			((uint32_t)(input[56] & 0x80) << 17);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 449 to 456
	value = ((uint32_t)(input[56] & 0x7f) << 25) |
			((uint32_t)(input[57] & 0x80) << 17);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 457 to 464
	value = ((uint32_t)(input[57] & 0x7f) << 25) |
			((uint32_t)(input[58] & 0x80) << 17);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 465 to 472
	value = ((uint32_t)(input[58] & 0x7f) << 25) |
			((uint32_t)(input[59] & 0x80) << 17);
	output[58] = (double)(value >> 24);
}

static void unpack_59_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 59 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 472 bits of data.
	// Input must be at least 60 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 329 to 336
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)(input[42] & 0x80) << 17);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 337 to 344
	value = ((uint32_t)(input[42] & 0x7f) << 25) |
			((uint32_t)(input[43] & 0x80) << 17);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 345 to 352
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)(input[44] & 0x80) << 17);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 353 to 360
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)(input[45] & 0x80) << 17);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 361 to 368
	value = ((uint32_t)(input[45] & 0x7f) << 25) |
			((uint32_t)(input[46] & 0x80) << 17);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 369 to 376
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)(input[47] & 0x80) << 17);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 377 to 384
	value = ((uint32_t)(input[47] & 0x7f) << 25) |
			((uint32_t)(input[48] & 0x80) << 17);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 385 to 392
	value = ((uint32_t)(input[48] & 0x7f) << 25) |
			((uint32_t)(input[49] & 0x80) << 17);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 393 to 400
	value = ((uint32_t)(input[49] & 0x7f) << 25) |
			((uint32_t)(input[50] & 0x80) << 17);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 401 to 408
	value = ((uint32_t)(input[50] & 0x7f) << 25) |
			((uint32_t)(input[51] & 0x80) << 17);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 409 to 416
	value = ((uint32_t)(input[51] & 0x7f) << 25) |
			((uint32_t)(input[52] & 0x80) << 17);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 417 to 424
	value = ((uint32_t)(input[52] & 0x7f) << 25) |
			((uint32_t)(input[53] & 0x80) << 17);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 425 to 432
	value = ((uint32_t)(input[53] & 0x7f) << 25) |
			((uint32_t)(input[54] & 0x80) << 17);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 433 to 440
	value = ((uint32_t)(input[54] & 0x7f) << 25) |
			((uint32_t)(input[55] & 0x80) << 17);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 441 to 448
	value = ((uint32_t)(input[55] & 0x7f) << 25) |
			((uint32_t)(input[56] & 0x80) << 17);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 449 to 456
	value = ((uint32_t)(input[56] & 0x7f) << 25) |
			((uint32_t)(input[57] & 0x80) << 17);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 457 to 464
	value = ((uint32_t)(input[57] & 0x7f) << 25) |
			((uint32_t)(input[58] & 0x80) << 17);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 465 to 472
	value = ((uint32_t)(input[58] & 0x7f) << 25) |
			((uint32_t)(input[59] & 0x80) << 17);
	output[58] = (double)(value >> 24);
}

static void unpack_59_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 59 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 472 bits of data.
	// Input must be at least 60 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 330 to 337
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)(input[42] & 0xc0) << 18);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 338 to 345
	value = ((uint32_t)(input[42] & 0x3f) << 26) |
			((uint32_t)(input[43] & 0xc0) << 18);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 346 to 353
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)(input[44] & 0xc0) << 18);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 354 to 361
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)(input[45] & 0xc0) << 18);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 362 to 369
	value = ((uint32_t)(input[45] & 0x3f) << 26) |
			((uint32_t)(input[46] & 0xc0) << 18);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 370 to 377
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)(input[47] & 0xc0) << 18);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 378 to 385
	value = ((uint32_t)(input[47] & 0x3f) << 26) |
			((uint32_t)(input[48] & 0xc0) << 18);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 386 to 393
	value = ((uint32_t)(input[48] & 0x3f) << 26) |
			((uint32_t)(input[49] & 0xc0) << 18);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 394 to 401
	value = ((uint32_t)(input[49] & 0x3f) << 26) |
			((uint32_t)(input[50] & 0xc0) << 18);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 402 to 409
	value = ((uint32_t)(input[50] & 0x3f) << 26) |
			((uint32_t)(input[51] & 0xc0) << 18);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 410 to 417
	value = ((uint32_t)(input[51] & 0x3f) << 26) |
			((uint32_t)(input[52] & 0xc0) << 18);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 418 to 425
	value = ((uint32_t)(input[52] & 0x3f) << 26) |
			((uint32_t)(input[53] & 0xc0) << 18);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 426 to 433
	value = ((uint32_t)(input[53] & 0x3f) << 26) |
			((uint32_t)(input[54] & 0xc0) << 18);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 434 to 441
	value = ((uint32_t)(input[54] & 0x3f) << 26) |
			((uint32_t)(input[55] & 0xc0) << 18);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 442 to 449
	value = ((uint32_t)(input[55] & 0x3f) << 26) |
			((uint32_t)(input[56] & 0xc0) << 18);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 450 to 457
	value = ((uint32_t)(input[56] & 0x3f) << 26) |
			((uint32_t)(input[57] & 0xc0) << 18);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 458 to 465
	value = ((uint32_t)(input[57] & 0x3f) << 26) |
			((uint32_t)(input[58] & 0xc0) << 18);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 466 to 473
	value = ((uint32_t)(input[58] & 0x3f) << 26) |
			((uint32_t)(input[59] & 0xc0) << 18);
	output[58] = (double)(value >> 24);
}

static void unpack_59_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 59 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 472 bits of data.
	// Input must be at least 60 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 330 to 337
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)(input[42] & 0xc0) << 18);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 338 to 345
	value = ((uint32_t)(input[42] & 0x3f) << 26) |
			((uint32_t)(input[43] & 0xc0) << 18);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 346 to 353
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)(input[44] & 0xc0) << 18);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 354 to 361
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)(input[45] & 0xc0) << 18);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 362 to 369
	value = ((uint32_t)(input[45] & 0x3f) << 26) |
			((uint32_t)(input[46] & 0xc0) << 18);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 370 to 377
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)(input[47] & 0xc0) << 18);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 378 to 385
	value = ((uint32_t)(input[47] & 0x3f) << 26) |
			((uint32_t)(input[48] & 0xc0) << 18);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 386 to 393
	value = ((uint32_t)(input[48] & 0x3f) << 26) |
			((uint32_t)(input[49] & 0xc0) << 18);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 394 to 401
	value = ((uint32_t)(input[49] & 0x3f) << 26) |
			((uint32_t)(input[50] & 0xc0) << 18);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 402 to 409
	value = ((uint32_t)(input[50] & 0x3f) << 26) |
			((uint32_t)(input[51] & 0xc0) << 18);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 410 to 417
	value = ((uint32_t)(input[51] & 0x3f) << 26) |
			((uint32_t)(input[52] & 0xc0) << 18);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 418 to 425
	value = ((uint32_t)(input[52] & 0x3f) << 26) |
			((uint32_t)(input[53] & 0xc0) << 18);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 426 to 433
	value = ((uint32_t)(input[53] & 0x3f) << 26) |
			((uint32_t)(input[54] & 0xc0) << 18);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 434 to 441
	value = ((uint32_t)(input[54] & 0x3f) << 26) |
			((uint32_t)(input[55] & 0xc0) << 18);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 442 to 449
	value = ((uint32_t)(input[55] & 0x3f) << 26) |
			((uint32_t)(input[56] & 0xc0) << 18);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 450 to 457
	value = ((uint32_t)(input[56] & 0x3f) << 26) |
			((uint32_t)(input[57] & 0xc0) << 18);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 458 to 465
	value = ((uint32_t)(input[57] & 0x3f) << 26) |
			((uint32_t)(input[58] & 0xc0) << 18);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 466 to 473
	value = ((uint32_t)(input[58] & 0x3f) << 26) |
			((uint32_t)(input[59] & 0xc0) << 18);
	output[58] = (double)(value >> 24);
}

static void unpack_59_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 59 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 472 bits of data.
	// Input must be at least 60 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 331 to 338
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)(input[42] & 0xe0) << 19);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 339 to 346
	value = ((uint32_t)(input[42] & 0x1f) << 27) |
			((uint32_t)(input[43] & 0xe0) << 19);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 347 to 354
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)(input[44] & 0xe0) << 19);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 355 to 362
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)(input[45] & 0xe0) << 19);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 363 to 370
	value = ((uint32_t)(input[45] & 0x1f) << 27) |
			((uint32_t)(input[46] & 0xe0) << 19);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 371 to 378
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)(input[47] & 0xe0) << 19);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 379 to 386
	value = ((uint32_t)(input[47] & 0x1f) << 27) |
			((uint32_t)(input[48] & 0xe0) << 19);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 387 to 394
	value = ((uint32_t)(input[48] & 0x1f) << 27) |
			((uint32_t)(input[49] & 0xe0) << 19);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 395 to 402
	value = ((uint32_t)(input[49] & 0x1f) << 27) |
			((uint32_t)(input[50] & 0xe0) << 19);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 403 to 410
	value = ((uint32_t)(input[50] & 0x1f) << 27) |
			((uint32_t)(input[51] & 0xe0) << 19);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 411 to 418
	value = ((uint32_t)(input[51] & 0x1f) << 27) |
			((uint32_t)(input[52] & 0xe0) << 19);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 419 to 426
	value = ((uint32_t)(input[52] & 0x1f) << 27) |
			((uint32_t)(input[53] & 0xe0) << 19);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 427 to 434
	value = ((uint32_t)(input[53] & 0x1f) << 27) |
			((uint32_t)(input[54] & 0xe0) << 19);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 435 to 442
	value = ((uint32_t)(input[54] & 0x1f) << 27) |
			((uint32_t)(input[55] & 0xe0) << 19);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 443 to 450
	value = ((uint32_t)(input[55] & 0x1f) << 27) |
			((uint32_t)(input[56] & 0xe0) << 19);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 451 to 458
	value = ((uint32_t)(input[56] & 0x1f) << 27) |
			((uint32_t)(input[57] & 0xe0) << 19);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 459 to 466
	value = ((uint32_t)(input[57] & 0x1f) << 27) |
			((uint32_t)(input[58] & 0xe0) << 19);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 467 to 474
	value = ((uint32_t)(input[58] & 0x1f) << 27) |
			((uint32_t)(input[59] & 0xe0) << 19);
	output[58] = (double)(value >> 24);
}

static void unpack_59_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 59 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 472 bits of data.
	// Input must be at least 60 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 331 to 338
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)(input[42] & 0xe0) << 19);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 339 to 346
	value = ((uint32_t)(input[42] & 0x1f) << 27) |
			((uint32_t)(input[43] & 0xe0) << 19);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 347 to 354
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)(input[44] & 0xe0) << 19);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 355 to 362
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)(input[45] & 0xe0) << 19);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 363 to 370
	value = ((uint32_t)(input[45] & 0x1f) << 27) |
			((uint32_t)(input[46] & 0xe0) << 19);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 371 to 378
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)(input[47] & 0xe0) << 19);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 379 to 386
	value = ((uint32_t)(input[47] & 0x1f) << 27) |
			((uint32_t)(input[48] & 0xe0) << 19);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 387 to 394
	value = ((uint32_t)(input[48] & 0x1f) << 27) |
			((uint32_t)(input[49] & 0xe0) << 19);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 395 to 402
	value = ((uint32_t)(input[49] & 0x1f) << 27) |
			((uint32_t)(input[50] & 0xe0) << 19);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 403 to 410
	value = ((uint32_t)(input[50] & 0x1f) << 27) |
			((uint32_t)(input[51] & 0xe0) << 19);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 411 to 418
	value = ((uint32_t)(input[51] & 0x1f) << 27) |
			((uint32_t)(input[52] & 0xe0) << 19);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 419 to 426
	value = ((uint32_t)(input[52] & 0x1f) << 27) |
			((uint32_t)(input[53] & 0xe0) << 19);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 427 to 434
	value = ((uint32_t)(input[53] & 0x1f) << 27) |
			((uint32_t)(input[54] & 0xe0) << 19);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 435 to 442
	value = ((uint32_t)(input[54] & 0x1f) << 27) |
			((uint32_t)(input[55] & 0xe0) << 19);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 443 to 450
	value = ((uint32_t)(input[55] & 0x1f) << 27) |
			((uint32_t)(input[56] & 0xe0) << 19);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 451 to 458
	value = ((uint32_t)(input[56] & 0x1f) << 27) |
			((uint32_t)(input[57] & 0xe0) << 19);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 459 to 466
	value = ((uint32_t)(input[57] & 0x1f) << 27) |
			((uint32_t)(input[58] & 0xe0) << 19);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 467 to 474
	value = ((uint32_t)(input[58] & 0x1f) << 27) |
			((uint32_t)(input[59] & 0xe0) << 19);
	output[58] = (double)(value >> 24);
}

static void unpack_59_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 59 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 472 bits of data.
	// Input must be at least 60 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 332 to 339
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)(input[42] & 0xf0) << 20);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 340 to 347
	value = ((uint32_t)(input[42] & 0x0f) << 28) |
			((uint32_t)(input[43] & 0xf0) << 20);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 348 to 355
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)(input[44] & 0xf0) << 20);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 356 to 363
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)(input[45] & 0xf0) << 20);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 364 to 371
	value = ((uint32_t)(input[45] & 0x0f) << 28) |
			((uint32_t)(input[46] & 0xf0) << 20);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 372 to 379
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)(input[47] & 0xf0) << 20);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 380 to 387
	value = ((uint32_t)(input[47] & 0x0f) << 28) |
			((uint32_t)(input[48] & 0xf0) << 20);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 388 to 395
	value = ((uint32_t)(input[48] & 0x0f) << 28) |
			((uint32_t)(input[49] & 0xf0) << 20);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 396 to 403
	value = ((uint32_t)(input[49] & 0x0f) << 28) |
			((uint32_t)(input[50] & 0xf0) << 20);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 404 to 411
	value = ((uint32_t)(input[50] & 0x0f) << 28) |
			((uint32_t)(input[51] & 0xf0) << 20);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 412 to 419
	value = ((uint32_t)(input[51] & 0x0f) << 28) |
			((uint32_t)(input[52] & 0xf0) << 20);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 420 to 427
	value = ((uint32_t)(input[52] & 0x0f) << 28) |
			((uint32_t)(input[53] & 0xf0) << 20);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 428 to 435
	value = ((uint32_t)(input[53] & 0x0f) << 28) |
			((uint32_t)(input[54] & 0xf0) << 20);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 436 to 443
	value = ((uint32_t)(input[54] & 0x0f) << 28) |
			((uint32_t)(input[55] & 0xf0) << 20);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 444 to 451
	value = ((uint32_t)(input[55] & 0x0f) << 28) |
			((uint32_t)(input[56] & 0xf0) << 20);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 452 to 459
	value = ((uint32_t)(input[56] & 0x0f) << 28) |
			((uint32_t)(input[57] & 0xf0) << 20);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 460 to 467
	value = ((uint32_t)(input[57] & 0x0f) << 28) |
			((uint32_t)(input[58] & 0xf0) << 20);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 468 to 475
	value = ((uint32_t)(input[58] & 0x0f) << 28) |
			((uint32_t)(input[59] & 0xf0) << 20);
	output[58] = (double)(value >> 24);
}

static void unpack_59_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 59 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 472 bits of data.
	// Input must be at least 60 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 332 to 339
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)(input[42] & 0xf0) << 20);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 340 to 347
	value = ((uint32_t)(input[42] & 0x0f) << 28) |
			((uint32_t)(input[43] & 0xf0) << 20);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 348 to 355
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)(input[44] & 0xf0) << 20);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 356 to 363
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)(input[45] & 0xf0) << 20);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 364 to 371
	value = ((uint32_t)(input[45] & 0x0f) << 28) |
			((uint32_t)(input[46] & 0xf0) << 20);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 372 to 379
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)(input[47] & 0xf0) << 20);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 380 to 387
	value = ((uint32_t)(input[47] & 0x0f) << 28) |
			((uint32_t)(input[48] & 0xf0) << 20);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 388 to 395
	value = ((uint32_t)(input[48] & 0x0f) << 28) |
			((uint32_t)(input[49] & 0xf0) << 20);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 396 to 403
	value = ((uint32_t)(input[49] & 0x0f) << 28) |
			((uint32_t)(input[50] & 0xf0) << 20);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 404 to 411
	value = ((uint32_t)(input[50] & 0x0f) << 28) |
			((uint32_t)(input[51] & 0xf0) << 20);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 412 to 419
	value = ((uint32_t)(input[51] & 0x0f) << 28) |
			((uint32_t)(input[52] & 0xf0) << 20);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 420 to 427
	value = ((uint32_t)(input[52] & 0x0f) << 28) |
			((uint32_t)(input[53] & 0xf0) << 20);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 428 to 435
	value = ((uint32_t)(input[53] & 0x0f) << 28) |
			((uint32_t)(input[54] & 0xf0) << 20);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 436 to 443
	value = ((uint32_t)(input[54] & 0x0f) << 28) |
			((uint32_t)(input[55] & 0xf0) << 20);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 444 to 451
	value = ((uint32_t)(input[55] & 0x0f) << 28) |
			((uint32_t)(input[56] & 0xf0) << 20);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 452 to 459
	value = ((uint32_t)(input[56] & 0x0f) << 28) |
			((uint32_t)(input[57] & 0xf0) << 20);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 460 to 467
	value = ((uint32_t)(input[57] & 0x0f) << 28) |
			((uint32_t)(input[58] & 0xf0) << 20);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 468 to 475
	value = ((uint32_t)(input[58] & 0x0f) << 28) |
			((uint32_t)(input[59] & 0xf0) << 20);
	output[58] = (double)(value >> 24);
}

static void unpack_59_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 59 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 472 bits of data.
	// Input must be at least 60 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 333 to 340
	value = ((uint32_t)(input[41] & 0x07) << 29) |
			((uint32_t)(input[42] & 0xf8) << 21);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 341 to 348
	value = ((uint32_t)(input[42] & 0x07) << 29) |
			((uint32_t)(input[43] & 0xf8) << 21);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 349 to 356
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)(input[44] & 0xf8) << 21);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 357 to 364
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)(input[45] & 0xf8) << 21);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 365 to 372
	value = ((uint32_t)(input[45] & 0x07) << 29) |
			((uint32_t)(input[46] & 0xf8) << 21);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 373 to 380
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)(input[47] & 0xf8) << 21);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 381 to 388
	value = ((uint32_t)(input[47] & 0x07) << 29) |
			((uint32_t)(input[48] & 0xf8) << 21);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 389 to 396
	value = ((uint32_t)(input[48] & 0x07) << 29) |
			((uint32_t)(input[49] & 0xf8) << 21);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 397 to 404
	value = ((uint32_t)(input[49] & 0x07) << 29) |
			((uint32_t)(input[50] & 0xf8) << 21);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 405 to 412
	value = ((uint32_t)(input[50] & 0x07) << 29) |
			((uint32_t)(input[51] & 0xf8) << 21);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 413 to 420
	value = ((uint32_t)(input[51] & 0x07) << 29) |
			((uint32_t)(input[52] & 0xf8) << 21);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 421 to 428
	value = ((uint32_t)(input[52] & 0x07) << 29) |
			((uint32_t)(input[53] & 0xf8) << 21);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 429 to 436
	value = ((uint32_t)(input[53] & 0x07) << 29) |
			((uint32_t)(input[54] & 0xf8) << 21);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 437 to 444
	value = ((uint32_t)(input[54] & 0x07) << 29) |
			((uint32_t)(input[55] & 0xf8) << 21);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 445 to 452
	value = ((uint32_t)(input[55] & 0x07) << 29) |
			((uint32_t)(input[56] & 0xf8) << 21);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 453 to 460
	value = ((uint32_t)(input[56] & 0x07) << 29) |
			((uint32_t)(input[57] & 0xf8) << 21);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 461 to 468
	value = ((uint32_t)(input[57] & 0x07) << 29) |
			((uint32_t)(input[58] & 0xf8) << 21);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 469 to 476
	value = ((uint32_t)(input[58] & 0x07) << 29) |
			((uint32_t)(input[59] & 0xf8) << 21);
	output[58] = (double)(value >> 24);
}

static void unpack_59_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 59 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 472 bits of data.
	// Input must be at least 60 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 333 to 340
	value = ((uint32_t)(input[41] & 0x07) << 29) |
			((uint32_t)(input[42] & 0xf8) << 21);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 341 to 348
	value = ((uint32_t)(input[42] & 0x07) << 29) |
			((uint32_t)(input[43] & 0xf8) << 21);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 349 to 356
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)(input[44] & 0xf8) << 21);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 357 to 364
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)(input[45] & 0xf8) << 21);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 365 to 372
	value = ((uint32_t)(input[45] & 0x07) << 29) |
			((uint32_t)(input[46] & 0xf8) << 21);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 373 to 380
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)(input[47] & 0xf8) << 21);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 381 to 388
	value = ((uint32_t)(input[47] & 0x07) << 29) |
			((uint32_t)(input[48] & 0xf8) << 21);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 389 to 396
	value = ((uint32_t)(input[48] & 0x07) << 29) |
			((uint32_t)(input[49] & 0xf8) << 21);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 397 to 404
	value = ((uint32_t)(input[49] & 0x07) << 29) |
			((uint32_t)(input[50] & 0xf8) << 21);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 405 to 412
	value = ((uint32_t)(input[50] & 0x07) << 29) |
			((uint32_t)(input[51] & 0xf8) << 21);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 413 to 420
	value = ((uint32_t)(input[51] & 0x07) << 29) |
			((uint32_t)(input[52] & 0xf8) << 21);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 421 to 428
	value = ((uint32_t)(input[52] & 0x07) << 29) |
			((uint32_t)(input[53] & 0xf8) << 21);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 429 to 436
	value = ((uint32_t)(input[53] & 0x07) << 29) |
			((uint32_t)(input[54] & 0xf8) << 21);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 437 to 444
	value = ((uint32_t)(input[54] & 0x07) << 29) |
			((uint32_t)(input[55] & 0xf8) << 21);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 445 to 452
	value = ((uint32_t)(input[55] & 0x07) << 29) |
			((uint32_t)(input[56] & 0xf8) << 21);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 453 to 460
	value = ((uint32_t)(input[56] & 0x07) << 29) |
			((uint32_t)(input[57] & 0xf8) << 21);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 461 to 468
	value = ((uint32_t)(input[57] & 0x07) << 29) |
			((uint32_t)(input[58] & 0xf8) << 21);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 469 to 476
	value = ((uint32_t)(input[58] & 0x07) << 29) |
			((uint32_t)(input[59] & 0xf8) << 21);
	output[58] = (double)(value >> 24);
}

static void unpack_59_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 59 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 472 bits of data.
	// Input must be at least 60 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 334 to 341
	value = ((uint32_t)(input[41] & 0x03) << 30) |
			((uint32_t)(input[42] & 0xfc) << 22);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 342 to 349
	value = ((uint32_t)(input[42] & 0x03) << 30) |
			((uint32_t)(input[43] & 0xfc) << 22);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 350 to 357
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)(input[44] & 0xfc) << 22);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 358 to 365
	value = ((uint32_t)(input[44] & 0x03) << 30) |
			((uint32_t)(input[45] & 0xfc) << 22);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 366 to 373
	value = ((uint32_t)(input[45] & 0x03) << 30) |
			((uint32_t)(input[46] & 0xfc) << 22);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 374 to 381
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)(input[47] & 0xfc) << 22);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 382 to 389
	value = ((uint32_t)(input[47] & 0x03) << 30) |
			((uint32_t)(input[48] & 0xfc) << 22);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 390 to 397
	value = ((uint32_t)(input[48] & 0x03) << 30) |
			((uint32_t)(input[49] & 0xfc) << 22);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 398 to 405
	value = ((uint32_t)(input[49] & 0x03) << 30) |
			((uint32_t)(input[50] & 0xfc) << 22);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 406 to 413
	value = ((uint32_t)(input[50] & 0x03) << 30) |
			((uint32_t)(input[51] & 0xfc) << 22);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 414 to 421
	value = ((uint32_t)(input[51] & 0x03) << 30) |
			((uint32_t)(input[52] & 0xfc) << 22);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 422 to 429
	value = ((uint32_t)(input[52] & 0x03) << 30) |
			((uint32_t)(input[53] & 0xfc) << 22);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 430 to 437
	value = ((uint32_t)(input[53] & 0x03) << 30) |
			((uint32_t)(input[54] & 0xfc) << 22);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 438 to 445
	value = ((uint32_t)(input[54] & 0x03) << 30) |
			((uint32_t)(input[55] & 0xfc) << 22);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 446 to 453
	value = ((uint32_t)(input[55] & 0x03) << 30) |
			((uint32_t)(input[56] & 0xfc) << 22);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 454 to 461
	value = ((uint32_t)(input[56] & 0x03) << 30) |
			((uint32_t)(input[57] & 0xfc) << 22);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 462 to 469
	value = ((uint32_t)(input[57] & 0x03) << 30) |
			((uint32_t)(input[58] & 0xfc) << 22);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 470 to 477
	value = ((uint32_t)(input[58] & 0x03) << 30) |
			((uint32_t)(input[59] & 0xfc) << 22);
	output[58] = (double)(value >> 24);
}

static void unpack_59_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 59 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 472 bits of data.
	// Input must be at least 60 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 334 to 341
	value = ((uint32_t)(input[41] & 0x03) << 30) |
			((uint32_t)(input[42] & 0xfc) << 22);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 342 to 349
	value = ((uint32_t)(input[42] & 0x03) << 30) |
			((uint32_t)(input[43] & 0xfc) << 22);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 350 to 357
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)(input[44] & 0xfc) << 22);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 358 to 365
	value = ((uint32_t)(input[44] & 0x03) << 30) |
			((uint32_t)(input[45] & 0xfc) << 22);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 366 to 373
	value = ((uint32_t)(input[45] & 0x03) << 30) |
			((uint32_t)(input[46] & 0xfc) << 22);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 374 to 381
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)(input[47] & 0xfc) << 22);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 382 to 389
	value = ((uint32_t)(input[47] & 0x03) << 30) |
			((uint32_t)(input[48] & 0xfc) << 22);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 390 to 397
	value = ((uint32_t)(input[48] & 0x03) << 30) |
			((uint32_t)(input[49] & 0xfc) << 22);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 398 to 405
	value = ((uint32_t)(input[49] & 0x03) << 30) |
			((uint32_t)(input[50] & 0xfc) << 22);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 406 to 413
	value = ((uint32_t)(input[50] & 0x03) << 30) |
			((uint32_t)(input[51] & 0xfc) << 22);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 414 to 421
	value = ((uint32_t)(input[51] & 0x03) << 30) |
			((uint32_t)(input[52] & 0xfc) << 22);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 422 to 429
	value = ((uint32_t)(input[52] & 0x03) << 30) |
			((uint32_t)(input[53] & 0xfc) << 22);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 430 to 437
	value = ((uint32_t)(input[53] & 0x03) << 30) |
			((uint32_t)(input[54] & 0xfc) << 22);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 438 to 445
	value = ((uint32_t)(input[54] & 0x03) << 30) |
			((uint32_t)(input[55] & 0xfc) << 22);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 446 to 453
	value = ((uint32_t)(input[55] & 0x03) << 30) |
			((uint32_t)(input[56] & 0xfc) << 22);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 454 to 461
	value = ((uint32_t)(input[56] & 0x03) << 30) |
			((uint32_t)(input[57] & 0xfc) << 22);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 462 to 469
	value = ((uint32_t)(input[57] & 0x03) << 30) |
			((uint32_t)(input[58] & 0xfc) << 22);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 470 to 477
	value = ((uint32_t)(input[58] & 0x03) << 30) |
			((uint32_t)(input[59] & 0xfc) << 22);
	output[58] = (double)(value >> 24);
}

static void unpack_59_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 59 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 472 bits of data.
	// Input must be at least 60 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 335 to 342
	value = ((uint32_t)(input[41] & 0x01) << 31) |
			((uint32_t)(input[42] & 0xfe) << 23);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 343 to 350
	value = ((uint32_t)(input[42] & 0x01) << 31) |
			((uint32_t)(input[43] & 0xfe) << 23);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 351 to 358
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)(input[44] & 0xfe) << 23);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 359 to 366
	value = ((uint32_t)(input[44] & 0x01) << 31) |
			((uint32_t)(input[45] & 0xfe) << 23);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 367 to 374
	value = ((uint32_t)(input[45] & 0x01) << 31) |
			((uint32_t)(input[46] & 0xfe) << 23);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 375 to 382
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)(input[47] & 0xfe) << 23);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 383 to 390
	value = ((uint32_t)(input[47] & 0x01) << 31) |
			((uint32_t)(input[48] & 0xfe) << 23);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 391 to 398
	value = ((uint32_t)(input[48] & 0x01) << 31) |
			((uint32_t)(input[49] & 0xfe) << 23);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 399 to 406
	value = ((uint32_t)(input[49] & 0x01) << 31) |
			((uint32_t)(input[50] & 0xfe) << 23);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 407 to 414
	value = ((uint32_t)(input[50] & 0x01) << 31) |
			((uint32_t)(input[51] & 0xfe) << 23);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 415 to 422
	value = ((uint32_t)(input[51] & 0x01) << 31) |
			((uint32_t)(input[52] & 0xfe) << 23);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 423 to 430
	value = ((uint32_t)(input[52] & 0x01) << 31) |
			((uint32_t)(input[53] & 0xfe) << 23);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 431 to 438
	value = ((uint32_t)(input[53] & 0x01) << 31) |
			((uint32_t)(input[54] & 0xfe) << 23);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 439 to 446
	value = ((uint32_t)(input[54] & 0x01) << 31) |
			((uint32_t)(input[55] & 0xfe) << 23);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 447 to 454
	value = ((uint32_t)(input[55] & 0x01) << 31) |
			((uint32_t)(input[56] & 0xfe) << 23);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 455 to 462
	value = ((uint32_t)(input[56] & 0x01) << 31) |
			((uint32_t)(input[57] & 0xfe) << 23);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 463 to 470
	value = ((uint32_t)(input[57] & 0x01) << 31) |
			((uint32_t)(input[58] & 0xfe) << 23);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 471 to 478
	value = ((uint32_t)(input[58] & 0x01) << 31) |
			((uint32_t)(input[59] & 0xfe) << 23);
	output[58] = (double)(value >> 24);
}

static void unpack_59_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 59 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 472 bits of data.
	// Input must be at least 60 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 335 to 342
	value = ((uint32_t)(input[41] & 0x01) << 31) |
			((uint32_t)(input[42] & 0xfe) << 23);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 343 to 350
	value = ((uint32_t)(input[42] & 0x01) << 31) |
			((uint32_t)(input[43] & 0xfe) << 23);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 351 to 358
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)(input[44] & 0xfe) << 23);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 359 to 366
	value = ((uint32_t)(input[44] & 0x01) << 31) |
			((uint32_t)(input[45] & 0xfe) << 23);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 367 to 374
	value = ((uint32_t)(input[45] & 0x01) << 31) |
			((uint32_t)(input[46] & 0xfe) << 23);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 375 to 382
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)(input[47] & 0xfe) << 23);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 383 to 390
	value = ((uint32_t)(input[47] & 0x01) << 31) |
			((uint32_t)(input[48] & 0xfe) << 23);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 391 to 398
	value = ((uint32_t)(input[48] & 0x01) << 31) |
			((uint32_t)(input[49] & 0xfe) << 23);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 399 to 406
	value = ((uint32_t)(input[49] & 0x01) << 31) |
			((uint32_t)(input[50] & 0xfe) << 23);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 407 to 414
	value = ((uint32_t)(input[50] & 0x01) << 31) |
			((uint32_t)(input[51] & 0xfe) << 23);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 415 to 422
	value = ((uint32_t)(input[51] & 0x01) << 31) |
			((uint32_t)(input[52] & 0xfe) << 23);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 423 to 430
	value = ((uint32_t)(input[52] & 0x01) << 31) |
			((uint32_t)(input[53] & 0xfe) << 23);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 431 to 438
	value = ((uint32_t)(input[53] & 0x01) << 31) |
			((uint32_t)(input[54] & 0xfe) << 23);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 439 to 446
	value = ((uint32_t)(input[54] & 0x01) << 31) |
			((uint32_t)(input[55] & 0xfe) << 23);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 447 to 454
	value = ((uint32_t)(input[55] & 0x01) << 31) |
			((uint32_t)(input[56] & 0xfe) << 23);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 455 to 462
	value = ((uint32_t)(input[56] & 0x01) << 31) |
			((uint32_t)(input[57] & 0xfe) << 23);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 463 to 470
	value = ((uint32_t)(input[57] & 0x01) << 31) |
			((uint32_t)(input[58] & 0xfe) << 23);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 471 to 478
	value = ((uint32_t)(input[58] & 0x01) << 31) |
			((uint32_t)(input[59] & 0xfe) << 23);
	output[58] = (double)(value >> 24);
}

static void unpack_60_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 60 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 480 bits of data.
	// Input must be at least 60 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 328 to 335
	value = ((uint32_t)input[41] << 24);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 336 to 343
	value = ((uint32_t)input[42] << 24);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 344 to 351
	value = ((uint32_t)input[43] << 24);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 352 to 359
	value = ((uint32_t)input[44] << 24);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 360 to 367
	value = ((uint32_t)input[45] << 24);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 368 to 375
	value = ((uint32_t)input[46] << 24);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 376 to 383
	value = ((uint32_t)input[47] << 24);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 384 to 391
	value = ((uint32_t)input[48] << 24);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 392 to 399
	value = ((uint32_t)input[49] << 24);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 400 to 407
	value = ((uint32_t)input[50] << 24);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 408 to 415
	value = ((uint32_t)input[51] << 24);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 416 to 423
	value = ((uint32_t)input[52] << 24);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 424 to 431
	value = ((uint32_t)input[53] << 24);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 432 to 439
	value = ((uint32_t)input[54] << 24);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 440 to 447
	value = ((uint32_t)input[55] << 24);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 448 to 455
	value = ((uint32_t)input[56] << 24);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 456 to 463
	value = ((uint32_t)input[57] << 24);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 464 to 471
	value = ((uint32_t)input[58] << 24);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 472 to 479
	value = ((uint32_t)input[59] << 24);
	output[59] = (double)(value >> 24);
}

static void unpack_60_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 60 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 480 bits of data.
	// Input must be at least 60 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 328 to 335
	value = ((uint32_t)input[41] << 24);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 336 to 343
	value = ((uint32_t)input[42] << 24);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 344 to 351
	value = ((uint32_t)input[43] << 24);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 352 to 359
	value = ((uint32_t)input[44] << 24);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 360 to 367
	value = ((uint32_t)input[45] << 24);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 368 to 375
	value = ((uint32_t)input[46] << 24);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 376 to 383
	value = ((uint32_t)input[47] << 24);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 384 to 391
	value = ((uint32_t)input[48] << 24);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 392 to 399
	value = ((uint32_t)input[49] << 24);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 400 to 407
	value = ((uint32_t)input[50] << 24);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 408 to 415
	value = ((uint32_t)input[51] << 24);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 416 to 423
	value = ((uint32_t)input[52] << 24);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 424 to 431
	value = ((uint32_t)input[53] << 24);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 432 to 439
	value = ((uint32_t)input[54] << 24);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 440 to 447
	value = ((uint32_t)input[55] << 24);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 448 to 455
	value = ((uint32_t)input[56] << 24);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 456 to 463
	value = ((uint32_t)input[57] << 24);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 464 to 471
	value = ((uint32_t)input[58] << 24);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 472 to 479
	value = ((uint32_t)input[59] << 24);
	output[59] = (double)(value >> 24);
}

static void unpack_60_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 60 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 480 bits of data.
	// Input must be at least 61 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 329 to 336
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)(input[42] & 0x80) << 17);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 337 to 344
	value = ((uint32_t)(input[42] & 0x7f) << 25) |
			((uint32_t)(input[43] & 0x80) << 17);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 345 to 352
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)(input[44] & 0x80) << 17);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 353 to 360
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)(input[45] & 0x80) << 17);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 361 to 368
	value = ((uint32_t)(input[45] & 0x7f) << 25) |
			((uint32_t)(input[46] & 0x80) << 17);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 369 to 376
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)(input[47] & 0x80) << 17);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 377 to 384
	value = ((uint32_t)(input[47] & 0x7f) << 25) |
			((uint32_t)(input[48] & 0x80) << 17);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 385 to 392
	value = ((uint32_t)(input[48] & 0x7f) << 25) |
			((uint32_t)(input[49] & 0x80) << 17);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 393 to 400
	value = ((uint32_t)(input[49] & 0x7f) << 25) |
			((uint32_t)(input[50] & 0x80) << 17);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 401 to 408
	value = ((uint32_t)(input[50] & 0x7f) << 25) |
			((uint32_t)(input[51] & 0x80) << 17);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 409 to 416
	value = ((uint32_t)(input[51] & 0x7f) << 25) |
			((uint32_t)(input[52] & 0x80) << 17);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 417 to 424
	value = ((uint32_t)(input[52] & 0x7f) << 25) |
			((uint32_t)(input[53] & 0x80) << 17);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 425 to 432
	value = ((uint32_t)(input[53] & 0x7f) << 25) |
			((uint32_t)(input[54] & 0x80) << 17);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 433 to 440
	value = ((uint32_t)(input[54] & 0x7f) << 25) |
			((uint32_t)(input[55] & 0x80) << 17);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 441 to 448
	value = ((uint32_t)(input[55] & 0x7f) << 25) |
			((uint32_t)(input[56] & 0x80) << 17);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 449 to 456
	value = ((uint32_t)(input[56] & 0x7f) << 25) |
			((uint32_t)(input[57] & 0x80) << 17);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 457 to 464
	value = ((uint32_t)(input[57] & 0x7f) << 25) |
			((uint32_t)(input[58] & 0x80) << 17);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 465 to 472
	value = ((uint32_t)(input[58] & 0x7f) << 25) |
			((uint32_t)(input[59] & 0x80) << 17);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 473 to 480
	value = ((uint32_t)(input[59] & 0x7f) << 25) |
			((uint32_t)(input[60] & 0x80) << 17);
	output[59] = (double)(value >> 24);
}

static void unpack_60_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 60 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 480 bits of data.
	// Input must be at least 61 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 329 to 336
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)(input[42] & 0x80) << 17);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 337 to 344
	value = ((uint32_t)(input[42] & 0x7f) << 25) |
			((uint32_t)(input[43] & 0x80) << 17);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 345 to 352
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)(input[44] & 0x80) << 17);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 353 to 360
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)(input[45] & 0x80) << 17);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 361 to 368
	value = ((uint32_t)(input[45] & 0x7f) << 25) |
			((uint32_t)(input[46] & 0x80) << 17);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 369 to 376
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)(input[47] & 0x80) << 17);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 377 to 384
	value = ((uint32_t)(input[47] & 0x7f) << 25) |
			((uint32_t)(input[48] & 0x80) << 17);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 385 to 392
	value = ((uint32_t)(input[48] & 0x7f) << 25) |
			((uint32_t)(input[49] & 0x80) << 17);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 393 to 400
	value = ((uint32_t)(input[49] & 0x7f) << 25) |
			((uint32_t)(input[50] & 0x80) << 17);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 401 to 408
	value = ((uint32_t)(input[50] & 0x7f) << 25) |
			((uint32_t)(input[51] & 0x80) << 17);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 409 to 416
	value = ((uint32_t)(input[51] & 0x7f) << 25) |
			((uint32_t)(input[52] & 0x80) << 17);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 417 to 424
	value = ((uint32_t)(input[52] & 0x7f) << 25) |
			((uint32_t)(input[53] & 0x80) << 17);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 425 to 432
	value = ((uint32_t)(input[53] & 0x7f) << 25) |
			((uint32_t)(input[54] & 0x80) << 17);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 433 to 440
	value = ((uint32_t)(input[54] & 0x7f) << 25) |
			((uint32_t)(input[55] & 0x80) << 17);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 441 to 448
	value = ((uint32_t)(input[55] & 0x7f) << 25) |
			((uint32_t)(input[56] & 0x80) << 17);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 449 to 456
	value = ((uint32_t)(input[56] & 0x7f) << 25) |
			((uint32_t)(input[57] & 0x80) << 17);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 457 to 464
	value = ((uint32_t)(input[57] & 0x7f) << 25) |
			((uint32_t)(input[58] & 0x80) << 17);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 465 to 472
	value = ((uint32_t)(input[58] & 0x7f) << 25) |
			((uint32_t)(input[59] & 0x80) << 17);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 473 to 480
	value = ((uint32_t)(input[59] & 0x7f) << 25) |
			((uint32_t)(input[60] & 0x80) << 17);
	output[59] = (double)(value >> 24);
}

static void unpack_60_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 60 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 480 bits of data.
	// Input must be at least 61 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 330 to 337
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)(input[42] & 0xc0) << 18);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 338 to 345
	value = ((uint32_t)(input[42] & 0x3f) << 26) |
			((uint32_t)(input[43] & 0xc0) << 18);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 346 to 353
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)(input[44] & 0xc0) << 18);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 354 to 361
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)(input[45] & 0xc0) << 18);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 362 to 369
	value = ((uint32_t)(input[45] & 0x3f) << 26) |
			((uint32_t)(input[46] & 0xc0) << 18);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 370 to 377
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)(input[47] & 0xc0) << 18);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 378 to 385
	value = ((uint32_t)(input[47] & 0x3f) << 26) |
			((uint32_t)(input[48] & 0xc0) << 18);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 386 to 393
	value = ((uint32_t)(input[48] & 0x3f) << 26) |
			((uint32_t)(input[49] & 0xc0) << 18);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 394 to 401
	value = ((uint32_t)(input[49] & 0x3f) << 26) |
			((uint32_t)(input[50] & 0xc0) << 18);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 402 to 409
	value = ((uint32_t)(input[50] & 0x3f) << 26) |
			((uint32_t)(input[51] & 0xc0) << 18);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 410 to 417
	value = ((uint32_t)(input[51] & 0x3f) << 26) |
			((uint32_t)(input[52] & 0xc0) << 18);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 418 to 425
	value = ((uint32_t)(input[52] & 0x3f) << 26) |
			((uint32_t)(input[53] & 0xc0) << 18);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 426 to 433
	value = ((uint32_t)(input[53] & 0x3f) << 26) |
			((uint32_t)(input[54] & 0xc0) << 18);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 434 to 441
	value = ((uint32_t)(input[54] & 0x3f) << 26) |
			((uint32_t)(input[55] & 0xc0) << 18);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 442 to 449
	value = ((uint32_t)(input[55] & 0x3f) << 26) |
			((uint32_t)(input[56] & 0xc0) << 18);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 450 to 457
	value = ((uint32_t)(input[56] & 0x3f) << 26) |
			((uint32_t)(input[57] & 0xc0) << 18);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 458 to 465
	value = ((uint32_t)(input[57] & 0x3f) << 26) |
			((uint32_t)(input[58] & 0xc0) << 18);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 466 to 473
	value = ((uint32_t)(input[58] & 0x3f) << 26) |
			((uint32_t)(input[59] & 0xc0) << 18);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 474 to 481
	value = ((uint32_t)(input[59] & 0x3f) << 26) |
			((uint32_t)(input[60] & 0xc0) << 18);
	output[59] = (double)(value >> 24);
}

static void unpack_60_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 60 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 480 bits of data.
	// Input must be at least 61 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 330 to 337
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)(input[42] & 0xc0) << 18);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 338 to 345
	value = ((uint32_t)(input[42] & 0x3f) << 26) |
			((uint32_t)(input[43] & 0xc0) << 18);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 346 to 353
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)(input[44] & 0xc0) << 18);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 354 to 361
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)(input[45] & 0xc0) << 18);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 362 to 369
	value = ((uint32_t)(input[45] & 0x3f) << 26) |
			((uint32_t)(input[46] & 0xc0) << 18);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 370 to 377
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)(input[47] & 0xc0) << 18);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 378 to 385
	value = ((uint32_t)(input[47] & 0x3f) << 26) |
			((uint32_t)(input[48] & 0xc0) << 18);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 386 to 393
	value = ((uint32_t)(input[48] & 0x3f) << 26) |
			((uint32_t)(input[49] & 0xc0) << 18);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 394 to 401
	value = ((uint32_t)(input[49] & 0x3f) << 26) |
			((uint32_t)(input[50] & 0xc0) << 18);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 402 to 409
	value = ((uint32_t)(input[50] & 0x3f) << 26) |
			((uint32_t)(input[51] & 0xc0) << 18);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 410 to 417
	value = ((uint32_t)(input[51] & 0x3f) << 26) |
			((uint32_t)(input[52] & 0xc0) << 18);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 418 to 425
	value = ((uint32_t)(input[52] & 0x3f) << 26) |
			((uint32_t)(input[53] & 0xc0) << 18);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 426 to 433
	value = ((uint32_t)(input[53] & 0x3f) << 26) |
			((uint32_t)(input[54] & 0xc0) << 18);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 434 to 441
	value = ((uint32_t)(input[54] & 0x3f) << 26) |
			((uint32_t)(input[55] & 0xc0) << 18);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 442 to 449
	value = ((uint32_t)(input[55] & 0x3f) << 26) |
			((uint32_t)(input[56] & 0xc0) << 18);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 450 to 457
	value = ((uint32_t)(input[56] & 0x3f) << 26) |
			((uint32_t)(input[57] & 0xc0) << 18);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 458 to 465
	value = ((uint32_t)(input[57] & 0x3f) << 26) |
			((uint32_t)(input[58] & 0xc0) << 18);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 466 to 473
	value = ((uint32_t)(input[58] & 0x3f) << 26) |
			((uint32_t)(input[59] & 0xc0) << 18);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 474 to 481
	value = ((uint32_t)(input[59] & 0x3f) << 26) |
			((uint32_t)(input[60] & 0xc0) << 18);
	output[59] = (double)(value >> 24);
}

static void unpack_60_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 60 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 480 bits of data.
	// Input must be at least 61 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 331 to 338
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)(input[42] & 0xe0) << 19);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 339 to 346
	value = ((uint32_t)(input[42] & 0x1f) << 27) |
			((uint32_t)(input[43] & 0xe0) << 19);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 347 to 354
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)(input[44] & 0xe0) << 19);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 355 to 362
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)(input[45] & 0xe0) << 19);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 363 to 370
	value = ((uint32_t)(input[45] & 0x1f) << 27) |
			((uint32_t)(input[46] & 0xe0) << 19);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 371 to 378
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)(input[47] & 0xe0) << 19);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 379 to 386
	value = ((uint32_t)(input[47] & 0x1f) << 27) |
			((uint32_t)(input[48] & 0xe0) << 19);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 387 to 394
	value = ((uint32_t)(input[48] & 0x1f) << 27) |
			((uint32_t)(input[49] & 0xe0) << 19);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 395 to 402
	value = ((uint32_t)(input[49] & 0x1f) << 27) |
			((uint32_t)(input[50] & 0xe0) << 19);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 403 to 410
	value = ((uint32_t)(input[50] & 0x1f) << 27) |
			((uint32_t)(input[51] & 0xe0) << 19);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 411 to 418
	value = ((uint32_t)(input[51] & 0x1f) << 27) |
			((uint32_t)(input[52] & 0xe0) << 19);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 419 to 426
	value = ((uint32_t)(input[52] & 0x1f) << 27) |
			((uint32_t)(input[53] & 0xe0) << 19);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 427 to 434
	value = ((uint32_t)(input[53] & 0x1f) << 27) |
			((uint32_t)(input[54] & 0xe0) << 19);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 435 to 442
	value = ((uint32_t)(input[54] & 0x1f) << 27) |
			((uint32_t)(input[55] & 0xe0) << 19);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 443 to 450
	value = ((uint32_t)(input[55] & 0x1f) << 27) |
			((uint32_t)(input[56] & 0xe0) << 19);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 451 to 458
	value = ((uint32_t)(input[56] & 0x1f) << 27) |
			((uint32_t)(input[57] & 0xe0) << 19);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 459 to 466
	value = ((uint32_t)(input[57] & 0x1f) << 27) |
			((uint32_t)(input[58] & 0xe0) << 19);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 467 to 474
	value = ((uint32_t)(input[58] & 0x1f) << 27) |
			((uint32_t)(input[59] & 0xe0) << 19);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 475 to 482
	value = ((uint32_t)(input[59] & 0x1f) << 27) |
			((uint32_t)(input[60] & 0xe0) << 19);
	output[59] = (double)(value >> 24);
}

static void unpack_60_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 60 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 480 bits of data.
	// Input must be at least 61 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 331 to 338
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)(input[42] & 0xe0) << 19);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 339 to 346
	value = ((uint32_t)(input[42] & 0x1f) << 27) |
			((uint32_t)(input[43] & 0xe0) << 19);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 347 to 354
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)(input[44] & 0xe0) << 19);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 355 to 362
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)(input[45] & 0xe0) << 19);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 363 to 370
	value = ((uint32_t)(input[45] & 0x1f) << 27) |
			((uint32_t)(input[46] & 0xe0) << 19);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 371 to 378
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)(input[47] & 0xe0) << 19);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 379 to 386
	value = ((uint32_t)(input[47] & 0x1f) << 27) |
			((uint32_t)(input[48] & 0xe0) << 19);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 387 to 394
	value = ((uint32_t)(input[48] & 0x1f) << 27) |
			((uint32_t)(input[49] & 0xe0) << 19);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 395 to 402
	value = ((uint32_t)(input[49] & 0x1f) << 27) |
			((uint32_t)(input[50] & 0xe0) << 19);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 403 to 410
	value = ((uint32_t)(input[50] & 0x1f) << 27) |
			((uint32_t)(input[51] & 0xe0) << 19);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 411 to 418
	value = ((uint32_t)(input[51] & 0x1f) << 27) |
			((uint32_t)(input[52] & 0xe0) << 19);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 419 to 426
	value = ((uint32_t)(input[52] & 0x1f) << 27) |
			((uint32_t)(input[53] & 0xe0) << 19);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 427 to 434
	value = ((uint32_t)(input[53] & 0x1f) << 27) |
			((uint32_t)(input[54] & 0xe0) << 19);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 435 to 442
	value = ((uint32_t)(input[54] & 0x1f) << 27) |
			((uint32_t)(input[55] & 0xe0) << 19);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 443 to 450
	value = ((uint32_t)(input[55] & 0x1f) << 27) |
			((uint32_t)(input[56] & 0xe0) << 19);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 451 to 458
	value = ((uint32_t)(input[56] & 0x1f) << 27) |
			((uint32_t)(input[57] & 0xe0) << 19);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 459 to 466
	value = ((uint32_t)(input[57] & 0x1f) << 27) |
			((uint32_t)(input[58] & 0xe0) << 19);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 467 to 474
	value = ((uint32_t)(input[58] & 0x1f) << 27) |
			((uint32_t)(input[59] & 0xe0) << 19);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 475 to 482
	value = ((uint32_t)(input[59] & 0x1f) << 27) |
			((uint32_t)(input[60] & 0xe0) << 19);
	output[59] = (double)(value >> 24);
}

static void unpack_60_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 60 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 480 bits of data.
	// Input must be at least 61 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 332 to 339
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)(input[42] & 0xf0) << 20);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 340 to 347
	value = ((uint32_t)(input[42] & 0x0f) << 28) |
			((uint32_t)(input[43] & 0xf0) << 20);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 348 to 355
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)(input[44] & 0xf0) << 20);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 356 to 363
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)(input[45] & 0xf0) << 20);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 364 to 371
	value = ((uint32_t)(input[45] & 0x0f) << 28) |
			((uint32_t)(input[46] & 0xf0) << 20);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 372 to 379
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)(input[47] & 0xf0) << 20);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 380 to 387
	value = ((uint32_t)(input[47] & 0x0f) << 28) |
			((uint32_t)(input[48] & 0xf0) << 20);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 388 to 395
	value = ((uint32_t)(input[48] & 0x0f) << 28) |
			((uint32_t)(input[49] & 0xf0) << 20);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 396 to 403
	value = ((uint32_t)(input[49] & 0x0f) << 28) |
			((uint32_t)(input[50] & 0xf0) << 20);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 404 to 411
	value = ((uint32_t)(input[50] & 0x0f) << 28) |
			((uint32_t)(input[51] & 0xf0) << 20);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 412 to 419
	value = ((uint32_t)(input[51] & 0x0f) << 28) |
			((uint32_t)(input[52] & 0xf0) << 20);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 420 to 427
	value = ((uint32_t)(input[52] & 0x0f) << 28) |
			((uint32_t)(input[53] & 0xf0) << 20);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 428 to 435
	value = ((uint32_t)(input[53] & 0x0f) << 28) |
			((uint32_t)(input[54] & 0xf0) << 20);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 436 to 443
	value = ((uint32_t)(input[54] & 0x0f) << 28) |
			((uint32_t)(input[55] & 0xf0) << 20);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 444 to 451
	value = ((uint32_t)(input[55] & 0x0f) << 28) |
			((uint32_t)(input[56] & 0xf0) << 20);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 452 to 459
	value = ((uint32_t)(input[56] & 0x0f) << 28) |
			((uint32_t)(input[57] & 0xf0) << 20);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 460 to 467
	value = ((uint32_t)(input[57] & 0x0f) << 28) |
			((uint32_t)(input[58] & 0xf0) << 20);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 468 to 475
	value = ((uint32_t)(input[58] & 0x0f) << 28) |
			((uint32_t)(input[59] & 0xf0) << 20);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 476 to 483
	value = ((uint32_t)(input[59] & 0x0f) << 28) |
			((uint32_t)(input[60] & 0xf0) << 20);
	output[59] = (double)(value >> 24);
}

static void unpack_60_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 60 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 480 bits of data.
	// Input must be at least 61 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 332 to 339
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)(input[42] & 0xf0) << 20);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 340 to 347
	value = ((uint32_t)(input[42] & 0x0f) << 28) |
			((uint32_t)(input[43] & 0xf0) << 20);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 348 to 355
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)(input[44] & 0xf0) << 20);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 356 to 363
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)(input[45] & 0xf0) << 20);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 364 to 371
	value = ((uint32_t)(input[45] & 0x0f) << 28) |
			((uint32_t)(input[46] & 0xf0) << 20);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 372 to 379
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)(input[47] & 0xf0) << 20);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 380 to 387
	value = ((uint32_t)(input[47] & 0x0f) << 28) |
			((uint32_t)(input[48] & 0xf0) << 20);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 388 to 395
	value = ((uint32_t)(input[48] & 0x0f) << 28) |
			((uint32_t)(input[49] & 0xf0) << 20);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 396 to 403
	value = ((uint32_t)(input[49] & 0x0f) << 28) |
			((uint32_t)(input[50] & 0xf0) << 20);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 404 to 411
	value = ((uint32_t)(input[50] & 0x0f) << 28) |
			((uint32_t)(input[51] & 0xf0) << 20);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 412 to 419
	value = ((uint32_t)(input[51] & 0x0f) << 28) |
			((uint32_t)(input[52] & 0xf0) << 20);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 420 to 427
	value = ((uint32_t)(input[52] & 0x0f) << 28) |
			((uint32_t)(input[53] & 0xf0) << 20);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 428 to 435
	value = ((uint32_t)(input[53] & 0x0f) << 28) |
			((uint32_t)(input[54] & 0xf0) << 20);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 436 to 443
	value = ((uint32_t)(input[54] & 0x0f) << 28) |
			((uint32_t)(input[55] & 0xf0) << 20);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 444 to 451
	value = ((uint32_t)(input[55] & 0x0f) << 28) |
			((uint32_t)(input[56] & 0xf0) << 20);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 452 to 459
	value = ((uint32_t)(input[56] & 0x0f) << 28) |
			((uint32_t)(input[57] & 0xf0) << 20);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 460 to 467
	value = ((uint32_t)(input[57] & 0x0f) << 28) |
			((uint32_t)(input[58] & 0xf0) << 20);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 468 to 475
	value = ((uint32_t)(input[58] & 0x0f) << 28) |
			((uint32_t)(input[59] & 0xf0) << 20);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 476 to 483
	value = ((uint32_t)(input[59] & 0x0f) << 28) |
			((uint32_t)(input[60] & 0xf0) << 20);
	output[59] = (double)(value >> 24);
}

static void unpack_60_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 60 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 480 bits of data.
	// Input must be at least 61 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 333 to 340
	value = ((uint32_t)(input[41] & 0x07) << 29) |
			((uint32_t)(input[42] & 0xf8) << 21);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 341 to 348
	value = ((uint32_t)(input[42] & 0x07) << 29) |
			((uint32_t)(input[43] & 0xf8) << 21);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 349 to 356
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)(input[44] & 0xf8) << 21);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 357 to 364
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)(input[45] & 0xf8) << 21);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 365 to 372
	value = ((uint32_t)(input[45] & 0x07) << 29) |
			((uint32_t)(input[46] & 0xf8) << 21);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 373 to 380
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)(input[47] & 0xf8) << 21);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 381 to 388
	value = ((uint32_t)(input[47] & 0x07) << 29) |
			((uint32_t)(input[48] & 0xf8) << 21);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 389 to 396
	value = ((uint32_t)(input[48] & 0x07) << 29) |
			((uint32_t)(input[49] & 0xf8) << 21);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 397 to 404
	value = ((uint32_t)(input[49] & 0x07) << 29) |
			((uint32_t)(input[50] & 0xf8) << 21);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 405 to 412
	value = ((uint32_t)(input[50] & 0x07) << 29) |
			((uint32_t)(input[51] & 0xf8) << 21);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 413 to 420
	value = ((uint32_t)(input[51] & 0x07) << 29) |
			((uint32_t)(input[52] & 0xf8) << 21);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 421 to 428
	value = ((uint32_t)(input[52] & 0x07) << 29) |
			((uint32_t)(input[53] & 0xf8) << 21);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 429 to 436
	value = ((uint32_t)(input[53] & 0x07) << 29) |
			((uint32_t)(input[54] & 0xf8) << 21);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 437 to 444
	value = ((uint32_t)(input[54] & 0x07) << 29) |
			((uint32_t)(input[55] & 0xf8) << 21);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 445 to 452
	value = ((uint32_t)(input[55] & 0x07) << 29) |
			((uint32_t)(input[56] & 0xf8) << 21);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 453 to 460
	value = ((uint32_t)(input[56] & 0x07) << 29) |
			((uint32_t)(input[57] & 0xf8) << 21);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 461 to 468
	value = ((uint32_t)(input[57] & 0x07) << 29) |
			((uint32_t)(input[58] & 0xf8) << 21);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 469 to 476
	value = ((uint32_t)(input[58] & 0x07) << 29) |
			((uint32_t)(input[59] & 0xf8) << 21);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 477 to 484
	value = ((uint32_t)(input[59] & 0x07) << 29) |
			((uint32_t)(input[60] & 0xf8) << 21);
	output[59] = (double)(value >> 24);
}

static void unpack_60_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 60 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 480 bits of data.
	// Input must be at least 61 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 333 to 340
	value = ((uint32_t)(input[41] & 0x07) << 29) |
			((uint32_t)(input[42] & 0xf8) << 21);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 341 to 348
	value = ((uint32_t)(input[42] & 0x07) << 29) |
			((uint32_t)(input[43] & 0xf8) << 21);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 349 to 356
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)(input[44] & 0xf8) << 21);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 357 to 364
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)(input[45] & 0xf8) << 21);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 365 to 372
	value = ((uint32_t)(input[45] & 0x07) << 29) |
			((uint32_t)(input[46] & 0xf8) << 21);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 373 to 380
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)(input[47] & 0xf8) << 21);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 381 to 388
	value = ((uint32_t)(input[47] & 0x07) << 29) |
			((uint32_t)(input[48] & 0xf8) << 21);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 389 to 396
	value = ((uint32_t)(input[48] & 0x07) << 29) |
			((uint32_t)(input[49] & 0xf8) << 21);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 397 to 404
	value = ((uint32_t)(input[49] & 0x07) << 29) |
			((uint32_t)(input[50] & 0xf8) << 21);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 405 to 412
	value = ((uint32_t)(input[50] & 0x07) << 29) |
			((uint32_t)(input[51] & 0xf8) << 21);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 413 to 420
	value = ((uint32_t)(input[51] & 0x07) << 29) |
			((uint32_t)(input[52] & 0xf8) << 21);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 421 to 428
	value = ((uint32_t)(input[52] & 0x07) << 29) |
			((uint32_t)(input[53] & 0xf8) << 21);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 429 to 436
	value = ((uint32_t)(input[53] & 0x07) << 29) |
			((uint32_t)(input[54] & 0xf8) << 21);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 437 to 444
	value = ((uint32_t)(input[54] & 0x07) << 29) |
			((uint32_t)(input[55] & 0xf8) << 21);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 445 to 452
	value = ((uint32_t)(input[55] & 0x07) << 29) |
			((uint32_t)(input[56] & 0xf8) << 21);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 453 to 460
	value = ((uint32_t)(input[56] & 0x07) << 29) |
			((uint32_t)(input[57] & 0xf8) << 21);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 461 to 468
	value = ((uint32_t)(input[57] & 0x07) << 29) |
			((uint32_t)(input[58] & 0xf8) << 21);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 469 to 476
	value = ((uint32_t)(input[58] & 0x07) << 29) |
			((uint32_t)(input[59] & 0xf8) << 21);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 477 to 484
	value = ((uint32_t)(input[59] & 0x07) << 29) |
			((uint32_t)(input[60] & 0xf8) << 21);
	output[59] = (double)(value >> 24);
}

static void unpack_60_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 60 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 480 bits of data.
	// Input must be at least 61 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 334 to 341
	value = ((uint32_t)(input[41] & 0x03) << 30) |
			((uint32_t)(input[42] & 0xfc) << 22);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 342 to 349
	value = ((uint32_t)(input[42] & 0x03) << 30) |
			((uint32_t)(input[43] & 0xfc) << 22);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 350 to 357
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)(input[44] & 0xfc) << 22);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 358 to 365
	value = ((uint32_t)(input[44] & 0x03) << 30) |
			((uint32_t)(input[45] & 0xfc) << 22);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 366 to 373
	value = ((uint32_t)(input[45] & 0x03) << 30) |
			((uint32_t)(input[46] & 0xfc) << 22);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 374 to 381
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)(input[47] & 0xfc) << 22);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 382 to 389
	value = ((uint32_t)(input[47] & 0x03) << 30) |
			((uint32_t)(input[48] & 0xfc) << 22);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 390 to 397
	value = ((uint32_t)(input[48] & 0x03) << 30) |
			((uint32_t)(input[49] & 0xfc) << 22);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 398 to 405
	value = ((uint32_t)(input[49] & 0x03) << 30) |
			((uint32_t)(input[50] & 0xfc) << 22);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 406 to 413
	value = ((uint32_t)(input[50] & 0x03) << 30) |
			((uint32_t)(input[51] & 0xfc) << 22);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 414 to 421
	value = ((uint32_t)(input[51] & 0x03) << 30) |
			((uint32_t)(input[52] & 0xfc) << 22);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 422 to 429
	value = ((uint32_t)(input[52] & 0x03) << 30) |
			((uint32_t)(input[53] & 0xfc) << 22);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 430 to 437
	value = ((uint32_t)(input[53] & 0x03) << 30) |
			((uint32_t)(input[54] & 0xfc) << 22);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 438 to 445
	value = ((uint32_t)(input[54] & 0x03) << 30) |
			((uint32_t)(input[55] & 0xfc) << 22);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 446 to 453
	value = ((uint32_t)(input[55] & 0x03) << 30) |
			((uint32_t)(input[56] & 0xfc) << 22);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 454 to 461
	value = ((uint32_t)(input[56] & 0x03) << 30) |
			((uint32_t)(input[57] & 0xfc) << 22);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 462 to 469
	value = ((uint32_t)(input[57] & 0x03) << 30) |
			((uint32_t)(input[58] & 0xfc) << 22);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 470 to 477
	value = ((uint32_t)(input[58] & 0x03) << 30) |
			((uint32_t)(input[59] & 0xfc) << 22);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 478 to 485
	value = ((uint32_t)(input[59] & 0x03) << 30) |
			((uint32_t)(input[60] & 0xfc) << 22);
	output[59] = (double)(value >> 24);
}

static void unpack_60_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 60 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 480 bits of data.
	// Input must be at least 61 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 334 to 341
	value = ((uint32_t)(input[41] & 0x03) << 30) |
			((uint32_t)(input[42] & 0xfc) << 22);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 342 to 349
	value = ((uint32_t)(input[42] & 0x03) << 30) |
			((uint32_t)(input[43] & 0xfc) << 22);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 350 to 357
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)(input[44] & 0xfc) << 22);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 358 to 365
	value = ((uint32_t)(input[44] & 0x03) << 30) |
			((uint32_t)(input[45] & 0xfc) << 22);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 366 to 373
	value = ((uint32_t)(input[45] & 0x03) << 30) |
			((uint32_t)(input[46] & 0xfc) << 22);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 374 to 381
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)(input[47] & 0xfc) << 22);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 382 to 389
	value = ((uint32_t)(input[47] & 0x03) << 30) |
			((uint32_t)(input[48] & 0xfc) << 22);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 390 to 397
	value = ((uint32_t)(input[48] & 0x03) << 30) |
			((uint32_t)(input[49] & 0xfc) << 22);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 398 to 405
	value = ((uint32_t)(input[49] & 0x03) << 30) |
			((uint32_t)(input[50] & 0xfc) << 22);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 406 to 413
	value = ((uint32_t)(input[50] & 0x03) << 30) |
			((uint32_t)(input[51] & 0xfc) << 22);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 414 to 421
	value = ((uint32_t)(input[51] & 0x03) << 30) |
			((uint32_t)(input[52] & 0xfc) << 22);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 422 to 429
	value = ((uint32_t)(input[52] & 0x03) << 30) |
			((uint32_t)(input[53] & 0xfc) << 22);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 430 to 437
	value = ((uint32_t)(input[53] & 0x03) << 30) |
			((uint32_t)(input[54] & 0xfc) << 22);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 438 to 445
	value = ((uint32_t)(input[54] & 0x03) << 30) |
			((uint32_t)(input[55] & 0xfc) << 22);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 446 to 453
	value = ((uint32_t)(input[55] & 0x03) << 30) |
			((uint32_t)(input[56] & 0xfc) << 22);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 454 to 461
	value = ((uint32_t)(input[56] & 0x03) << 30) |
			((uint32_t)(input[57] & 0xfc) << 22);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 462 to 469
	value = ((uint32_t)(input[57] & 0x03) << 30) |
			((uint32_t)(input[58] & 0xfc) << 22);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 470 to 477
	value = ((uint32_t)(input[58] & 0x03) << 30) |
			((uint32_t)(input[59] & 0xfc) << 22);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 478 to 485
	value = ((uint32_t)(input[59] & 0x03) << 30) |
			((uint32_t)(input[60] & 0xfc) << 22);
	output[59] = (double)(value >> 24);
}

static void unpack_60_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 60 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 480 bits of data.
	// Input must be at least 61 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 335 to 342
	value = ((uint32_t)(input[41] & 0x01) << 31) |
			((uint32_t)(input[42] & 0xfe) << 23);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 343 to 350
	value = ((uint32_t)(input[42] & 0x01) << 31) |
			((uint32_t)(input[43] & 0xfe) << 23);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 351 to 358
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)(input[44] & 0xfe) << 23);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 359 to 366
	value = ((uint32_t)(input[44] & 0x01) << 31) |
			((uint32_t)(input[45] & 0xfe) << 23);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 367 to 374
	value = ((uint32_t)(input[45] & 0x01) << 31) |
			((uint32_t)(input[46] & 0xfe) << 23);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 375 to 382
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)(input[47] & 0xfe) << 23);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 383 to 390
	value = ((uint32_t)(input[47] & 0x01) << 31) |
			((uint32_t)(input[48] & 0xfe) << 23);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 391 to 398
	value = ((uint32_t)(input[48] & 0x01) << 31) |
			((uint32_t)(input[49] & 0xfe) << 23);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 399 to 406
	value = ((uint32_t)(input[49] & 0x01) << 31) |
			((uint32_t)(input[50] & 0xfe) << 23);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 407 to 414
	value = ((uint32_t)(input[50] & 0x01) << 31) |
			((uint32_t)(input[51] & 0xfe) << 23);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 415 to 422
	value = ((uint32_t)(input[51] & 0x01) << 31) |
			((uint32_t)(input[52] & 0xfe) << 23);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 423 to 430
	value = ((uint32_t)(input[52] & 0x01) << 31) |
			((uint32_t)(input[53] & 0xfe) << 23);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 431 to 438
	value = ((uint32_t)(input[53] & 0x01) << 31) |
			((uint32_t)(input[54] & 0xfe) << 23);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 439 to 446
	value = ((uint32_t)(input[54] & 0x01) << 31) |
			((uint32_t)(input[55] & 0xfe) << 23);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 447 to 454
	value = ((uint32_t)(input[55] & 0x01) << 31) |
			((uint32_t)(input[56] & 0xfe) << 23);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 455 to 462
	value = ((uint32_t)(input[56] & 0x01) << 31) |
			((uint32_t)(input[57] & 0xfe) << 23);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 463 to 470
	value = ((uint32_t)(input[57] & 0x01) << 31) |
			((uint32_t)(input[58] & 0xfe) << 23);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 471 to 478
	value = ((uint32_t)(input[58] & 0x01) << 31) |
			((uint32_t)(input[59] & 0xfe) << 23);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 479 to 486
	value = ((uint32_t)(input[59] & 0x01) << 31) |
			((uint32_t)(input[60] & 0xfe) << 23);
	output[59] = (double)(value >> 24);
}

static void unpack_60_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 60 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 480 bits of data.
	// Input must be at least 61 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 335 to 342
	value = ((uint32_t)(input[41] & 0x01) << 31) |
			((uint32_t)(input[42] & 0xfe) << 23);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 343 to 350
	value = ((uint32_t)(input[42] & 0x01) << 31) |
			((uint32_t)(input[43] & 0xfe) << 23);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 351 to 358
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)(input[44] & 0xfe) << 23);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 359 to 366
	value = ((uint32_t)(input[44] & 0x01) << 31) |
			((uint32_t)(input[45] & 0xfe) << 23);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 367 to 374
	value = ((uint32_t)(input[45] & 0x01) << 31) |
			((uint32_t)(input[46] & 0xfe) << 23);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 375 to 382
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)(input[47] & 0xfe) << 23);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 383 to 390
	value = ((uint32_t)(input[47] & 0x01) << 31) |
			((uint32_t)(input[48] & 0xfe) << 23);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 391 to 398
	value = ((uint32_t)(input[48] & 0x01) << 31) |
			((uint32_t)(input[49] & 0xfe) << 23);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 399 to 406
	value = ((uint32_t)(input[49] & 0x01) << 31) |
			((uint32_t)(input[50] & 0xfe) << 23);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 407 to 414
	value = ((uint32_t)(input[50] & 0x01) << 31) |
			((uint32_t)(input[51] & 0xfe) << 23);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 415 to 422
	value = ((uint32_t)(input[51] & 0x01) << 31) |
			((uint32_t)(input[52] & 0xfe) << 23);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 423 to 430
	value = ((uint32_t)(input[52] & 0x01) << 31) |
			((uint32_t)(input[53] & 0xfe) << 23);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 431 to 438
	value = ((uint32_t)(input[53] & 0x01) << 31) |
			((uint32_t)(input[54] & 0xfe) << 23);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 439 to 446
	value = ((uint32_t)(input[54] & 0x01) << 31) |
			((uint32_t)(input[55] & 0xfe) << 23);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 447 to 454
	value = ((uint32_t)(input[55] & 0x01) << 31) |
			((uint32_t)(input[56] & 0xfe) << 23);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 455 to 462
	value = ((uint32_t)(input[56] & 0x01) << 31) |
			((uint32_t)(input[57] & 0xfe) << 23);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 463 to 470
	value = ((uint32_t)(input[57] & 0x01) << 31) |
			((uint32_t)(input[58] & 0xfe) << 23);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 471 to 478
	value = ((uint32_t)(input[58] & 0x01) << 31) |
			((uint32_t)(input[59] & 0xfe) << 23);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 479 to 486
	value = ((uint32_t)(input[59] & 0x01) << 31) |
			((uint32_t)(input[60] & 0xfe) << 23);
	output[59] = (double)(value >> 24);
}

static void unpack_61_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 61 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 488 bits of data.
	// Input must be at least 61 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 328 to 335
	value = ((uint32_t)input[41] << 24);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 336 to 343
	value = ((uint32_t)input[42] << 24);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 344 to 351
	value = ((uint32_t)input[43] << 24);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 352 to 359
	value = ((uint32_t)input[44] << 24);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 360 to 367
	value = ((uint32_t)input[45] << 24);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 368 to 375
	value = ((uint32_t)input[46] << 24);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 376 to 383
	value = ((uint32_t)input[47] << 24);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 384 to 391
	value = ((uint32_t)input[48] << 24);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 392 to 399
	value = ((uint32_t)input[49] << 24);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 400 to 407
	value = ((uint32_t)input[50] << 24);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 408 to 415
	value = ((uint32_t)input[51] << 24);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 416 to 423
	value = ((uint32_t)input[52] << 24);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 424 to 431
	value = ((uint32_t)input[53] << 24);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 432 to 439
	value = ((uint32_t)input[54] << 24);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 440 to 447
	value = ((uint32_t)input[55] << 24);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 448 to 455
	value = ((uint32_t)input[56] << 24);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 456 to 463
	value = ((uint32_t)input[57] << 24);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 464 to 471
	value = ((uint32_t)input[58] << 24);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 472 to 479
	value = ((uint32_t)input[59] << 24);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 480 to 487
	value = ((uint32_t)input[60] << 24);
	output[60] = (double)(value >> 24);
}

static void unpack_61_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 61 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 488 bits of data.
	// Input must be at least 61 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 328 to 335
	value = ((uint32_t)input[41] << 24);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 336 to 343
	value = ((uint32_t)input[42] << 24);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 344 to 351
	value = ((uint32_t)input[43] << 24);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 352 to 359
	value = ((uint32_t)input[44] << 24);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 360 to 367
	value = ((uint32_t)input[45] << 24);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 368 to 375
	value = ((uint32_t)input[46] << 24);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 376 to 383
	value = ((uint32_t)input[47] << 24);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 384 to 391
	value = ((uint32_t)input[48] << 24);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 392 to 399
	value = ((uint32_t)input[49] << 24);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 400 to 407
	value = ((uint32_t)input[50] << 24);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 408 to 415
	value = ((uint32_t)input[51] << 24);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 416 to 423
	value = ((uint32_t)input[52] << 24);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 424 to 431
	value = ((uint32_t)input[53] << 24);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 432 to 439
	value = ((uint32_t)input[54] << 24);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 440 to 447
	value = ((uint32_t)input[55] << 24);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 448 to 455
	value = ((uint32_t)input[56] << 24);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 456 to 463
	value = ((uint32_t)input[57] << 24);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 464 to 471
	value = ((uint32_t)input[58] << 24);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 472 to 479
	value = ((uint32_t)input[59] << 24);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 480 to 487
	value = ((uint32_t)input[60] << 24);
	output[60] = (double)(value >> 24);
}

static void unpack_61_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 61 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 488 bits of data.
	// Input must be at least 62 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 329 to 336
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)(input[42] & 0x80) << 17);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 337 to 344
	value = ((uint32_t)(input[42] & 0x7f) << 25) |
			((uint32_t)(input[43] & 0x80) << 17);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 345 to 352
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)(input[44] & 0x80) << 17);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 353 to 360
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)(input[45] & 0x80) << 17);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 361 to 368
	value = ((uint32_t)(input[45] & 0x7f) << 25) |
			((uint32_t)(input[46] & 0x80) << 17);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 369 to 376
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)(input[47] & 0x80) << 17);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 377 to 384
	value = ((uint32_t)(input[47] & 0x7f) << 25) |
			((uint32_t)(input[48] & 0x80) << 17);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 385 to 392
	value = ((uint32_t)(input[48] & 0x7f) << 25) |
			((uint32_t)(input[49] & 0x80) << 17);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 393 to 400
	value = ((uint32_t)(input[49] & 0x7f) << 25) |
			((uint32_t)(input[50] & 0x80) << 17);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 401 to 408
	value = ((uint32_t)(input[50] & 0x7f) << 25) |
			((uint32_t)(input[51] & 0x80) << 17);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 409 to 416
	value = ((uint32_t)(input[51] & 0x7f) << 25) |
			((uint32_t)(input[52] & 0x80) << 17);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 417 to 424
	value = ((uint32_t)(input[52] & 0x7f) << 25) |
			((uint32_t)(input[53] & 0x80) << 17);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 425 to 432
	value = ((uint32_t)(input[53] & 0x7f) << 25) |
			((uint32_t)(input[54] & 0x80) << 17);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 433 to 440
	value = ((uint32_t)(input[54] & 0x7f) << 25) |
			((uint32_t)(input[55] & 0x80) << 17);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 441 to 448
	value = ((uint32_t)(input[55] & 0x7f) << 25) |
			((uint32_t)(input[56] & 0x80) << 17);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 449 to 456
	value = ((uint32_t)(input[56] & 0x7f) << 25) |
			((uint32_t)(input[57] & 0x80) << 17);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 457 to 464
	value = ((uint32_t)(input[57] & 0x7f) << 25) |
			((uint32_t)(input[58] & 0x80) << 17);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 465 to 472
	value = ((uint32_t)(input[58] & 0x7f) << 25) |
			((uint32_t)(input[59] & 0x80) << 17);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 473 to 480
	value = ((uint32_t)(input[59] & 0x7f) << 25) |
			((uint32_t)(input[60] & 0x80) << 17);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 481 to 488
	value = ((uint32_t)(input[60] & 0x7f) << 25) |
			((uint32_t)(input[61] & 0x80) << 17);
	output[60] = (double)(value >> 24);
}

static void unpack_61_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 61 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 488 bits of data.
	// Input must be at least 62 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 329 to 336
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)(input[42] & 0x80) << 17);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 337 to 344
	value = ((uint32_t)(input[42] & 0x7f) << 25) |
			((uint32_t)(input[43] & 0x80) << 17);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 345 to 352
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)(input[44] & 0x80) << 17);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 353 to 360
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)(input[45] & 0x80) << 17);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 361 to 368
	value = ((uint32_t)(input[45] & 0x7f) << 25) |
			((uint32_t)(input[46] & 0x80) << 17);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 369 to 376
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)(input[47] & 0x80) << 17);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 377 to 384
	value = ((uint32_t)(input[47] & 0x7f) << 25) |
			((uint32_t)(input[48] & 0x80) << 17);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 385 to 392
	value = ((uint32_t)(input[48] & 0x7f) << 25) |
			((uint32_t)(input[49] & 0x80) << 17);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 393 to 400
	value = ((uint32_t)(input[49] & 0x7f) << 25) |
			((uint32_t)(input[50] & 0x80) << 17);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 401 to 408
	value = ((uint32_t)(input[50] & 0x7f) << 25) |
			((uint32_t)(input[51] & 0x80) << 17);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 409 to 416
	value = ((uint32_t)(input[51] & 0x7f) << 25) |
			((uint32_t)(input[52] & 0x80) << 17);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 417 to 424
	value = ((uint32_t)(input[52] & 0x7f) << 25) |
			((uint32_t)(input[53] & 0x80) << 17);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 425 to 432
	value = ((uint32_t)(input[53] & 0x7f) << 25) |
			((uint32_t)(input[54] & 0x80) << 17);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 433 to 440
	value = ((uint32_t)(input[54] & 0x7f) << 25) |
			((uint32_t)(input[55] & 0x80) << 17);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 441 to 448
	value = ((uint32_t)(input[55] & 0x7f) << 25) |
			((uint32_t)(input[56] & 0x80) << 17);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 449 to 456
	value = ((uint32_t)(input[56] & 0x7f) << 25) |
			((uint32_t)(input[57] & 0x80) << 17);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 457 to 464
	value = ((uint32_t)(input[57] & 0x7f) << 25) |
			((uint32_t)(input[58] & 0x80) << 17);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 465 to 472
	value = ((uint32_t)(input[58] & 0x7f) << 25) |
			((uint32_t)(input[59] & 0x80) << 17);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 473 to 480
	value = ((uint32_t)(input[59] & 0x7f) << 25) |
			((uint32_t)(input[60] & 0x80) << 17);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 481 to 488
	value = ((uint32_t)(input[60] & 0x7f) << 25) |
			((uint32_t)(input[61] & 0x80) << 17);
	output[60] = (double)(value >> 24);
}

static void unpack_61_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 61 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 488 bits of data.
	// Input must be at least 62 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 330 to 337
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)(input[42] & 0xc0) << 18);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 338 to 345
	value = ((uint32_t)(input[42] & 0x3f) << 26) |
			((uint32_t)(input[43] & 0xc0) << 18);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 346 to 353
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)(input[44] & 0xc0) << 18);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 354 to 361
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)(input[45] & 0xc0) << 18);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 362 to 369
	value = ((uint32_t)(input[45] & 0x3f) << 26) |
			((uint32_t)(input[46] & 0xc0) << 18);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 370 to 377
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)(input[47] & 0xc0) << 18);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 378 to 385
	value = ((uint32_t)(input[47] & 0x3f) << 26) |
			((uint32_t)(input[48] & 0xc0) << 18);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 386 to 393
	value = ((uint32_t)(input[48] & 0x3f) << 26) |
			((uint32_t)(input[49] & 0xc0) << 18);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 394 to 401
	value = ((uint32_t)(input[49] & 0x3f) << 26) |
			((uint32_t)(input[50] & 0xc0) << 18);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 402 to 409
	value = ((uint32_t)(input[50] & 0x3f) << 26) |
			((uint32_t)(input[51] & 0xc0) << 18);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 410 to 417
	value = ((uint32_t)(input[51] & 0x3f) << 26) |
			((uint32_t)(input[52] & 0xc0) << 18);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 418 to 425
	value = ((uint32_t)(input[52] & 0x3f) << 26) |
			((uint32_t)(input[53] & 0xc0) << 18);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 426 to 433
	value = ((uint32_t)(input[53] & 0x3f) << 26) |
			((uint32_t)(input[54] & 0xc0) << 18);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 434 to 441
	value = ((uint32_t)(input[54] & 0x3f) << 26) |
			((uint32_t)(input[55] & 0xc0) << 18);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 442 to 449
	value = ((uint32_t)(input[55] & 0x3f) << 26) |
			((uint32_t)(input[56] & 0xc0) << 18);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 450 to 457
	value = ((uint32_t)(input[56] & 0x3f) << 26) |
			((uint32_t)(input[57] & 0xc0) << 18);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 458 to 465
	value = ((uint32_t)(input[57] & 0x3f) << 26) |
			((uint32_t)(input[58] & 0xc0) << 18);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 466 to 473
	value = ((uint32_t)(input[58] & 0x3f) << 26) |
			((uint32_t)(input[59] & 0xc0) << 18);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 474 to 481
	value = ((uint32_t)(input[59] & 0x3f) << 26) |
			((uint32_t)(input[60] & 0xc0) << 18);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 482 to 489
	value = ((uint32_t)(input[60] & 0x3f) << 26) |
			((uint32_t)(input[61] & 0xc0) << 18);
	output[60] = (double)(value >> 24);
}

static void unpack_61_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 61 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 488 bits of data.
	// Input must be at least 62 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 330 to 337
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)(input[42] & 0xc0) << 18);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 338 to 345
	value = ((uint32_t)(input[42] & 0x3f) << 26) |
			((uint32_t)(input[43] & 0xc0) << 18);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 346 to 353
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)(input[44] & 0xc0) << 18);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 354 to 361
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)(input[45] & 0xc0) << 18);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 362 to 369
	value = ((uint32_t)(input[45] & 0x3f) << 26) |
			((uint32_t)(input[46] & 0xc0) << 18);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 370 to 377
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)(input[47] & 0xc0) << 18);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 378 to 385
	value = ((uint32_t)(input[47] & 0x3f) << 26) |
			((uint32_t)(input[48] & 0xc0) << 18);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 386 to 393
	value = ((uint32_t)(input[48] & 0x3f) << 26) |
			((uint32_t)(input[49] & 0xc0) << 18);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 394 to 401
	value = ((uint32_t)(input[49] & 0x3f) << 26) |
			((uint32_t)(input[50] & 0xc0) << 18);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 402 to 409
	value = ((uint32_t)(input[50] & 0x3f) << 26) |
			((uint32_t)(input[51] & 0xc0) << 18);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 410 to 417
	value = ((uint32_t)(input[51] & 0x3f) << 26) |
			((uint32_t)(input[52] & 0xc0) << 18);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 418 to 425
	value = ((uint32_t)(input[52] & 0x3f) << 26) |
			((uint32_t)(input[53] & 0xc0) << 18);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 426 to 433
	value = ((uint32_t)(input[53] & 0x3f) << 26) |
			((uint32_t)(input[54] & 0xc0) << 18);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 434 to 441
	value = ((uint32_t)(input[54] & 0x3f) << 26) |
			((uint32_t)(input[55] & 0xc0) << 18);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 442 to 449
	value = ((uint32_t)(input[55] & 0x3f) << 26) |
			((uint32_t)(input[56] & 0xc0) << 18);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 450 to 457
	value = ((uint32_t)(input[56] & 0x3f) << 26) |
			((uint32_t)(input[57] & 0xc0) << 18);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 458 to 465
	value = ((uint32_t)(input[57] & 0x3f) << 26) |
			((uint32_t)(input[58] & 0xc0) << 18);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 466 to 473
	value = ((uint32_t)(input[58] & 0x3f) << 26) |
			((uint32_t)(input[59] & 0xc0) << 18);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 474 to 481
	value = ((uint32_t)(input[59] & 0x3f) << 26) |
			((uint32_t)(input[60] & 0xc0) << 18);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 482 to 489
	value = ((uint32_t)(input[60] & 0x3f) << 26) |
			((uint32_t)(input[61] & 0xc0) << 18);
	output[60] = (double)(value >> 24);
}

static void unpack_61_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 61 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 488 bits of data.
	// Input must be at least 62 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 331 to 338
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)(input[42] & 0xe0) << 19);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 339 to 346
	value = ((uint32_t)(input[42] & 0x1f) << 27) |
			((uint32_t)(input[43] & 0xe0) << 19);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 347 to 354
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)(input[44] & 0xe0) << 19);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 355 to 362
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)(input[45] & 0xe0) << 19);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 363 to 370
	value = ((uint32_t)(input[45] & 0x1f) << 27) |
			((uint32_t)(input[46] & 0xe0) << 19);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 371 to 378
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)(input[47] & 0xe0) << 19);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 379 to 386
	value = ((uint32_t)(input[47] & 0x1f) << 27) |
			((uint32_t)(input[48] & 0xe0) << 19);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 387 to 394
	value = ((uint32_t)(input[48] & 0x1f) << 27) |
			((uint32_t)(input[49] & 0xe0) << 19);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 395 to 402
	value = ((uint32_t)(input[49] & 0x1f) << 27) |
			((uint32_t)(input[50] & 0xe0) << 19);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 403 to 410
	value = ((uint32_t)(input[50] & 0x1f) << 27) |
			((uint32_t)(input[51] & 0xe0) << 19);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 411 to 418
	value = ((uint32_t)(input[51] & 0x1f) << 27) |
			((uint32_t)(input[52] & 0xe0) << 19);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 419 to 426
	value = ((uint32_t)(input[52] & 0x1f) << 27) |
			((uint32_t)(input[53] & 0xe0) << 19);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 427 to 434
	value = ((uint32_t)(input[53] & 0x1f) << 27) |
			((uint32_t)(input[54] & 0xe0) << 19);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 435 to 442
	value = ((uint32_t)(input[54] & 0x1f) << 27) |
			((uint32_t)(input[55] & 0xe0) << 19);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 443 to 450
	value = ((uint32_t)(input[55] & 0x1f) << 27) |
			((uint32_t)(input[56] & 0xe0) << 19);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 451 to 458
	value = ((uint32_t)(input[56] & 0x1f) << 27) |
			((uint32_t)(input[57] & 0xe0) << 19);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 459 to 466
	value = ((uint32_t)(input[57] & 0x1f) << 27) |
			((uint32_t)(input[58] & 0xe0) << 19);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 467 to 474
	value = ((uint32_t)(input[58] & 0x1f) << 27) |
			((uint32_t)(input[59] & 0xe0) << 19);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 475 to 482
	value = ((uint32_t)(input[59] & 0x1f) << 27) |
			((uint32_t)(input[60] & 0xe0) << 19);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 483 to 490
	value = ((uint32_t)(input[60] & 0x1f) << 27) |
			((uint32_t)(input[61] & 0xe0) << 19);
	output[60] = (double)(value >> 24);
}

static void unpack_61_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 61 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 488 bits of data.
	// Input must be at least 62 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 331 to 338
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)(input[42] & 0xe0) << 19);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 339 to 346
	value = ((uint32_t)(input[42] & 0x1f) << 27) |
			((uint32_t)(input[43] & 0xe0) << 19);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 347 to 354
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)(input[44] & 0xe0) << 19);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 355 to 362
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)(input[45] & 0xe0) << 19);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 363 to 370
	value = ((uint32_t)(input[45] & 0x1f) << 27) |
			((uint32_t)(input[46] & 0xe0) << 19);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 371 to 378
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)(input[47] & 0xe0) << 19);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 379 to 386
	value = ((uint32_t)(input[47] & 0x1f) << 27) |
			((uint32_t)(input[48] & 0xe0) << 19);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 387 to 394
	value = ((uint32_t)(input[48] & 0x1f) << 27) |
			((uint32_t)(input[49] & 0xe0) << 19);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 395 to 402
	value = ((uint32_t)(input[49] & 0x1f) << 27) |
			((uint32_t)(input[50] & 0xe0) << 19);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 403 to 410
	value = ((uint32_t)(input[50] & 0x1f) << 27) |
			((uint32_t)(input[51] & 0xe0) << 19);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 411 to 418
	value = ((uint32_t)(input[51] & 0x1f) << 27) |
			((uint32_t)(input[52] & 0xe0) << 19);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 419 to 426
	value = ((uint32_t)(input[52] & 0x1f) << 27) |
			((uint32_t)(input[53] & 0xe0) << 19);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 427 to 434
	value = ((uint32_t)(input[53] & 0x1f) << 27) |
			((uint32_t)(input[54] & 0xe0) << 19);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 435 to 442
	value = ((uint32_t)(input[54] & 0x1f) << 27) |
			((uint32_t)(input[55] & 0xe0) << 19);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 443 to 450
	value = ((uint32_t)(input[55] & 0x1f) << 27) |
			((uint32_t)(input[56] & 0xe0) << 19);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 451 to 458
	value = ((uint32_t)(input[56] & 0x1f) << 27) |
			((uint32_t)(input[57] & 0xe0) << 19);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 459 to 466
	value = ((uint32_t)(input[57] & 0x1f) << 27) |
			((uint32_t)(input[58] & 0xe0) << 19);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 467 to 474
	value = ((uint32_t)(input[58] & 0x1f) << 27) |
			((uint32_t)(input[59] & 0xe0) << 19);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 475 to 482
	value = ((uint32_t)(input[59] & 0x1f) << 27) |
			((uint32_t)(input[60] & 0xe0) << 19);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 483 to 490
	value = ((uint32_t)(input[60] & 0x1f) << 27) |
			((uint32_t)(input[61] & 0xe0) << 19);
	output[60] = (double)(value >> 24);
}

static void unpack_61_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 61 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 488 bits of data.
	// Input must be at least 62 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 332 to 339
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)(input[42] & 0xf0) << 20);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 340 to 347
	value = ((uint32_t)(input[42] & 0x0f) << 28) |
			((uint32_t)(input[43] & 0xf0) << 20);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 348 to 355
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)(input[44] & 0xf0) << 20);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 356 to 363
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)(input[45] & 0xf0) << 20);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 364 to 371
	value = ((uint32_t)(input[45] & 0x0f) << 28) |
			((uint32_t)(input[46] & 0xf0) << 20);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 372 to 379
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)(input[47] & 0xf0) << 20);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 380 to 387
	value = ((uint32_t)(input[47] & 0x0f) << 28) |
			((uint32_t)(input[48] & 0xf0) << 20);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 388 to 395
	value = ((uint32_t)(input[48] & 0x0f) << 28) |
			((uint32_t)(input[49] & 0xf0) << 20);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 396 to 403
	value = ((uint32_t)(input[49] & 0x0f) << 28) |
			((uint32_t)(input[50] & 0xf0) << 20);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 404 to 411
	value = ((uint32_t)(input[50] & 0x0f) << 28) |
			((uint32_t)(input[51] & 0xf0) << 20);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 412 to 419
	value = ((uint32_t)(input[51] & 0x0f) << 28) |
			((uint32_t)(input[52] & 0xf0) << 20);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 420 to 427
	value = ((uint32_t)(input[52] & 0x0f) << 28) |
			((uint32_t)(input[53] & 0xf0) << 20);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 428 to 435
	value = ((uint32_t)(input[53] & 0x0f) << 28) |
			((uint32_t)(input[54] & 0xf0) << 20);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 436 to 443
	value = ((uint32_t)(input[54] & 0x0f) << 28) |
			((uint32_t)(input[55] & 0xf0) << 20);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 444 to 451
	value = ((uint32_t)(input[55] & 0x0f) << 28) |
			((uint32_t)(input[56] & 0xf0) << 20);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 452 to 459
	value = ((uint32_t)(input[56] & 0x0f) << 28) |
			((uint32_t)(input[57] & 0xf0) << 20);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 460 to 467
	value = ((uint32_t)(input[57] & 0x0f) << 28) |
			((uint32_t)(input[58] & 0xf0) << 20);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 468 to 475
	value = ((uint32_t)(input[58] & 0x0f) << 28) |
			((uint32_t)(input[59] & 0xf0) << 20);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 476 to 483
	value = ((uint32_t)(input[59] & 0x0f) << 28) |
			((uint32_t)(input[60] & 0xf0) << 20);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 484 to 491
	value = ((uint32_t)(input[60] & 0x0f) << 28) |
			((uint32_t)(input[61] & 0xf0) << 20);
	output[60] = (double)(value >> 24);
}

static void unpack_61_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 61 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 488 bits of data.
	// Input must be at least 62 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 332 to 339
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)(input[42] & 0xf0) << 20);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 340 to 347
	value = ((uint32_t)(input[42] & 0x0f) << 28) |
			((uint32_t)(input[43] & 0xf0) << 20);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 348 to 355
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)(input[44] & 0xf0) << 20);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 356 to 363
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)(input[45] & 0xf0) << 20);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 364 to 371
	value = ((uint32_t)(input[45] & 0x0f) << 28) |
			((uint32_t)(input[46] & 0xf0) << 20);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 372 to 379
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)(input[47] & 0xf0) << 20);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 380 to 387
	value = ((uint32_t)(input[47] & 0x0f) << 28) |
			((uint32_t)(input[48] & 0xf0) << 20);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 388 to 395
	value = ((uint32_t)(input[48] & 0x0f) << 28) |
			((uint32_t)(input[49] & 0xf0) << 20);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 396 to 403
	value = ((uint32_t)(input[49] & 0x0f) << 28) |
			((uint32_t)(input[50] & 0xf0) << 20);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 404 to 411
	value = ((uint32_t)(input[50] & 0x0f) << 28) |
			((uint32_t)(input[51] & 0xf0) << 20);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 412 to 419
	value = ((uint32_t)(input[51] & 0x0f) << 28) |
			((uint32_t)(input[52] & 0xf0) << 20);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 420 to 427
	value = ((uint32_t)(input[52] & 0x0f) << 28) |
			((uint32_t)(input[53] & 0xf0) << 20);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 428 to 435
	value = ((uint32_t)(input[53] & 0x0f) << 28) |
			((uint32_t)(input[54] & 0xf0) << 20);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 436 to 443
	value = ((uint32_t)(input[54] & 0x0f) << 28) |
			((uint32_t)(input[55] & 0xf0) << 20);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 444 to 451
	value = ((uint32_t)(input[55] & 0x0f) << 28) |
			((uint32_t)(input[56] & 0xf0) << 20);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 452 to 459
	value = ((uint32_t)(input[56] & 0x0f) << 28) |
			((uint32_t)(input[57] & 0xf0) << 20);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 460 to 467
	value = ((uint32_t)(input[57] & 0x0f) << 28) |
			((uint32_t)(input[58] & 0xf0) << 20);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 468 to 475
	value = ((uint32_t)(input[58] & 0x0f) << 28) |
			((uint32_t)(input[59] & 0xf0) << 20);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 476 to 483
	value = ((uint32_t)(input[59] & 0x0f) << 28) |
			((uint32_t)(input[60] & 0xf0) << 20);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 484 to 491
	value = ((uint32_t)(input[60] & 0x0f) << 28) |
			((uint32_t)(input[61] & 0xf0) << 20);
	output[60] = (double)(value >> 24);
}

static void unpack_61_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 61 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 488 bits of data.
	// Input must be at least 62 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 333 to 340
	value = ((uint32_t)(input[41] & 0x07) << 29) |
			((uint32_t)(input[42] & 0xf8) << 21);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 341 to 348
	value = ((uint32_t)(input[42] & 0x07) << 29) |
			((uint32_t)(input[43] & 0xf8) << 21);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 349 to 356
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)(input[44] & 0xf8) << 21);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 357 to 364
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)(input[45] & 0xf8) << 21);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 365 to 372
	value = ((uint32_t)(input[45] & 0x07) << 29) |
			((uint32_t)(input[46] & 0xf8) << 21);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 373 to 380
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)(input[47] & 0xf8) << 21);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 381 to 388
	value = ((uint32_t)(input[47] & 0x07) << 29) |
			((uint32_t)(input[48] & 0xf8) << 21);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 389 to 396
	value = ((uint32_t)(input[48] & 0x07) << 29) |
			((uint32_t)(input[49] & 0xf8) << 21);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 397 to 404
	value = ((uint32_t)(input[49] & 0x07) << 29) |
			((uint32_t)(input[50] & 0xf8) << 21);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 405 to 412
	value = ((uint32_t)(input[50] & 0x07) << 29) |
			((uint32_t)(input[51] & 0xf8) << 21);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 413 to 420
	value = ((uint32_t)(input[51] & 0x07) << 29) |
			((uint32_t)(input[52] & 0xf8) << 21);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 421 to 428
	value = ((uint32_t)(input[52] & 0x07) << 29) |
			((uint32_t)(input[53] & 0xf8) << 21);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 429 to 436
	value = ((uint32_t)(input[53] & 0x07) << 29) |
			((uint32_t)(input[54] & 0xf8) << 21);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 437 to 444
	value = ((uint32_t)(input[54] & 0x07) << 29) |
			((uint32_t)(input[55] & 0xf8) << 21);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 445 to 452
	value = ((uint32_t)(input[55] & 0x07) << 29) |
			((uint32_t)(input[56] & 0xf8) << 21);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 453 to 460
	value = ((uint32_t)(input[56] & 0x07) << 29) |
			((uint32_t)(input[57] & 0xf8) << 21);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 461 to 468
	value = ((uint32_t)(input[57] & 0x07) << 29) |
			((uint32_t)(input[58] & 0xf8) << 21);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 469 to 476
	value = ((uint32_t)(input[58] & 0x07) << 29) |
			((uint32_t)(input[59] & 0xf8) << 21);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 477 to 484
	value = ((uint32_t)(input[59] & 0x07) << 29) |
			((uint32_t)(input[60] & 0xf8) << 21);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 485 to 492
	value = ((uint32_t)(input[60] & 0x07) << 29) |
			((uint32_t)(input[61] & 0xf8) << 21);
	output[60] = (double)(value >> 24);
}

static void unpack_61_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 61 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 488 bits of data.
	// Input must be at least 62 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 333 to 340
	value = ((uint32_t)(input[41] & 0x07) << 29) |
			((uint32_t)(input[42] & 0xf8) << 21);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 341 to 348
	value = ((uint32_t)(input[42] & 0x07) << 29) |
			((uint32_t)(input[43] & 0xf8) << 21);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 349 to 356
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)(input[44] & 0xf8) << 21);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 357 to 364
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)(input[45] & 0xf8) << 21);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 365 to 372
	value = ((uint32_t)(input[45] & 0x07) << 29) |
			((uint32_t)(input[46] & 0xf8) << 21);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 373 to 380
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)(input[47] & 0xf8) << 21);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 381 to 388
	value = ((uint32_t)(input[47] & 0x07) << 29) |
			((uint32_t)(input[48] & 0xf8) << 21);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 389 to 396
	value = ((uint32_t)(input[48] & 0x07) << 29) |
			((uint32_t)(input[49] & 0xf8) << 21);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 397 to 404
	value = ((uint32_t)(input[49] & 0x07) << 29) |
			((uint32_t)(input[50] & 0xf8) << 21);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 405 to 412
	value = ((uint32_t)(input[50] & 0x07) << 29) |
			((uint32_t)(input[51] & 0xf8) << 21);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 413 to 420
	value = ((uint32_t)(input[51] & 0x07) << 29) |
			((uint32_t)(input[52] & 0xf8) << 21);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 421 to 428
	value = ((uint32_t)(input[52] & 0x07) << 29) |
			((uint32_t)(input[53] & 0xf8) << 21);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 429 to 436
	value = ((uint32_t)(input[53] & 0x07) << 29) |
			((uint32_t)(input[54] & 0xf8) << 21);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 437 to 444
	value = ((uint32_t)(input[54] & 0x07) << 29) |
			((uint32_t)(input[55] & 0xf8) << 21);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 445 to 452
	value = ((uint32_t)(input[55] & 0x07) << 29) |
			((uint32_t)(input[56] & 0xf8) << 21);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 453 to 460
	value = ((uint32_t)(input[56] & 0x07) << 29) |
			((uint32_t)(input[57] & 0xf8) << 21);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 461 to 468
	value = ((uint32_t)(input[57] & 0x07) << 29) |
			((uint32_t)(input[58] & 0xf8) << 21);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 469 to 476
	value = ((uint32_t)(input[58] & 0x07) << 29) |
			((uint32_t)(input[59] & 0xf8) << 21);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 477 to 484
	value = ((uint32_t)(input[59] & 0x07) << 29) |
			((uint32_t)(input[60] & 0xf8) << 21);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 485 to 492
	value = ((uint32_t)(input[60] & 0x07) << 29) |
			((uint32_t)(input[61] & 0xf8) << 21);
	output[60] = (double)(value >> 24);
}

static void unpack_61_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 61 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 488 bits of data.
	// Input must be at least 62 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 334 to 341
	value = ((uint32_t)(input[41] & 0x03) << 30) |
			((uint32_t)(input[42] & 0xfc) << 22);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 342 to 349
	value = ((uint32_t)(input[42] & 0x03) << 30) |
			((uint32_t)(input[43] & 0xfc) << 22);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 350 to 357
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)(input[44] & 0xfc) << 22);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 358 to 365
	value = ((uint32_t)(input[44] & 0x03) << 30) |
			((uint32_t)(input[45] & 0xfc) << 22);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 366 to 373
	value = ((uint32_t)(input[45] & 0x03) << 30) |
			((uint32_t)(input[46] & 0xfc) << 22);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 374 to 381
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)(input[47] & 0xfc) << 22);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 382 to 389
	value = ((uint32_t)(input[47] & 0x03) << 30) |
			((uint32_t)(input[48] & 0xfc) << 22);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 390 to 397
	value = ((uint32_t)(input[48] & 0x03) << 30) |
			((uint32_t)(input[49] & 0xfc) << 22);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 398 to 405
	value = ((uint32_t)(input[49] & 0x03) << 30) |
			((uint32_t)(input[50] & 0xfc) << 22);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 406 to 413
	value = ((uint32_t)(input[50] & 0x03) << 30) |
			((uint32_t)(input[51] & 0xfc) << 22);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 414 to 421
	value = ((uint32_t)(input[51] & 0x03) << 30) |
			((uint32_t)(input[52] & 0xfc) << 22);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 422 to 429
	value = ((uint32_t)(input[52] & 0x03) << 30) |
			((uint32_t)(input[53] & 0xfc) << 22);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 430 to 437
	value = ((uint32_t)(input[53] & 0x03) << 30) |
			((uint32_t)(input[54] & 0xfc) << 22);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 438 to 445
	value = ((uint32_t)(input[54] & 0x03) << 30) |
			((uint32_t)(input[55] & 0xfc) << 22);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 446 to 453
	value = ((uint32_t)(input[55] & 0x03) << 30) |
			((uint32_t)(input[56] & 0xfc) << 22);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 454 to 461
	value = ((uint32_t)(input[56] & 0x03) << 30) |
			((uint32_t)(input[57] & 0xfc) << 22);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 462 to 469
	value = ((uint32_t)(input[57] & 0x03) << 30) |
			((uint32_t)(input[58] & 0xfc) << 22);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 470 to 477
	value = ((uint32_t)(input[58] & 0x03) << 30) |
			((uint32_t)(input[59] & 0xfc) << 22);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 478 to 485
	value = ((uint32_t)(input[59] & 0x03) << 30) |
			((uint32_t)(input[60] & 0xfc) << 22);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 486 to 493
	value = ((uint32_t)(input[60] & 0x03) << 30) |
			((uint32_t)(input[61] & 0xfc) << 22);
	output[60] = (double)(value >> 24);
}

static void unpack_61_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 61 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 488 bits of data.
	// Input must be at least 62 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 334 to 341
	value = ((uint32_t)(input[41] & 0x03) << 30) |
			((uint32_t)(input[42] & 0xfc) << 22);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 342 to 349
	value = ((uint32_t)(input[42] & 0x03) << 30) |
			((uint32_t)(input[43] & 0xfc) << 22);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 350 to 357
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)(input[44] & 0xfc) << 22);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 358 to 365
	value = ((uint32_t)(input[44] & 0x03) << 30) |
			((uint32_t)(input[45] & 0xfc) << 22);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 366 to 373
	value = ((uint32_t)(input[45] & 0x03) << 30) |
			((uint32_t)(input[46] & 0xfc) << 22);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 374 to 381
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)(input[47] & 0xfc) << 22);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 382 to 389
	value = ((uint32_t)(input[47] & 0x03) << 30) |
			((uint32_t)(input[48] & 0xfc) << 22);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 390 to 397
	value = ((uint32_t)(input[48] & 0x03) << 30) |
			((uint32_t)(input[49] & 0xfc) << 22);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 398 to 405
	value = ((uint32_t)(input[49] & 0x03) << 30) |
			((uint32_t)(input[50] & 0xfc) << 22);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 406 to 413
	value = ((uint32_t)(input[50] & 0x03) << 30) |
			((uint32_t)(input[51] & 0xfc) << 22);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 414 to 421
	value = ((uint32_t)(input[51] & 0x03) << 30) |
			((uint32_t)(input[52] & 0xfc) << 22);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 422 to 429
	value = ((uint32_t)(input[52] & 0x03) << 30) |
			((uint32_t)(input[53] & 0xfc) << 22);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 430 to 437
	value = ((uint32_t)(input[53] & 0x03) << 30) |
			((uint32_t)(input[54] & 0xfc) << 22);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 438 to 445
	value = ((uint32_t)(input[54] & 0x03) << 30) |
			((uint32_t)(input[55] & 0xfc) << 22);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 446 to 453
	value = ((uint32_t)(input[55] & 0x03) << 30) |
			((uint32_t)(input[56] & 0xfc) << 22);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 454 to 461
	value = ((uint32_t)(input[56] & 0x03) << 30) |
			((uint32_t)(input[57] & 0xfc) << 22);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 462 to 469
	value = ((uint32_t)(input[57] & 0x03) << 30) |
			((uint32_t)(input[58] & 0xfc) << 22);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 470 to 477
	value = ((uint32_t)(input[58] & 0x03) << 30) |
			((uint32_t)(input[59] & 0xfc) << 22);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 478 to 485
	value = ((uint32_t)(input[59] & 0x03) << 30) |
			((uint32_t)(input[60] & 0xfc) << 22);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 486 to 493
	value = ((uint32_t)(input[60] & 0x03) << 30) |
			((uint32_t)(input[61] & 0xfc) << 22);
	output[60] = (double)(value >> 24);
}

static void unpack_61_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 61 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 488 bits of data.
	// Input must be at least 62 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 335 to 342
	value = ((uint32_t)(input[41] & 0x01) << 31) |
			((uint32_t)(input[42] & 0xfe) << 23);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 343 to 350
	value = ((uint32_t)(input[42] & 0x01) << 31) |
			((uint32_t)(input[43] & 0xfe) << 23);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 351 to 358
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)(input[44] & 0xfe) << 23);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 359 to 366
	value = ((uint32_t)(input[44] & 0x01) << 31) |
			((uint32_t)(input[45] & 0xfe) << 23);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 367 to 374
	value = ((uint32_t)(input[45] & 0x01) << 31) |
			((uint32_t)(input[46] & 0xfe) << 23);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 375 to 382
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)(input[47] & 0xfe) << 23);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 383 to 390
	value = ((uint32_t)(input[47] & 0x01) << 31) |
			((uint32_t)(input[48] & 0xfe) << 23);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 391 to 398
	value = ((uint32_t)(input[48] & 0x01) << 31) |
			((uint32_t)(input[49] & 0xfe) << 23);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 399 to 406
	value = ((uint32_t)(input[49] & 0x01) << 31) |
			((uint32_t)(input[50] & 0xfe) << 23);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 407 to 414
	value = ((uint32_t)(input[50] & 0x01) << 31) |
			((uint32_t)(input[51] & 0xfe) << 23);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 415 to 422
	value = ((uint32_t)(input[51] & 0x01) << 31) |
			((uint32_t)(input[52] & 0xfe) << 23);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 423 to 430
	value = ((uint32_t)(input[52] & 0x01) << 31) |
			((uint32_t)(input[53] & 0xfe) << 23);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 431 to 438
	value = ((uint32_t)(input[53] & 0x01) << 31) |
			((uint32_t)(input[54] & 0xfe) << 23);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 439 to 446
	value = ((uint32_t)(input[54] & 0x01) << 31) |
			((uint32_t)(input[55] & 0xfe) << 23);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 447 to 454
	value = ((uint32_t)(input[55] & 0x01) << 31) |
			((uint32_t)(input[56] & 0xfe) << 23);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 455 to 462
	value = ((uint32_t)(input[56] & 0x01) << 31) |
			((uint32_t)(input[57] & 0xfe) << 23);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 463 to 470
	value = ((uint32_t)(input[57] & 0x01) << 31) |
			((uint32_t)(input[58] & 0xfe) << 23);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 471 to 478
	value = ((uint32_t)(input[58] & 0x01) << 31) |
			((uint32_t)(input[59] & 0xfe) << 23);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 479 to 486
	value = ((uint32_t)(input[59] & 0x01) << 31) |
			((uint32_t)(input[60] & 0xfe) << 23);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 487 to 494
	value = ((uint32_t)(input[60] & 0x01) << 31) |
			((uint32_t)(input[61] & 0xfe) << 23);
	output[60] = (double)(value >> 24);
}

static void unpack_61_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 61 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 488 bits of data.
	// Input must be at least 62 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 335 to 342
	value = ((uint32_t)(input[41] & 0x01) << 31) |
			((uint32_t)(input[42] & 0xfe) << 23);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 343 to 350
	value = ((uint32_t)(input[42] & 0x01) << 31) |
			((uint32_t)(input[43] & 0xfe) << 23);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 351 to 358
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)(input[44] & 0xfe) << 23);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 359 to 366
	value = ((uint32_t)(input[44] & 0x01) << 31) |
			((uint32_t)(input[45] & 0xfe) << 23);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 367 to 374
	value = ((uint32_t)(input[45] & 0x01) << 31) |
			((uint32_t)(input[46] & 0xfe) << 23);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 375 to 382
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)(input[47] & 0xfe) << 23);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 383 to 390
	value = ((uint32_t)(input[47] & 0x01) << 31) |
			((uint32_t)(input[48] & 0xfe) << 23);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 391 to 398
	value = ((uint32_t)(input[48] & 0x01) << 31) |
			((uint32_t)(input[49] & 0xfe) << 23);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 399 to 406
	value = ((uint32_t)(input[49] & 0x01) << 31) |
			((uint32_t)(input[50] & 0xfe) << 23);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 407 to 414
	value = ((uint32_t)(input[50] & 0x01) << 31) |
			((uint32_t)(input[51] & 0xfe) << 23);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 415 to 422
	value = ((uint32_t)(input[51] & 0x01) << 31) |
			((uint32_t)(input[52] & 0xfe) << 23);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 423 to 430
	value = ((uint32_t)(input[52] & 0x01) << 31) |
			((uint32_t)(input[53] & 0xfe) << 23);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 431 to 438
	value = ((uint32_t)(input[53] & 0x01) << 31) |
			((uint32_t)(input[54] & 0xfe) << 23);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 439 to 446
	value = ((uint32_t)(input[54] & 0x01) << 31) |
			((uint32_t)(input[55] & 0xfe) << 23);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 447 to 454
	value = ((uint32_t)(input[55] & 0x01) << 31) |
			((uint32_t)(input[56] & 0xfe) << 23);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 455 to 462
	value = ((uint32_t)(input[56] & 0x01) << 31) |
			((uint32_t)(input[57] & 0xfe) << 23);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 463 to 470
	value = ((uint32_t)(input[57] & 0x01) << 31) |
			((uint32_t)(input[58] & 0xfe) << 23);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 471 to 478
	value = ((uint32_t)(input[58] & 0x01) << 31) |
			((uint32_t)(input[59] & 0xfe) << 23);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 479 to 486
	value = ((uint32_t)(input[59] & 0x01) << 31) |
			((uint32_t)(input[60] & 0xfe) << 23);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 487 to 494
	value = ((uint32_t)(input[60] & 0x01) << 31) |
			((uint32_t)(input[61] & 0xfe) << 23);
	output[60] = (double)(value >> 24);
}

static void unpack_62_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 62 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 496 bits of data.
	// Input must be at least 62 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 328 to 335
	value = ((uint32_t)input[41] << 24);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 336 to 343
	value = ((uint32_t)input[42] << 24);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 344 to 351
	value = ((uint32_t)input[43] << 24);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 352 to 359
	value = ((uint32_t)input[44] << 24);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 360 to 367
	value = ((uint32_t)input[45] << 24);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 368 to 375
	value = ((uint32_t)input[46] << 24);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 376 to 383
	value = ((uint32_t)input[47] << 24);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 384 to 391
	value = ((uint32_t)input[48] << 24);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 392 to 399
	value = ((uint32_t)input[49] << 24);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 400 to 407
	value = ((uint32_t)input[50] << 24);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 408 to 415
	value = ((uint32_t)input[51] << 24);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 416 to 423
	value = ((uint32_t)input[52] << 24);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 424 to 431
	value = ((uint32_t)input[53] << 24);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 432 to 439
	value = ((uint32_t)input[54] << 24);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 440 to 447
	value = ((uint32_t)input[55] << 24);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 448 to 455
	value = ((uint32_t)input[56] << 24);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 456 to 463
	value = ((uint32_t)input[57] << 24);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 464 to 471
	value = ((uint32_t)input[58] << 24);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 472 to 479
	value = ((uint32_t)input[59] << 24);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 480 to 487
	value = ((uint32_t)input[60] << 24);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 488 to 495
	value = ((uint32_t)input[61] << 24);
	output[61] = (double)(value >> 24);
}

static void unpack_62_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 62 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 496 bits of data.
	// Input must be at least 62 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 328 to 335
	value = ((uint32_t)input[41] << 24);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 336 to 343
	value = ((uint32_t)input[42] << 24);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 344 to 351
	value = ((uint32_t)input[43] << 24);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 352 to 359
	value = ((uint32_t)input[44] << 24);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 360 to 367
	value = ((uint32_t)input[45] << 24);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 368 to 375
	value = ((uint32_t)input[46] << 24);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 376 to 383
	value = ((uint32_t)input[47] << 24);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 384 to 391
	value = ((uint32_t)input[48] << 24);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 392 to 399
	value = ((uint32_t)input[49] << 24);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 400 to 407
	value = ((uint32_t)input[50] << 24);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 408 to 415
	value = ((uint32_t)input[51] << 24);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 416 to 423
	value = ((uint32_t)input[52] << 24);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 424 to 431
	value = ((uint32_t)input[53] << 24);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 432 to 439
	value = ((uint32_t)input[54] << 24);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 440 to 447
	value = ((uint32_t)input[55] << 24);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 448 to 455
	value = ((uint32_t)input[56] << 24);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 456 to 463
	value = ((uint32_t)input[57] << 24);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 464 to 471
	value = ((uint32_t)input[58] << 24);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 472 to 479
	value = ((uint32_t)input[59] << 24);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 480 to 487
	value = ((uint32_t)input[60] << 24);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 488 to 495
	value = ((uint32_t)input[61] << 24);
	output[61] = (double)(value >> 24);
}

static void unpack_62_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 62 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 496 bits of data.
	// Input must be at least 63 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 329 to 336
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)(input[42] & 0x80) << 17);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 337 to 344
	value = ((uint32_t)(input[42] & 0x7f) << 25) |
			((uint32_t)(input[43] & 0x80) << 17);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 345 to 352
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)(input[44] & 0x80) << 17);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 353 to 360
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)(input[45] & 0x80) << 17);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 361 to 368
	value = ((uint32_t)(input[45] & 0x7f) << 25) |
			((uint32_t)(input[46] & 0x80) << 17);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 369 to 376
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)(input[47] & 0x80) << 17);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 377 to 384
	value = ((uint32_t)(input[47] & 0x7f) << 25) |
			((uint32_t)(input[48] & 0x80) << 17);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 385 to 392
	value = ((uint32_t)(input[48] & 0x7f) << 25) |
			((uint32_t)(input[49] & 0x80) << 17);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 393 to 400
	value = ((uint32_t)(input[49] & 0x7f) << 25) |
			((uint32_t)(input[50] & 0x80) << 17);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 401 to 408
	value = ((uint32_t)(input[50] & 0x7f) << 25) |
			((uint32_t)(input[51] & 0x80) << 17);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 409 to 416
	value = ((uint32_t)(input[51] & 0x7f) << 25) |
			((uint32_t)(input[52] & 0x80) << 17);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 417 to 424
	value = ((uint32_t)(input[52] & 0x7f) << 25) |
			((uint32_t)(input[53] & 0x80) << 17);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 425 to 432
	value = ((uint32_t)(input[53] & 0x7f) << 25) |
			((uint32_t)(input[54] & 0x80) << 17);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 433 to 440
	value = ((uint32_t)(input[54] & 0x7f) << 25) |
			((uint32_t)(input[55] & 0x80) << 17);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 441 to 448
	value = ((uint32_t)(input[55] & 0x7f) << 25) |
			((uint32_t)(input[56] & 0x80) << 17);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 449 to 456
	value = ((uint32_t)(input[56] & 0x7f) << 25) |
			((uint32_t)(input[57] & 0x80) << 17);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 457 to 464
	value = ((uint32_t)(input[57] & 0x7f) << 25) |
			((uint32_t)(input[58] & 0x80) << 17);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 465 to 472
	value = ((uint32_t)(input[58] & 0x7f) << 25) |
			((uint32_t)(input[59] & 0x80) << 17);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 473 to 480
	value = ((uint32_t)(input[59] & 0x7f) << 25) |
			((uint32_t)(input[60] & 0x80) << 17);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 481 to 488
	value = ((uint32_t)(input[60] & 0x7f) << 25) |
			((uint32_t)(input[61] & 0x80) << 17);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 489 to 496
	value = ((uint32_t)(input[61] & 0x7f) << 25) |
			((uint32_t)(input[62] & 0x80) << 17);
	output[61] = (double)(value >> 24);
}

static void unpack_62_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 62 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 496 bits of data.
	// Input must be at least 63 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 329 to 336
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)(input[42] & 0x80) << 17);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 337 to 344
	value = ((uint32_t)(input[42] & 0x7f) << 25) |
			((uint32_t)(input[43] & 0x80) << 17);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 345 to 352
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)(input[44] & 0x80) << 17);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 353 to 360
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)(input[45] & 0x80) << 17);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 361 to 368
	value = ((uint32_t)(input[45] & 0x7f) << 25) |
			((uint32_t)(input[46] & 0x80) << 17);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 369 to 376
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)(input[47] & 0x80) << 17);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 377 to 384
	value = ((uint32_t)(input[47] & 0x7f) << 25) |
			((uint32_t)(input[48] & 0x80) << 17);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 385 to 392
	value = ((uint32_t)(input[48] & 0x7f) << 25) |
			((uint32_t)(input[49] & 0x80) << 17);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 393 to 400
	value = ((uint32_t)(input[49] & 0x7f) << 25) |
			((uint32_t)(input[50] & 0x80) << 17);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 401 to 408
	value = ((uint32_t)(input[50] & 0x7f) << 25) |
			((uint32_t)(input[51] & 0x80) << 17);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 409 to 416
	value = ((uint32_t)(input[51] & 0x7f) << 25) |
			((uint32_t)(input[52] & 0x80) << 17);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 417 to 424
	value = ((uint32_t)(input[52] & 0x7f) << 25) |
			((uint32_t)(input[53] & 0x80) << 17);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 425 to 432
	value = ((uint32_t)(input[53] & 0x7f) << 25) |
			((uint32_t)(input[54] & 0x80) << 17);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 433 to 440
	value = ((uint32_t)(input[54] & 0x7f) << 25) |
			((uint32_t)(input[55] & 0x80) << 17);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 441 to 448
	value = ((uint32_t)(input[55] & 0x7f) << 25) |
			((uint32_t)(input[56] & 0x80) << 17);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 449 to 456
	value = ((uint32_t)(input[56] & 0x7f) << 25) |
			((uint32_t)(input[57] & 0x80) << 17);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 457 to 464
	value = ((uint32_t)(input[57] & 0x7f) << 25) |
			((uint32_t)(input[58] & 0x80) << 17);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 465 to 472
	value = ((uint32_t)(input[58] & 0x7f) << 25) |
			((uint32_t)(input[59] & 0x80) << 17);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 473 to 480
	value = ((uint32_t)(input[59] & 0x7f) << 25) |
			((uint32_t)(input[60] & 0x80) << 17);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 481 to 488
	value = ((uint32_t)(input[60] & 0x7f) << 25) |
			((uint32_t)(input[61] & 0x80) << 17);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 489 to 496
	value = ((uint32_t)(input[61] & 0x7f) << 25) |
			((uint32_t)(input[62] & 0x80) << 17);
	output[61] = (double)(value >> 24);
}

static void unpack_62_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 62 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 496 bits of data.
	// Input must be at least 63 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 330 to 337
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)(input[42] & 0xc0) << 18);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 338 to 345
	value = ((uint32_t)(input[42] & 0x3f) << 26) |
			((uint32_t)(input[43] & 0xc0) << 18);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 346 to 353
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)(input[44] & 0xc0) << 18);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 354 to 361
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)(input[45] & 0xc0) << 18);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 362 to 369
	value = ((uint32_t)(input[45] & 0x3f) << 26) |
			((uint32_t)(input[46] & 0xc0) << 18);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 370 to 377
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)(input[47] & 0xc0) << 18);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 378 to 385
	value = ((uint32_t)(input[47] & 0x3f) << 26) |
			((uint32_t)(input[48] & 0xc0) << 18);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 386 to 393
	value = ((uint32_t)(input[48] & 0x3f) << 26) |
			((uint32_t)(input[49] & 0xc0) << 18);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 394 to 401
	value = ((uint32_t)(input[49] & 0x3f) << 26) |
			((uint32_t)(input[50] & 0xc0) << 18);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 402 to 409
	value = ((uint32_t)(input[50] & 0x3f) << 26) |
			((uint32_t)(input[51] & 0xc0) << 18);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 410 to 417
	value = ((uint32_t)(input[51] & 0x3f) << 26) |
			((uint32_t)(input[52] & 0xc0) << 18);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 418 to 425
	value = ((uint32_t)(input[52] & 0x3f) << 26) |
			((uint32_t)(input[53] & 0xc0) << 18);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 426 to 433
	value = ((uint32_t)(input[53] & 0x3f) << 26) |
			((uint32_t)(input[54] & 0xc0) << 18);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 434 to 441
	value = ((uint32_t)(input[54] & 0x3f) << 26) |
			((uint32_t)(input[55] & 0xc0) << 18);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 442 to 449
	value = ((uint32_t)(input[55] & 0x3f) << 26) |
			((uint32_t)(input[56] & 0xc0) << 18);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 450 to 457
	value = ((uint32_t)(input[56] & 0x3f) << 26) |
			((uint32_t)(input[57] & 0xc0) << 18);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 458 to 465
	value = ((uint32_t)(input[57] & 0x3f) << 26) |
			((uint32_t)(input[58] & 0xc0) << 18);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 466 to 473
	value = ((uint32_t)(input[58] & 0x3f) << 26) |
			((uint32_t)(input[59] & 0xc0) << 18);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 474 to 481
	value = ((uint32_t)(input[59] & 0x3f) << 26) |
			((uint32_t)(input[60] & 0xc0) << 18);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 482 to 489
	value = ((uint32_t)(input[60] & 0x3f) << 26) |
			((uint32_t)(input[61] & 0xc0) << 18);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 490 to 497
	value = ((uint32_t)(input[61] & 0x3f) << 26) |
			((uint32_t)(input[62] & 0xc0) << 18);
	output[61] = (double)(value >> 24);
}

static void unpack_62_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 62 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 496 bits of data.
	// Input must be at least 63 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 330 to 337
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)(input[42] & 0xc0) << 18);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 338 to 345
	value = ((uint32_t)(input[42] & 0x3f) << 26) |
			((uint32_t)(input[43] & 0xc0) << 18);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 346 to 353
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)(input[44] & 0xc0) << 18);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 354 to 361
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)(input[45] & 0xc0) << 18);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 362 to 369
	value = ((uint32_t)(input[45] & 0x3f) << 26) |
			((uint32_t)(input[46] & 0xc0) << 18);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 370 to 377
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)(input[47] & 0xc0) << 18);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 378 to 385
	value = ((uint32_t)(input[47] & 0x3f) << 26) |
			((uint32_t)(input[48] & 0xc0) << 18);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 386 to 393
	value = ((uint32_t)(input[48] & 0x3f) << 26) |
			((uint32_t)(input[49] & 0xc0) << 18);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 394 to 401
	value = ((uint32_t)(input[49] & 0x3f) << 26) |
			((uint32_t)(input[50] & 0xc0) << 18);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 402 to 409
	value = ((uint32_t)(input[50] & 0x3f) << 26) |
			((uint32_t)(input[51] & 0xc0) << 18);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 410 to 417
	value = ((uint32_t)(input[51] & 0x3f) << 26) |
			((uint32_t)(input[52] & 0xc0) << 18);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 418 to 425
	value = ((uint32_t)(input[52] & 0x3f) << 26) |
			((uint32_t)(input[53] & 0xc0) << 18);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 426 to 433
	value = ((uint32_t)(input[53] & 0x3f) << 26) |
			((uint32_t)(input[54] & 0xc0) << 18);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 434 to 441
	value = ((uint32_t)(input[54] & 0x3f) << 26) |
			((uint32_t)(input[55] & 0xc0) << 18);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 442 to 449
	value = ((uint32_t)(input[55] & 0x3f) << 26) |
			((uint32_t)(input[56] & 0xc0) << 18);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 450 to 457
	value = ((uint32_t)(input[56] & 0x3f) << 26) |
			((uint32_t)(input[57] & 0xc0) << 18);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 458 to 465
	value = ((uint32_t)(input[57] & 0x3f) << 26) |
			((uint32_t)(input[58] & 0xc0) << 18);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 466 to 473
	value = ((uint32_t)(input[58] & 0x3f) << 26) |
			((uint32_t)(input[59] & 0xc0) << 18);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 474 to 481
	value = ((uint32_t)(input[59] & 0x3f) << 26) |
			((uint32_t)(input[60] & 0xc0) << 18);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 482 to 489
	value = ((uint32_t)(input[60] & 0x3f) << 26) |
			((uint32_t)(input[61] & 0xc0) << 18);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 490 to 497
	value = ((uint32_t)(input[61] & 0x3f) << 26) |
			((uint32_t)(input[62] & 0xc0) << 18);
	output[61] = (double)(value >> 24);
}

static void unpack_62_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 62 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 496 bits of data.
	// Input must be at least 63 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 331 to 338
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)(input[42] & 0xe0) << 19);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 339 to 346
	value = ((uint32_t)(input[42] & 0x1f) << 27) |
			((uint32_t)(input[43] & 0xe0) << 19);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 347 to 354
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)(input[44] & 0xe0) << 19);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 355 to 362
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)(input[45] & 0xe0) << 19);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 363 to 370
	value = ((uint32_t)(input[45] & 0x1f) << 27) |
			((uint32_t)(input[46] & 0xe0) << 19);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 371 to 378
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)(input[47] & 0xe0) << 19);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 379 to 386
	value = ((uint32_t)(input[47] & 0x1f) << 27) |
			((uint32_t)(input[48] & 0xe0) << 19);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 387 to 394
	value = ((uint32_t)(input[48] & 0x1f) << 27) |
			((uint32_t)(input[49] & 0xe0) << 19);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 395 to 402
	value = ((uint32_t)(input[49] & 0x1f) << 27) |
			((uint32_t)(input[50] & 0xe0) << 19);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 403 to 410
	value = ((uint32_t)(input[50] & 0x1f) << 27) |
			((uint32_t)(input[51] & 0xe0) << 19);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 411 to 418
	value = ((uint32_t)(input[51] & 0x1f) << 27) |
			((uint32_t)(input[52] & 0xe0) << 19);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 419 to 426
	value = ((uint32_t)(input[52] & 0x1f) << 27) |
			((uint32_t)(input[53] & 0xe0) << 19);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 427 to 434
	value = ((uint32_t)(input[53] & 0x1f) << 27) |
			((uint32_t)(input[54] & 0xe0) << 19);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 435 to 442
	value = ((uint32_t)(input[54] & 0x1f) << 27) |
			((uint32_t)(input[55] & 0xe0) << 19);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 443 to 450
	value = ((uint32_t)(input[55] & 0x1f) << 27) |
			((uint32_t)(input[56] & 0xe0) << 19);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 451 to 458
	value = ((uint32_t)(input[56] & 0x1f) << 27) |
			((uint32_t)(input[57] & 0xe0) << 19);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 459 to 466
	value = ((uint32_t)(input[57] & 0x1f) << 27) |
			((uint32_t)(input[58] & 0xe0) << 19);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 467 to 474
	value = ((uint32_t)(input[58] & 0x1f) << 27) |
			((uint32_t)(input[59] & 0xe0) << 19);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 475 to 482
	value = ((uint32_t)(input[59] & 0x1f) << 27) |
			((uint32_t)(input[60] & 0xe0) << 19);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 483 to 490
	value = ((uint32_t)(input[60] & 0x1f) << 27) |
			((uint32_t)(input[61] & 0xe0) << 19);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 491 to 498
	value = ((uint32_t)(input[61] & 0x1f) << 27) |
			((uint32_t)(input[62] & 0xe0) << 19);
	output[61] = (double)(value >> 24);
}

static void unpack_62_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 62 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 496 bits of data.
	// Input must be at least 63 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 331 to 338
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)(input[42] & 0xe0) << 19);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 339 to 346
	value = ((uint32_t)(input[42] & 0x1f) << 27) |
			((uint32_t)(input[43] & 0xe0) << 19);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 347 to 354
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)(input[44] & 0xe0) << 19);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 355 to 362
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)(input[45] & 0xe0) << 19);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 363 to 370
	value = ((uint32_t)(input[45] & 0x1f) << 27) |
			((uint32_t)(input[46] & 0xe0) << 19);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 371 to 378
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)(input[47] & 0xe0) << 19);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 379 to 386
	value = ((uint32_t)(input[47] & 0x1f) << 27) |
			((uint32_t)(input[48] & 0xe0) << 19);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 387 to 394
	value = ((uint32_t)(input[48] & 0x1f) << 27) |
			((uint32_t)(input[49] & 0xe0) << 19);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 395 to 402
	value = ((uint32_t)(input[49] & 0x1f) << 27) |
			((uint32_t)(input[50] & 0xe0) << 19);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 403 to 410
	value = ((uint32_t)(input[50] & 0x1f) << 27) |
			((uint32_t)(input[51] & 0xe0) << 19);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 411 to 418
	value = ((uint32_t)(input[51] & 0x1f) << 27) |
			((uint32_t)(input[52] & 0xe0) << 19);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 419 to 426
	value = ((uint32_t)(input[52] & 0x1f) << 27) |
			((uint32_t)(input[53] & 0xe0) << 19);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 427 to 434
	value = ((uint32_t)(input[53] & 0x1f) << 27) |
			((uint32_t)(input[54] & 0xe0) << 19);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 435 to 442
	value = ((uint32_t)(input[54] & 0x1f) << 27) |
			((uint32_t)(input[55] & 0xe0) << 19);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 443 to 450
	value = ((uint32_t)(input[55] & 0x1f) << 27) |
			((uint32_t)(input[56] & 0xe0) << 19);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 451 to 458
	value = ((uint32_t)(input[56] & 0x1f) << 27) |
			((uint32_t)(input[57] & 0xe0) << 19);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 459 to 466
	value = ((uint32_t)(input[57] & 0x1f) << 27) |
			((uint32_t)(input[58] & 0xe0) << 19);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 467 to 474
	value = ((uint32_t)(input[58] & 0x1f) << 27) |
			((uint32_t)(input[59] & 0xe0) << 19);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 475 to 482
	value = ((uint32_t)(input[59] & 0x1f) << 27) |
			((uint32_t)(input[60] & 0xe0) << 19);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 483 to 490
	value = ((uint32_t)(input[60] & 0x1f) << 27) |
			((uint32_t)(input[61] & 0xe0) << 19);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 491 to 498
	value = ((uint32_t)(input[61] & 0x1f) << 27) |
			((uint32_t)(input[62] & 0xe0) << 19);
	output[61] = (double)(value >> 24);
}

static void unpack_62_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 62 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 496 bits of data.
	// Input must be at least 63 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 332 to 339
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)(input[42] & 0xf0) << 20);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 340 to 347
	value = ((uint32_t)(input[42] & 0x0f) << 28) |
			((uint32_t)(input[43] & 0xf0) << 20);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 348 to 355
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)(input[44] & 0xf0) << 20);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 356 to 363
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)(input[45] & 0xf0) << 20);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 364 to 371
	value = ((uint32_t)(input[45] & 0x0f) << 28) |
			((uint32_t)(input[46] & 0xf0) << 20);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 372 to 379
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)(input[47] & 0xf0) << 20);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 380 to 387
	value = ((uint32_t)(input[47] & 0x0f) << 28) |
			((uint32_t)(input[48] & 0xf0) << 20);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 388 to 395
	value = ((uint32_t)(input[48] & 0x0f) << 28) |
			((uint32_t)(input[49] & 0xf0) << 20);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 396 to 403
	value = ((uint32_t)(input[49] & 0x0f) << 28) |
			((uint32_t)(input[50] & 0xf0) << 20);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 404 to 411
	value = ((uint32_t)(input[50] & 0x0f) << 28) |
			((uint32_t)(input[51] & 0xf0) << 20);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 412 to 419
	value = ((uint32_t)(input[51] & 0x0f) << 28) |
			((uint32_t)(input[52] & 0xf0) << 20);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 420 to 427
	value = ((uint32_t)(input[52] & 0x0f) << 28) |
			((uint32_t)(input[53] & 0xf0) << 20);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 428 to 435
	value = ((uint32_t)(input[53] & 0x0f) << 28) |
			((uint32_t)(input[54] & 0xf0) << 20);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 436 to 443
	value = ((uint32_t)(input[54] & 0x0f) << 28) |
			((uint32_t)(input[55] & 0xf0) << 20);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 444 to 451
	value = ((uint32_t)(input[55] & 0x0f) << 28) |
			((uint32_t)(input[56] & 0xf0) << 20);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 452 to 459
	value = ((uint32_t)(input[56] & 0x0f) << 28) |
			((uint32_t)(input[57] & 0xf0) << 20);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 460 to 467
	value = ((uint32_t)(input[57] & 0x0f) << 28) |
			((uint32_t)(input[58] & 0xf0) << 20);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 468 to 475
	value = ((uint32_t)(input[58] & 0x0f) << 28) |
			((uint32_t)(input[59] & 0xf0) << 20);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 476 to 483
	value = ((uint32_t)(input[59] & 0x0f) << 28) |
			((uint32_t)(input[60] & 0xf0) << 20);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 484 to 491
	value = ((uint32_t)(input[60] & 0x0f) << 28) |
			((uint32_t)(input[61] & 0xf0) << 20);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 492 to 499
	value = ((uint32_t)(input[61] & 0x0f) << 28) |
			((uint32_t)(input[62] & 0xf0) << 20);
	output[61] = (double)(value >> 24);
}

static void unpack_62_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 62 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 496 bits of data.
	// Input must be at least 63 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 332 to 339
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)(input[42] & 0xf0) << 20);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 340 to 347
	value = ((uint32_t)(input[42] & 0x0f) << 28) |
			((uint32_t)(input[43] & 0xf0) << 20);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 348 to 355
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)(input[44] & 0xf0) << 20);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 356 to 363
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)(input[45] & 0xf0) << 20);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 364 to 371
	value = ((uint32_t)(input[45] & 0x0f) << 28) |
			((uint32_t)(input[46] & 0xf0) << 20);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 372 to 379
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)(input[47] & 0xf0) << 20);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 380 to 387
	value = ((uint32_t)(input[47] & 0x0f) << 28) |
			((uint32_t)(input[48] & 0xf0) << 20);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 388 to 395
	value = ((uint32_t)(input[48] & 0x0f) << 28) |
			((uint32_t)(input[49] & 0xf0) << 20);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 396 to 403
	value = ((uint32_t)(input[49] & 0x0f) << 28) |
			((uint32_t)(input[50] & 0xf0) << 20);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 404 to 411
	value = ((uint32_t)(input[50] & 0x0f) << 28) |
			((uint32_t)(input[51] & 0xf0) << 20);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 412 to 419
	value = ((uint32_t)(input[51] & 0x0f) << 28) |
			((uint32_t)(input[52] & 0xf0) << 20);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 420 to 427
	value = ((uint32_t)(input[52] & 0x0f) << 28) |
			((uint32_t)(input[53] & 0xf0) << 20);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 428 to 435
	value = ((uint32_t)(input[53] & 0x0f) << 28) |
			((uint32_t)(input[54] & 0xf0) << 20);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 436 to 443
	value = ((uint32_t)(input[54] & 0x0f) << 28) |
			((uint32_t)(input[55] & 0xf0) << 20);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 444 to 451
	value = ((uint32_t)(input[55] & 0x0f) << 28) |
			((uint32_t)(input[56] & 0xf0) << 20);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 452 to 459
	value = ((uint32_t)(input[56] & 0x0f) << 28) |
			((uint32_t)(input[57] & 0xf0) << 20);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 460 to 467
	value = ((uint32_t)(input[57] & 0x0f) << 28) |
			((uint32_t)(input[58] & 0xf0) << 20);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 468 to 475
	value = ((uint32_t)(input[58] & 0x0f) << 28) |
			((uint32_t)(input[59] & 0xf0) << 20);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 476 to 483
	value = ((uint32_t)(input[59] & 0x0f) << 28) |
			((uint32_t)(input[60] & 0xf0) << 20);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 484 to 491
	value = ((uint32_t)(input[60] & 0x0f) << 28) |
			((uint32_t)(input[61] & 0xf0) << 20);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 492 to 499
	value = ((uint32_t)(input[61] & 0x0f) << 28) |
			((uint32_t)(input[62] & 0xf0) << 20);
	output[61] = (double)(value >> 24);
}

static void unpack_62_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 62 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 496 bits of data.
	// Input must be at least 63 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 333 to 340
	value = ((uint32_t)(input[41] & 0x07) << 29) |
			((uint32_t)(input[42] & 0xf8) << 21);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 341 to 348
	value = ((uint32_t)(input[42] & 0x07) << 29) |
			((uint32_t)(input[43] & 0xf8) << 21);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 349 to 356
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)(input[44] & 0xf8) << 21);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 357 to 364
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)(input[45] & 0xf8) << 21);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 365 to 372
	value = ((uint32_t)(input[45] & 0x07) << 29) |
			((uint32_t)(input[46] & 0xf8) << 21);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 373 to 380
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)(input[47] & 0xf8) << 21);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 381 to 388
	value = ((uint32_t)(input[47] & 0x07) << 29) |
			((uint32_t)(input[48] & 0xf8) << 21);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 389 to 396
	value = ((uint32_t)(input[48] & 0x07) << 29) |
			((uint32_t)(input[49] & 0xf8) << 21);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 397 to 404
	value = ((uint32_t)(input[49] & 0x07) << 29) |
			((uint32_t)(input[50] & 0xf8) << 21);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 405 to 412
	value = ((uint32_t)(input[50] & 0x07) << 29) |
			((uint32_t)(input[51] & 0xf8) << 21);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 413 to 420
	value = ((uint32_t)(input[51] & 0x07) << 29) |
			((uint32_t)(input[52] & 0xf8) << 21);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 421 to 428
	value = ((uint32_t)(input[52] & 0x07) << 29) |
			((uint32_t)(input[53] & 0xf8) << 21);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 429 to 436
	value = ((uint32_t)(input[53] & 0x07) << 29) |
			((uint32_t)(input[54] & 0xf8) << 21);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 437 to 444
	value = ((uint32_t)(input[54] & 0x07) << 29) |
			((uint32_t)(input[55] & 0xf8) << 21);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 445 to 452
	value = ((uint32_t)(input[55] & 0x07) << 29) |
			((uint32_t)(input[56] & 0xf8) << 21);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 453 to 460
	value = ((uint32_t)(input[56] & 0x07) << 29) |
			((uint32_t)(input[57] & 0xf8) << 21);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 461 to 468
	value = ((uint32_t)(input[57] & 0x07) << 29) |
			((uint32_t)(input[58] & 0xf8) << 21);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 469 to 476
	value = ((uint32_t)(input[58] & 0x07) << 29) |
			((uint32_t)(input[59] & 0xf8) << 21);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 477 to 484
	value = ((uint32_t)(input[59] & 0x07) << 29) |
			((uint32_t)(input[60] & 0xf8) << 21);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 485 to 492
	value = ((uint32_t)(input[60] & 0x07) << 29) |
			((uint32_t)(input[61] & 0xf8) << 21);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 493 to 500
	value = ((uint32_t)(input[61] & 0x07) << 29) |
			((uint32_t)(input[62] & 0xf8) << 21);
	output[61] = (double)(value >> 24);
}

static void unpack_62_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 62 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 496 bits of data.
	// Input must be at least 63 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 333 to 340
	value = ((uint32_t)(input[41] & 0x07) << 29) |
			((uint32_t)(input[42] & 0xf8) << 21);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 341 to 348
	value = ((uint32_t)(input[42] & 0x07) << 29) |
			((uint32_t)(input[43] & 0xf8) << 21);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 349 to 356
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)(input[44] & 0xf8) << 21);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 357 to 364
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)(input[45] & 0xf8) << 21);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 365 to 372
	value = ((uint32_t)(input[45] & 0x07) << 29) |
			((uint32_t)(input[46] & 0xf8) << 21);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 373 to 380
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)(input[47] & 0xf8) << 21);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 381 to 388
	value = ((uint32_t)(input[47] & 0x07) << 29) |
			((uint32_t)(input[48] & 0xf8) << 21);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 389 to 396
	value = ((uint32_t)(input[48] & 0x07) << 29) |
			((uint32_t)(input[49] & 0xf8) << 21);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 397 to 404
	value = ((uint32_t)(input[49] & 0x07) << 29) |
			((uint32_t)(input[50] & 0xf8) << 21);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 405 to 412
	value = ((uint32_t)(input[50] & 0x07) << 29) |
			((uint32_t)(input[51] & 0xf8) << 21);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 413 to 420
	value = ((uint32_t)(input[51] & 0x07) << 29) |
			((uint32_t)(input[52] & 0xf8) << 21);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 421 to 428
	value = ((uint32_t)(input[52] & 0x07) << 29) |
			((uint32_t)(input[53] & 0xf8) << 21);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 429 to 436
	value = ((uint32_t)(input[53] & 0x07) << 29) |
			((uint32_t)(input[54] & 0xf8) << 21);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 437 to 444
	value = ((uint32_t)(input[54] & 0x07) << 29) |
			((uint32_t)(input[55] & 0xf8) << 21);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 445 to 452
	value = ((uint32_t)(input[55] & 0x07) << 29) |
			((uint32_t)(input[56] & 0xf8) << 21);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 453 to 460
	value = ((uint32_t)(input[56] & 0x07) << 29) |
			((uint32_t)(input[57] & 0xf8) << 21);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 461 to 468
	value = ((uint32_t)(input[57] & 0x07) << 29) |
			((uint32_t)(input[58] & 0xf8) << 21);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 469 to 476
	value = ((uint32_t)(input[58] & 0x07) << 29) |
			((uint32_t)(input[59] & 0xf8) << 21);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 477 to 484
	value = ((uint32_t)(input[59] & 0x07) << 29) |
			((uint32_t)(input[60] & 0xf8) << 21);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 485 to 492
	value = ((uint32_t)(input[60] & 0x07) << 29) |
			((uint32_t)(input[61] & 0xf8) << 21);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 493 to 500
	value = ((uint32_t)(input[61] & 0x07) << 29) |
			((uint32_t)(input[62] & 0xf8) << 21);
	output[61] = (double)(value >> 24);
}

static void unpack_62_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 62 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 496 bits of data.
	// Input must be at least 63 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 334 to 341
	value = ((uint32_t)(input[41] & 0x03) << 30) |
			((uint32_t)(input[42] & 0xfc) << 22);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 342 to 349
	value = ((uint32_t)(input[42] & 0x03) << 30) |
			((uint32_t)(input[43] & 0xfc) << 22);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 350 to 357
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)(input[44] & 0xfc) << 22);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 358 to 365
	value = ((uint32_t)(input[44] & 0x03) << 30) |
			((uint32_t)(input[45] & 0xfc) << 22);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 366 to 373
	value = ((uint32_t)(input[45] & 0x03) << 30) |
			((uint32_t)(input[46] & 0xfc) << 22);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 374 to 381
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)(input[47] & 0xfc) << 22);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 382 to 389
	value = ((uint32_t)(input[47] & 0x03) << 30) |
			((uint32_t)(input[48] & 0xfc) << 22);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 390 to 397
	value = ((uint32_t)(input[48] & 0x03) << 30) |
			((uint32_t)(input[49] & 0xfc) << 22);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 398 to 405
	value = ((uint32_t)(input[49] & 0x03) << 30) |
			((uint32_t)(input[50] & 0xfc) << 22);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 406 to 413
	value = ((uint32_t)(input[50] & 0x03) << 30) |
			((uint32_t)(input[51] & 0xfc) << 22);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 414 to 421
	value = ((uint32_t)(input[51] & 0x03) << 30) |
			((uint32_t)(input[52] & 0xfc) << 22);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 422 to 429
	value = ((uint32_t)(input[52] & 0x03) << 30) |
			((uint32_t)(input[53] & 0xfc) << 22);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 430 to 437
	value = ((uint32_t)(input[53] & 0x03) << 30) |
			((uint32_t)(input[54] & 0xfc) << 22);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 438 to 445
	value = ((uint32_t)(input[54] & 0x03) << 30) |
			((uint32_t)(input[55] & 0xfc) << 22);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 446 to 453
	value = ((uint32_t)(input[55] & 0x03) << 30) |
			((uint32_t)(input[56] & 0xfc) << 22);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 454 to 461
	value = ((uint32_t)(input[56] & 0x03) << 30) |
			((uint32_t)(input[57] & 0xfc) << 22);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 462 to 469
	value = ((uint32_t)(input[57] & 0x03) << 30) |
			((uint32_t)(input[58] & 0xfc) << 22);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 470 to 477
	value = ((uint32_t)(input[58] & 0x03) << 30) |
			((uint32_t)(input[59] & 0xfc) << 22);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 478 to 485
	value = ((uint32_t)(input[59] & 0x03) << 30) |
			((uint32_t)(input[60] & 0xfc) << 22);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 486 to 493
	value = ((uint32_t)(input[60] & 0x03) << 30) |
			((uint32_t)(input[61] & 0xfc) << 22);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 494 to 501
	value = ((uint32_t)(input[61] & 0x03) << 30) |
			((uint32_t)(input[62] & 0xfc) << 22);
	output[61] = (double)(value >> 24);
}

static void unpack_62_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 62 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 496 bits of data.
	// Input must be at least 63 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 334 to 341
	value = ((uint32_t)(input[41] & 0x03) << 30) |
			((uint32_t)(input[42] & 0xfc) << 22);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 342 to 349
	value = ((uint32_t)(input[42] & 0x03) << 30) |
			((uint32_t)(input[43] & 0xfc) << 22);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 350 to 357
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)(input[44] & 0xfc) << 22);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 358 to 365
	value = ((uint32_t)(input[44] & 0x03) << 30) |
			((uint32_t)(input[45] & 0xfc) << 22);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 366 to 373
	value = ((uint32_t)(input[45] & 0x03) << 30) |
			((uint32_t)(input[46] & 0xfc) << 22);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 374 to 381
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)(input[47] & 0xfc) << 22);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 382 to 389
	value = ((uint32_t)(input[47] & 0x03) << 30) |
			((uint32_t)(input[48] & 0xfc) << 22);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 390 to 397
	value = ((uint32_t)(input[48] & 0x03) << 30) |
			((uint32_t)(input[49] & 0xfc) << 22);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 398 to 405
	value = ((uint32_t)(input[49] & 0x03) << 30) |
			((uint32_t)(input[50] & 0xfc) << 22);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 406 to 413
	value = ((uint32_t)(input[50] & 0x03) << 30) |
			((uint32_t)(input[51] & 0xfc) << 22);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 414 to 421
	value = ((uint32_t)(input[51] & 0x03) << 30) |
			((uint32_t)(input[52] & 0xfc) << 22);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 422 to 429
	value = ((uint32_t)(input[52] & 0x03) << 30) |
			((uint32_t)(input[53] & 0xfc) << 22);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 430 to 437
	value = ((uint32_t)(input[53] & 0x03) << 30) |
			((uint32_t)(input[54] & 0xfc) << 22);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 438 to 445
	value = ((uint32_t)(input[54] & 0x03) << 30) |
			((uint32_t)(input[55] & 0xfc) << 22);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 446 to 453
	value = ((uint32_t)(input[55] & 0x03) << 30) |
			((uint32_t)(input[56] & 0xfc) << 22);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 454 to 461
	value = ((uint32_t)(input[56] & 0x03) << 30) |
			((uint32_t)(input[57] & 0xfc) << 22);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 462 to 469
	value = ((uint32_t)(input[57] & 0x03) << 30) |
			((uint32_t)(input[58] & 0xfc) << 22);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 470 to 477
	value = ((uint32_t)(input[58] & 0x03) << 30) |
			((uint32_t)(input[59] & 0xfc) << 22);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 478 to 485
	value = ((uint32_t)(input[59] & 0x03) << 30) |
			((uint32_t)(input[60] & 0xfc) << 22);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 486 to 493
	value = ((uint32_t)(input[60] & 0x03) << 30) |
			((uint32_t)(input[61] & 0xfc) << 22);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 494 to 501
	value = ((uint32_t)(input[61] & 0x03) << 30) |
			((uint32_t)(input[62] & 0xfc) << 22);
	output[61] = (double)(value >> 24);
}

static void unpack_62_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 62 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 496 bits of data.
	// Input must be at least 63 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 335 to 342
	value = ((uint32_t)(input[41] & 0x01) << 31) |
			((uint32_t)(input[42] & 0xfe) << 23);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 343 to 350
	value = ((uint32_t)(input[42] & 0x01) << 31) |
			((uint32_t)(input[43] & 0xfe) << 23);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 351 to 358
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)(input[44] & 0xfe) << 23);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 359 to 366
	value = ((uint32_t)(input[44] & 0x01) << 31) |
			((uint32_t)(input[45] & 0xfe) << 23);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 367 to 374
	value = ((uint32_t)(input[45] & 0x01) << 31) |
			((uint32_t)(input[46] & 0xfe) << 23);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 375 to 382
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)(input[47] & 0xfe) << 23);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 383 to 390
	value = ((uint32_t)(input[47] & 0x01) << 31) |
			((uint32_t)(input[48] & 0xfe) << 23);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 391 to 398
	value = ((uint32_t)(input[48] & 0x01) << 31) |
			((uint32_t)(input[49] & 0xfe) << 23);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 399 to 406
	value = ((uint32_t)(input[49] & 0x01) << 31) |
			((uint32_t)(input[50] & 0xfe) << 23);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 407 to 414
	value = ((uint32_t)(input[50] & 0x01) << 31) |
			((uint32_t)(input[51] & 0xfe) << 23);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 415 to 422
	value = ((uint32_t)(input[51] & 0x01) << 31) |
			((uint32_t)(input[52] & 0xfe) << 23);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 423 to 430
	value = ((uint32_t)(input[52] & 0x01) << 31) |
			((uint32_t)(input[53] & 0xfe) << 23);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 431 to 438
	value = ((uint32_t)(input[53] & 0x01) << 31) |
			((uint32_t)(input[54] & 0xfe) << 23);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 439 to 446
	value = ((uint32_t)(input[54] & 0x01) << 31) |
			((uint32_t)(input[55] & 0xfe) << 23);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 447 to 454
	value = ((uint32_t)(input[55] & 0x01) << 31) |
			((uint32_t)(input[56] & 0xfe) << 23);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 455 to 462
	value = ((uint32_t)(input[56] & 0x01) << 31) |
			((uint32_t)(input[57] & 0xfe) << 23);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 463 to 470
	value = ((uint32_t)(input[57] & 0x01) << 31) |
			((uint32_t)(input[58] & 0xfe) << 23);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 471 to 478
	value = ((uint32_t)(input[58] & 0x01) << 31) |
			((uint32_t)(input[59] & 0xfe) << 23);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 479 to 486
	value = ((uint32_t)(input[59] & 0x01) << 31) |
			((uint32_t)(input[60] & 0xfe) << 23);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 487 to 494
	value = ((uint32_t)(input[60] & 0x01) << 31) |
			((uint32_t)(input[61] & 0xfe) << 23);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 495 to 502
	value = ((uint32_t)(input[61] & 0x01) << 31) |
			((uint32_t)(input[62] & 0xfe) << 23);
	output[61] = (double)(value >> 24);
}

static void unpack_62_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 62 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 496 bits of data.
	// Input must be at least 63 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 335 to 342
	value = ((uint32_t)(input[41] & 0x01) << 31) |
			((uint32_t)(input[42] & 0xfe) << 23);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 343 to 350
	value = ((uint32_t)(input[42] & 0x01) << 31) |
			((uint32_t)(input[43] & 0xfe) << 23);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 351 to 358
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)(input[44] & 0xfe) << 23);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 359 to 366
	value = ((uint32_t)(input[44] & 0x01) << 31) |
			((uint32_t)(input[45] & 0xfe) << 23);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 367 to 374
	value = ((uint32_t)(input[45] & 0x01) << 31) |
			((uint32_t)(input[46] & 0xfe) << 23);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 375 to 382
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)(input[47] & 0xfe) << 23);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 383 to 390
	value = ((uint32_t)(input[47] & 0x01) << 31) |
			((uint32_t)(input[48] & 0xfe) << 23);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 391 to 398
	value = ((uint32_t)(input[48] & 0x01) << 31) |
			((uint32_t)(input[49] & 0xfe) << 23);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 399 to 406
	value = ((uint32_t)(input[49] & 0x01) << 31) |
			((uint32_t)(input[50] & 0xfe) << 23);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 407 to 414
	value = ((uint32_t)(input[50] & 0x01) << 31) |
			((uint32_t)(input[51] & 0xfe) << 23);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 415 to 422
	value = ((uint32_t)(input[51] & 0x01) << 31) |
			((uint32_t)(input[52] & 0xfe) << 23);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 423 to 430
	value = ((uint32_t)(input[52] & 0x01) << 31) |
			((uint32_t)(input[53] & 0xfe) << 23);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 431 to 438
	value = ((uint32_t)(input[53] & 0x01) << 31) |
			((uint32_t)(input[54] & 0xfe) << 23);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 439 to 446
	value = ((uint32_t)(input[54] & 0x01) << 31) |
			((uint32_t)(input[55] & 0xfe) << 23);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 447 to 454
	value = ((uint32_t)(input[55] & 0x01) << 31) |
			((uint32_t)(input[56] & 0xfe) << 23);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 455 to 462
	value = ((uint32_t)(input[56] & 0x01) << 31) |
			((uint32_t)(input[57] & 0xfe) << 23);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 463 to 470
	value = ((uint32_t)(input[57] & 0x01) << 31) |
			((uint32_t)(input[58] & 0xfe) << 23);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 471 to 478
	value = ((uint32_t)(input[58] & 0x01) << 31) |
			((uint32_t)(input[59] & 0xfe) << 23);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 479 to 486
	value = ((uint32_t)(input[59] & 0x01) << 31) |
			((uint32_t)(input[60] & 0xfe) << 23);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 487 to 494
	value = ((uint32_t)(input[60] & 0x01) << 31) |
			((uint32_t)(input[61] & 0xfe) << 23);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 495 to 502
	value = ((uint32_t)(input[61] & 0x01) << 31) |
			((uint32_t)(input[62] & 0xfe) << 23);
	output[61] = (double)(value >> 24);
}

static void unpack_63_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 63 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 504 bits of data.
	// Input must be at least 63 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 328 to 335
	value = ((uint32_t)input[41] << 24);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 336 to 343
	value = ((uint32_t)input[42] << 24);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 344 to 351
	value = ((uint32_t)input[43] << 24);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 352 to 359
	value = ((uint32_t)input[44] << 24);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 360 to 367
	value = ((uint32_t)input[45] << 24);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 368 to 375
	value = ((uint32_t)input[46] << 24);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 376 to 383
	value = ((uint32_t)input[47] << 24);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 384 to 391
	value = ((uint32_t)input[48] << 24);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 392 to 399
	value = ((uint32_t)input[49] << 24);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 400 to 407
	value = ((uint32_t)input[50] << 24);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 408 to 415
	value = ((uint32_t)input[51] << 24);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 416 to 423
	value = ((uint32_t)input[52] << 24);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 424 to 431
	value = ((uint32_t)input[53] << 24);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 432 to 439
	value = ((uint32_t)input[54] << 24);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 440 to 447
	value = ((uint32_t)input[55] << 24);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 448 to 455
	value = ((uint32_t)input[56] << 24);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 456 to 463
	value = ((uint32_t)input[57] << 24);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 464 to 471
	value = ((uint32_t)input[58] << 24);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 472 to 479
	value = ((uint32_t)input[59] << 24);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 480 to 487
	value = ((uint32_t)input[60] << 24);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 488 to 495
	value = ((uint32_t)input[61] << 24);
	output[61] = (double)(value >> 24);

	// read output[62]: from bit 496 to 503
	value = ((uint32_t)input[62] << 24);
	output[62] = (double)(value >> 24);
}

static void unpack_63_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 63 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 504 bits of data.
	// Input must be at least 63 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 328 to 335
	value = ((uint32_t)input[41] << 24);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 336 to 343
	value = ((uint32_t)input[42] << 24);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 344 to 351
	value = ((uint32_t)input[43] << 24);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 352 to 359
	value = ((uint32_t)input[44] << 24);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 360 to 367
	value = ((uint32_t)input[45] << 24);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 368 to 375
	value = ((uint32_t)input[46] << 24);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 376 to 383
	value = ((uint32_t)input[47] << 24);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 384 to 391
	value = ((uint32_t)input[48] << 24);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 392 to 399
	value = ((uint32_t)input[49] << 24);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 400 to 407
	value = ((uint32_t)input[50] << 24);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 408 to 415
	value = ((uint32_t)input[51] << 24);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 416 to 423
	value = ((uint32_t)input[52] << 24);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 424 to 431
	value = ((uint32_t)input[53] << 24);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 432 to 439
	value = ((uint32_t)input[54] << 24);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 440 to 447
	value = ((uint32_t)input[55] << 24);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 448 to 455
	value = ((uint32_t)input[56] << 24);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 456 to 463
	value = ((uint32_t)input[57] << 24);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 464 to 471
	value = ((uint32_t)input[58] << 24);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 472 to 479
	value = ((uint32_t)input[59] << 24);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 480 to 487
	value = ((uint32_t)input[60] << 24);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 488 to 495
	value = ((uint32_t)input[61] << 24);
	output[61] = (double)(value >> 24);

	// read output[62]: from bit 496 to 503
	value = ((uint32_t)input[62] << 24);
	output[62] = (double)(value >> 24);
}

static void unpack_63_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 63 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 504 bits of data.
	// Input must be at least 64 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 329 to 336
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)(input[42] & 0x80) << 17);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 337 to 344
	value = ((uint32_t)(input[42] & 0x7f) << 25) |
			((uint32_t)(input[43] & 0x80) << 17);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 345 to 352
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)(input[44] & 0x80) << 17);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 353 to 360
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)(input[45] & 0x80) << 17);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 361 to 368
	value = ((uint32_t)(input[45] & 0x7f) << 25) |
			((uint32_t)(input[46] & 0x80) << 17);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 369 to 376
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)(input[47] & 0x80) << 17);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 377 to 384
	value = ((uint32_t)(input[47] & 0x7f) << 25) |
			((uint32_t)(input[48] & 0x80) << 17);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 385 to 392
	value = ((uint32_t)(input[48] & 0x7f) << 25) |
			((uint32_t)(input[49] & 0x80) << 17);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 393 to 400
	value = ((uint32_t)(input[49] & 0x7f) << 25) |
			((uint32_t)(input[50] & 0x80) << 17);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 401 to 408
	value = ((uint32_t)(input[50] & 0x7f) << 25) |
			((uint32_t)(input[51] & 0x80) << 17);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 409 to 416
	value = ((uint32_t)(input[51] & 0x7f) << 25) |
			((uint32_t)(input[52] & 0x80) << 17);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 417 to 424
	value = ((uint32_t)(input[52] & 0x7f) << 25) |
			((uint32_t)(input[53] & 0x80) << 17);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 425 to 432
	value = ((uint32_t)(input[53] & 0x7f) << 25) |
			((uint32_t)(input[54] & 0x80) << 17);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 433 to 440
	value = ((uint32_t)(input[54] & 0x7f) << 25) |
			((uint32_t)(input[55] & 0x80) << 17);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 441 to 448
	value = ((uint32_t)(input[55] & 0x7f) << 25) |
			((uint32_t)(input[56] & 0x80) << 17);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 449 to 456
	value = ((uint32_t)(input[56] & 0x7f) << 25) |
			((uint32_t)(input[57] & 0x80) << 17);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 457 to 464
	value = ((uint32_t)(input[57] & 0x7f) << 25) |
			((uint32_t)(input[58] & 0x80) << 17);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 465 to 472
	value = ((uint32_t)(input[58] & 0x7f) << 25) |
			((uint32_t)(input[59] & 0x80) << 17);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 473 to 480
	value = ((uint32_t)(input[59] & 0x7f) << 25) |
			((uint32_t)(input[60] & 0x80) << 17);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 481 to 488
	value = ((uint32_t)(input[60] & 0x7f) << 25) |
			((uint32_t)(input[61] & 0x80) << 17);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 489 to 496
	value = ((uint32_t)(input[61] & 0x7f) << 25) |
			((uint32_t)(input[62] & 0x80) << 17);
	output[61] = (double)(value >> 24);

	// read output[62]: from bit 497 to 504
	value = ((uint32_t)(input[62] & 0x7f) << 25) |
			((uint32_t)(input[63] & 0x80) << 17);
	output[62] = (double)(value >> 24);
}

static void unpack_63_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 63 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 504 bits of data.
	// Input must be at least 64 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 329 to 336
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)(input[42] & 0x80) << 17);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 337 to 344
	value = ((uint32_t)(input[42] & 0x7f) << 25) |
			((uint32_t)(input[43] & 0x80) << 17);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 345 to 352
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)(input[44] & 0x80) << 17);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 353 to 360
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)(input[45] & 0x80) << 17);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 361 to 368
	value = ((uint32_t)(input[45] & 0x7f) << 25) |
			((uint32_t)(input[46] & 0x80) << 17);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 369 to 376
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)(input[47] & 0x80) << 17);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 377 to 384
	value = ((uint32_t)(input[47] & 0x7f) << 25) |
			((uint32_t)(input[48] & 0x80) << 17);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 385 to 392
	value = ((uint32_t)(input[48] & 0x7f) << 25) |
			((uint32_t)(input[49] & 0x80) << 17);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 393 to 400
	value = ((uint32_t)(input[49] & 0x7f) << 25) |
			((uint32_t)(input[50] & 0x80) << 17);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 401 to 408
	value = ((uint32_t)(input[50] & 0x7f) << 25) |
			((uint32_t)(input[51] & 0x80) << 17);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 409 to 416
	value = ((uint32_t)(input[51] & 0x7f) << 25) |
			((uint32_t)(input[52] & 0x80) << 17);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 417 to 424
	value = ((uint32_t)(input[52] & 0x7f) << 25) |
			((uint32_t)(input[53] & 0x80) << 17);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 425 to 432
	value = ((uint32_t)(input[53] & 0x7f) << 25) |
			((uint32_t)(input[54] & 0x80) << 17);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 433 to 440
	value = ((uint32_t)(input[54] & 0x7f) << 25) |
			((uint32_t)(input[55] & 0x80) << 17);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 441 to 448
	value = ((uint32_t)(input[55] & 0x7f) << 25) |
			((uint32_t)(input[56] & 0x80) << 17);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 449 to 456
	value = ((uint32_t)(input[56] & 0x7f) << 25) |
			((uint32_t)(input[57] & 0x80) << 17);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 457 to 464
	value = ((uint32_t)(input[57] & 0x7f) << 25) |
			((uint32_t)(input[58] & 0x80) << 17);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 465 to 472
	value = ((uint32_t)(input[58] & 0x7f) << 25) |
			((uint32_t)(input[59] & 0x80) << 17);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 473 to 480
	value = ((uint32_t)(input[59] & 0x7f) << 25) |
			((uint32_t)(input[60] & 0x80) << 17);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 481 to 488
	value = ((uint32_t)(input[60] & 0x7f) << 25) |
			((uint32_t)(input[61] & 0x80) << 17);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 489 to 496
	value = ((uint32_t)(input[61] & 0x7f) << 25) |
			((uint32_t)(input[62] & 0x80) << 17);
	output[61] = (double)(value >> 24);

	// read output[62]: from bit 497 to 504
	value = ((uint32_t)(input[62] & 0x7f) << 25) |
			((uint32_t)(input[63] & 0x80) << 17);
	output[62] = (double)(value >> 24);
}

static void unpack_63_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 63 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 504 bits of data.
	// Input must be at least 64 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 330 to 337
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)(input[42] & 0xc0) << 18);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 338 to 345
	value = ((uint32_t)(input[42] & 0x3f) << 26) |
			((uint32_t)(input[43] & 0xc0) << 18);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 346 to 353
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)(input[44] & 0xc0) << 18);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 354 to 361
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)(input[45] & 0xc0) << 18);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 362 to 369
	value = ((uint32_t)(input[45] & 0x3f) << 26) |
			((uint32_t)(input[46] & 0xc0) << 18);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 370 to 377
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)(input[47] & 0xc0) << 18);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 378 to 385
	value = ((uint32_t)(input[47] & 0x3f) << 26) |
			((uint32_t)(input[48] & 0xc0) << 18);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 386 to 393
	value = ((uint32_t)(input[48] & 0x3f) << 26) |
			((uint32_t)(input[49] & 0xc0) << 18);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 394 to 401
	value = ((uint32_t)(input[49] & 0x3f) << 26) |
			((uint32_t)(input[50] & 0xc0) << 18);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 402 to 409
	value = ((uint32_t)(input[50] & 0x3f) << 26) |
			((uint32_t)(input[51] & 0xc0) << 18);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 410 to 417
	value = ((uint32_t)(input[51] & 0x3f) << 26) |
			((uint32_t)(input[52] & 0xc0) << 18);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 418 to 425
	value = ((uint32_t)(input[52] & 0x3f) << 26) |
			((uint32_t)(input[53] & 0xc0) << 18);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 426 to 433
	value = ((uint32_t)(input[53] & 0x3f) << 26) |
			((uint32_t)(input[54] & 0xc0) << 18);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 434 to 441
	value = ((uint32_t)(input[54] & 0x3f) << 26) |
			((uint32_t)(input[55] & 0xc0) << 18);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 442 to 449
	value = ((uint32_t)(input[55] & 0x3f) << 26) |
			((uint32_t)(input[56] & 0xc0) << 18);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 450 to 457
	value = ((uint32_t)(input[56] & 0x3f) << 26) |
			((uint32_t)(input[57] & 0xc0) << 18);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 458 to 465
	value = ((uint32_t)(input[57] & 0x3f) << 26) |
			((uint32_t)(input[58] & 0xc0) << 18);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 466 to 473
	value = ((uint32_t)(input[58] & 0x3f) << 26) |
			((uint32_t)(input[59] & 0xc0) << 18);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 474 to 481
	value = ((uint32_t)(input[59] & 0x3f) << 26) |
			((uint32_t)(input[60] & 0xc0) << 18);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 482 to 489
	value = ((uint32_t)(input[60] & 0x3f) << 26) |
			((uint32_t)(input[61] & 0xc0) << 18);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 490 to 497
	value = ((uint32_t)(input[61] & 0x3f) << 26) |
			((uint32_t)(input[62] & 0xc0) << 18);
	output[61] = (double)(value >> 24);

	// read output[62]: from bit 498 to 505
	value = ((uint32_t)(input[62] & 0x3f) << 26) |
			((uint32_t)(input[63] & 0xc0) << 18);
	output[62] = (double)(value >> 24);
}

static void unpack_63_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 63 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 504 bits of data.
	// Input must be at least 64 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 330 to 337
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)(input[42] & 0xc0) << 18);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 338 to 345
	value = ((uint32_t)(input[42] & 0x3f) << 26) |
			((uint32_t)(input[43] & 0xc0) << 18);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 346 to 353
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)(input[44] & 0xc0) << 18);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 354 to 361
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)(input[45] & 0xc0) << 18);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 362 to 369
	value = ((uint32_t)(input[45] & 0x3f) << 26) |
			((uint32_t)(input[46] & 0xc0) << 18);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 370 to 377
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)(input[47] & 0xc0) << 18);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 378 to 385
	value = ((uint32_t)(input[47] & 0x3f) << 26) |
			((uint32_t)(input[48] & 0xc0) << 18);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 386 to 393
	value = ((uint32_t)(input[48] & 0x3f) << 26) |
			((uint32_t)(input[49] & 0xc0) << 18);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 394 to 401
	value = ((uint32_t)(input[49] & 0x3f) << 26) |
			((uint32_t)(input[50] & 0xc0) << 18);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 402 to 409
	value = ((uint32_t)(input[50] & 0x3f) << 26) |
			((uint32_t)(input[51] & 0xc0) << 18);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 410 to 417
	value = ((uint32_t)(input[51] & 0x3f) << 26) |
			((uint32_t)(input[52] & 0xc0) << 18);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 418 to 425
	value = ((uint32_t)(input[52] & 0x3f) << 26) |
			((uint32_t)(input[53] & 0xc0) << 18);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 426 to 433
	value = ((uint32_t)(input[53] & 0x3f) << 26) |
			((uint32_t)(input[54] & 0xc0) << 18);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 434 to 441
	value = ((uint32_t)(input[54] & 0x3f) << 26) |
			((uint32_t)(input[55] & 0xc0) << 18);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 442 to 449
	value = ((uint32_t)(input[55] & 0x3f) << 26) |
			((uint32_t)(input[56] & 0xc0) << 18);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 450 to 457
	value = ((uint32_t)(input[56] & 0x3f) << 26) |
			((uint32_t)(input[57] & 0xc0) << 18);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 458 to 465
	value = ((uint32_t)(input[57] & 0x3f) << 26) |
			((uint32_t)(input[58] & 0xc0) << 18);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 466 to 473
	value = ((uint32_t)(input[58] & 0x3f) << 26) |
			((uint32_t)(input[59] & 0xc0) << 18);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 474 to 481
	value = ((uint32_t)(input[59] & 0x3f) << 26) |
			((uint32_t)(input[60] & 0xc0) << 18);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 482 to 489
	value = ((uint32_t)(input[60] & 0x3f) << 26) |
			((uint32_t)(input[61] & 0xc0) << 18);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 490 to 497
	value = ((uint32_t)(input[61] & 0x3f) << 26) |
			((uint32_t)(input[62] & 0xc0) << 18);
	output[61] = (double)(value >> 24);

	// read output[62]: from bit 498 to 505
	value = ((uint32_t)(input[62] & 0x3f) << 26) |
			((uint32_t)(input[63] & 0xc0) << 18);
	output[62] = (double)(value >> 24);
}

static void unpack_63_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 63 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 504 bits of data.
	// Input must be at least 64 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 331 to 338
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)(input[42] & 0xe0) << 19);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 339 to 346
	value = ((uint32_t)(input[42] & 0x1f) << 27) |
			((uint32_t)(input[43] & 0xe0) << 19);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 347 to 354
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)(input[44] & 0xe0) << 19);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 355 to 362
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)(input[45] & 0xe0) << 19);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 363 to 370
	value = ((uint32_t)(input[45] & 0x1f) << 27) |
			((uint32_t)(input[46] & 0xe0) << 19);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 371 to 378
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)(input[47] & 0xe0) << 19);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 379 to 386
	value = ((uint32_t)(input[47] & 0x1f) << 27) |
			((uint32_t)(input[48] & 0xe0) << 19);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 387 to 394
	value = ((uint32_t)(input[48] & 0x1f) << 27) |
			((uint32_t)(input[49] & 0xe0) << 19);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 395 to 402
	value = ((uint32_t)(input[49] & 0x1f) << 27) |
			((uint32_t)(input[50] & 0xe0) << 19);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 403 to 410
	value = ((uint32_t)(input[50] & 0x1f) << 27) |
			((uint32_t)(input[51] & 0xe0) << 19);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 411 to 418
	value = ((uint32_t)(input[51] & 0x1f) << 27) |
			((uint32_t)(input[52] & 0xe0) << 19);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 419 to 426
	value = ((uint32_t)(input[52] & 0x1f) << 27) |
			((uint32_t)(input[53] & 0xe0) << 19);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 427 to 434
	value = ((uint32_t)(input[53] & 0x1f) << 27) |
			((uint32_t)(input[54] & 0xe0) << 19);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 435 to 442
	value = ((uint32_t)(input[54] & 0x1f) << 27) |
			((uint32_t)(input[55] & 0xe0) << 19);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 443 to 450
	value = ((uint32_t)(input[55] & 0x1f) << 27) |
			((uint32_t)(input[56] & 0xe0) << 19);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 451 to 458
	value = ((uint32_t)(input[56] & 0x1f) << 27) |
			((uint32_t)(input[57] & 0xe0) << 19);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 459 to 466
	value = ((uint32_t)(input[57] & 0x1f) << 27) |
			((uint32_t)(input[58] & 0xe0) << 19);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 467 to 474
	value = ((uint32_t)(input[58] & 0x1f) << 27) |
			((uint32_t)(input[59] & 0xe0) << 19);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 475 to 482
	value = ((uint32_t)(input[59] & 0x1f) << 27) |
			((uint32_t)(input[60] & 0xe0) << 19);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 483 to 490
	value = ((uint32_t)(input[60] & 0x1f) << 27) |
			((uint32_t)(input[61] & 0xe0) << 19);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 491 to 498
	value = ((uint32_t)(input[61] & 0x1f) << 27) |
			((uint32_t)(input[62] & 0xe0) << 19);
	output[61] = (double)(value >> 24);

	// read output[62]: from bit 499 to 506
	value = ((uint32_t)(input[62] & 0x1f) << 27) |
			((uint32_t)(input[63] & 0xe0) << 19);
	output[62] = (double)(value >> 24);
}

static void unpack_63_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 63 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 504 bits of data.
	// Input must be at least 64 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 331 to 338
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)(input[42] & 0xe0) << 19);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 339 to 346
	value = ((uint32_t)(input[42] & 0x1f) << 27) |
			((uint32_t)(input[43] & 0xe0) << 19);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 347 to 354
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)(input[44] & 0xe0) << 19);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 355 to 362
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)(input[45] & 0xe0) << 19);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 363 to 370
	value = ((uint32_t)(input[45] & 0x1f) << 27) |
			((uint32_t)(input[46] & 0xe0) << 19);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 371 to 378
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)(input[47] & 0xe0) << 19);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 379 to 386
	value = ((uint32_t)(input[47] & 0x1f) << 27) |
			((uint32_t)(input[48] & 0xe0) << 19);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 387 to 394
	value = ((uint32_t)(input[48] & 0x1f) << 27) |
			((uint32_t)(input[49] & 0xe0) << 19);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 395 to 402
	value = ((uint32_t)(input[49] & 0x1f) << 27) |
			((uint32_t)(input[50] & 0xe0) << 19);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 403 to 410
	value = ((uint32_t)(input[50] & 0x1f) << 27) |
			((uint32_t)(input[51] & 0xe0) << 19);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 411 to 418
	value = ((uint32_t)(input[51] & 0x1f) << 27) |
			((uint32_t)(input[52] & 0xe0) << 19);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 419 to 426
	value = ((uint32_t)(input[52] & 0x1f) << 27) |
			((uint32_t)(input[53] & 0xe0) << 19);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 427 to 434
	value = ((uint32_t)(input[53] & 0x1f) << 27) |
			((uint32_t)(input[54] & 0xe0) << 19);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 435 to 442
	value = ((uint32_t)(input[54] & 0x1f) << 27) |
			((uint32_t)(input[55] & 0xe0) << 19);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 443 to 450
	value = ((uint32_t)(input[55] & 0x1f) << 27) |
			((uint32_t)(input[56] & 0xe0) << 19);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 451 to 458
	value = ((uint32_t)(input[56] & 0x1f) << 27) |
			((uint32_t)(input[57] & 0xe0) << 19);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 459 to 466
	value = ((uint32_t)(input[57] & 0x1f) << 27) |
			((uint32_t)(input[58] & 0xe0) << 19);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 467 to 474
	value = ((uint32_t)(input[58] & 0x1f) << 27) |
			((uint32_t)(input[59] & 0xe0) << 19);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 475 to 482
	value = ((uint32_t)(input[59] & 0x1f) << 27) |
			((uint32_t)(input[60] & 0xe0) << 19);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 483 to 490
	value = ((uint32_t)(input[60] & 0x1f) << 27) |
			((uint32_t)(input[61] & 0xe0) << 19);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 491 to 498
	value = ((uint32_t)(input[61] & 0x1f) << 27) |
			((uint32_t)(input[62] & 0xe0) << 19);
	output[61] = (double)(value >> 24);

	// read output[62]: from bit 499 to 506
	value = ((uint32_t)(input[62] & 0x1f) << 27) |
			((uint32_t)(input[63] & 0xe0) << 19);
	output[62] = (double)(value >> 24);
}

static void unpack_63_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 63 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 504 bits of data.
	// Input must be at least 64 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 332 to 339
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)(input[42] & 0xf0) << 20);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 340 to 347
	value = ((uint32_t)(input[42] & 0x0f) << 28) |
			((uint32_t)(input[43] & 0xf0) << 20);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 348 to 355
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)(input[44] & 0xf0) << 20);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 356 to 363
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)(input[45] & 0xf0) << 20);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 364 to 371
	value = ((uint32_t)(input[45] & 0x0f) << 28) |
			((uint32_t)(input[46] & 0xf0) << 20);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 372 to 379
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)(input[47] & 0xf0) << 20);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 380 to 387
	value = ((uint32_t)(input[47] & 0x0f) << 28) |
			((uint32_t)(input[48] & 0xf0) << 20);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 388 to 395
	value = ((uint32_t)(input[48] & 0x0f) << 28) |
			((uint32_t)(input[49] & 0xf0) << 20);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 396 to 403
	value = ((uint32_t)(input[49] & 0x0f) << 28) |
			((uint32_t)(input[50] & 0xf0) << 20);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 404 to 411
	value = ((uint32_t)(input[50] & 0x0f) << 28) |
			((uint32_t)(input[51] & 0xf0) << 20);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 412 to 419
	value = ((uint32_t)(input[51] & 0x0f) << 28) |
			((uint32_t)(input[52] & 0xf0) << 20);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 420 to 427
	value = ((uint32_t)(input[52] & 0x0f) << 28) |
			((uint32_t)(input[53] & 0xf0) << 20);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 428 to 435
	value = ((uint32_t)(input[53] & 0x0f) << 28) |
			((uint32_t)(input[54] & 0xf0) << 20);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 436 to 443
	value = ((uint32_t)(input[54] & 0x0f) << 28) |
			((uint32_t)(input[55] & 0xf0) << 20);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 444 to 451
	value = ((uint32_t)(input[55] & 0x0f) << 28) |
			((uint32_t)(input[56] & 0xf0) << 20);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 452 to 459
	value = ((uint32_t)(input[56] & 0x0f) << 28) |
			((uint32_t)(input[57] & 0xf0) << 20);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 460 to 467
	value = ((uint32_t)(input[57] & 0x0f) << 28) |
			((uint32_t)(input[58] & 0xf0) << 20);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 468 to 475
	value = ((uint32_t)(input[58] & 0x0f) << 28) |
			((uint32_t)(input[59] & 0xf0) << 20);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 476 to 483
	value = ((uint32_t)(input[59] & 0x0f) << 28) |
			((uint32_t)(input[60] & 0xf0) << 20);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 484 to 491
	value = ((uint32_t)(input[60] & 0x0f) << 28) |
			((uint32_t)(input[61] & 0xf0) << 20);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 492 to 499
	value = ((uint32_t)(input[61] & 0x0f) << 28) |
			((uint32_t)(input[62] & 0xf0) << 20);
	output[61] = (double)(value >> 24);

	// read output[62]: from bit 500 to 507
	value = ((uint32_t)(input[62] & 0x0f) << 28) |
			((uint32_t)(input[63] & 0xf0) << 20);
	output[62] = (double)(value >> 24);
}

static void unpack_63_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 63 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 504 bits of data.
	// Input must be at least 64 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 332 to 339
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)(input[42] & 0xf0) << 20);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 340 to 347
	value = ((uint32_t)(input[42] & 0x0f) << 28) |
			((uint32_t)(input[43] & 0xf0) << 20);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 348 to 355
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)(input[44] & 0xf0) << 20);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 356 to 363
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)(input[45] & 0xf0) << 20);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 364 to 371
	value = ((uint32_t)(input[45] & 0x0f) << 28) |
			((uint32_t)(input[46] & 0xf0) << 20);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 372 to 379
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)(input[47] & 0xf0) << 20);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 380 to 387
	value = ((uint32_t)(input[47] & 0x0f) << 28) |
			((uint32_t)(input[48] & 0xf0) << 20);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 388 to 395
	value = ((uint32_t)(input[48] & 0x0f) << 28) |
			((uint32_t)(input[49] & 0xf0) << 20);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 396 to 403
	value = ((uint32_t)(input[49] & 0x0f) << 28) |
			((uint32_t)(input[50] & 0xf0) << 20);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 404 to 411
	value = ((uint32_t)(input[50] & 0x0f) << 28) |
			((uint32_t)(input[51] & 0xf0) << 20);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 412 to 419
	value = ((uint32_t)(input[51] & 0x0f) << 28) |
			((uint32_t)(input[52] & 0xf0) << 20);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 420 to 427
	value = ((uint32_t)(input[52] & 0x0f) << 28) |
			((uint32_t)(input[53] & 0xf0) << 20);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 428 to 435
	value = ((uint32_t)(input[53] & 0x0f) << 28) |
			((uint32_t)(input[54] & 0xf0) << 20);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 436 to 443
	value = ((uint32_t)(input[54] & 0x0f) << 28) |
			((uint32_t)(input[55] & 0xf0) << 20);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 444 to 451
	value = ((uint32_t)(input[55] & 0x0f) << 28) |
			((uint32_t)(input[56] & 0xf0) << 20);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 452 to 459
	value = ((uint32_t)(input[56] & 0x0f) << 28) |
			((uint32_t)(input[57] & 0xf0) << 20);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 460 to 467
	value = ((uint32_t)(input[57] & 0x0f) << 28) |
			((uint32_t)(input[58] & 0xf0) << 20);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 468 to 475
	value = ((uint32_t)(input[58] & 0x0f) << 28) |
			((uint32_t)(input[59] & 0xf0) << 20);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 476 to 483
	value = ((uint32_t)(input[59] & 0x0f) << 28) |
			((uint32_t)(input[60] & 0xf0) << 20);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 484 to 491
	value = ((uint32_t)(input[60] & 0x0f) << 28) |
			((uint32_t)(input[61] & 0xf0) << 20);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 492 to 499
	value = ((uint32_t)(input[61] & 0x0f) << 28) |
			((uint32_t)(input[62] & 0xf0) << 20);
	output[61] = (double)(value >> 24);

	// read output[62]: from bit 500 to 507
	value = ((uint32_t)(input[62] & 0x0f) << 28) |
			((uint32_t)(input[63] & 0xf0) << 20);
	output[62] = (double)(value >> 24);
}

static void unpack_63_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 63 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 504 bits of data.
	// Input must be at least 64 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 333 to 340
	value = ((uint32_t)(input[41] & 0x07) << 29) |
			((uint32_t)(input[42] & 0xf8) << 21);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 341 to 348
	value = ((uint32_t)(input[42] & 0x07) << 29) |
			((uint32_t)(input[43] & 0xf8) << 21);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 349 to 356
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)(input[44] & 0xf8) << 21);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 357 to 364
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)(input[45] & 0xf8) << 21);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 365 to 372
	value = ((uint32_t)(input[45] & 0x07) << 29) |
			((uint32_t)(input[46] & 0xf8) << 21);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 373 to 380
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)(input[47] & 0xf8) << 21);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 381 to 388
	value = ((uint32_t)(input[47] & 0x07) << 29) |
			((uint32_t)(input[48] & 0xf8) << 21);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 389 to 396
	value = ((uint32_t)(input[48] & 0x07) << 29) |
			((uint32_t)(input[49] & 0xf8) << 21);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 397 to 404
	value = ((uint32_t)(input[49] & 0x07) << 29) |
			((uint32_t)(input[50] & 0xf8) << 21);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 405 to 412
	value = ((uint32_t)(input[50] & 0x07) << 29) |
			((uint32_t)(input[51] & 0xf8) << 21);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 413 to 420
	value = ((uint32_t)(input[51] & 0x07) << 29) |
			((uint32_t)(input[52] & 0xf8) << 21);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 421 to 428
	value = ((uint32_t)(input[52] & 0x07) << 29) |
			((uint32_t)(input[53] & 0xf8) << 21);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 429 to 436
	value = ((uint32_t)(input[53] & 0x07) << 29) |
			((uint32_t)(input[54] & 0xf8) << 21);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 437 to 444
	value = ((uint32_t)(input[54] & 0x07) << 29) |
			((uint32_t)(input[55] & 0xf8) << 21);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 445 to 452
	value = ((uint32_t)(input[55] & 0x07) << 29) |
			((uint32_t)(input[56] & 0xf8) << 21);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 453 to 460
	value = ((uint32_t)(input[56] & 0x07) << 29) |
			((uint32_t)(input[57] & 0xf8) << 21);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 461 to 468
	value = ((uint32_t)(input[57] & 0x07) << 29) |
			((uint32_t)(input[58] & 0xf8) << 21);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 469 to 476
	value = ((uint32_t)(input[58] & 0x07) << 29) |
			((uint32_t)(input[59] & 0xf8) << 21);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 477 to 484
	value = ((uint32_t)(input[59] & 0x07) << 29) |
			((uint32_t)(input[60] & 0xf8) << 21);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 485 to 492
	value = ((uint32_t)(input[60] & 0x07) << 29) |
			((uint32_t)(input[61] & 0xf8) << 21);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 493 to 500
	value = ((uint32_t)(input[61] & 0x07) << 29) |
			((uint32_t)(input[62] & 0xf8) << 21);
	output[61] = (double)(value >> 24);

	// read output[62]: from bit 501 to 508
	value = ((uint32_t)(input[62] & 0x07) << 29) |
			((uint32_t)(input[63] & 0xf8) << 21);
	output[62] = (double)(value >> 24);
}

static void unpack_63_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 63 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 504 bits of data.
	// Input must be at least 64 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 333 to 340
	value = ((uint32_t)(input[41] & 0x07) << 29) |
			((uint32_t)(input[42] & 0xf8) << 21);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 341 to 348
	value = ((uint32_t)(input[42] & 0x07) << 29) |
			((uint32_t)(input[43] & 0xf8) << 21);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 349 to 356
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)(input[44] & 0xf8) << 21);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 357 to 364
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)(input[45] & 0xf8) << 21);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 365 to 372
	value = ((uint32_t)(input[45] & 0x07) << 29) |
			((uint32_t)(input[46] & 0xf8) << 21);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 373 to 380
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)(input[47] & 0xf8) << 21);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 381 to 388
	value = ((uint32_t)(input[47] & 0x07) << 29) |
			((uint32_t)(input[48] & 0xf8) << 21);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 389 to 396
	value = ((uint32_t)(input[48] & 0x07) << 29) |
			((uint32_t)(input[49] & 0xf8) << 21);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 397 to 404
	value = ((uint32_t)(input[49] & 0x07) << 29) |
			((uint32_t)(input[50] & 0xf8) << 21);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 405 to 412
	value = ((uint32_t)(input[50] & 0x07) << 29) |
			((uint32_t)(input[51] & 0xf8) << 21);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 413 to 420
	value = ((uint32_t)(input[51] & 0x07) << 29) |
			((uint32_t)(input[52] & 0xf8) << 21);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 421 to 428
	value = ((uint32_t)(input[52] & 0x07) << 29) |
			((uint32_t)(input[53] & 0xf8) << 21);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 429 to 436
	value = ((uint32_t)(input[53] & 0x07) << 29) |
			((uint32_t)(input[54] & 0xf8) << 21);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 437 to 444
	value = ((uint32_t)(input[54] & 0x07) << 29) |
			((uint32_t)(input[55] & 0xf8) << 21);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 445 to 452
	value = ((uint32_t)(input[55] & 0x07) << 29) |
			((uint32_t)(input[56] & 0xf8) << 21);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 453 to 460
	value = ((uint32_t)(input[56] & 0x07) << 29) |
			((uint32_t)(input[57] & 0xf8) << 21);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 461 to 468
	value = ((uint32_t)(input[57] & 0x07) << 29) |
			((uint32_t)(input[58] & 0xf8) << 21);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 469 to 476
	value = ((uint32_t)(input[58] & 0x07) << 29) |
			((uint32_t)(input[59] & 0xf8) << 21);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 477 to 484
	value = ((uint32_t)(input[59] & 0x07) << 29) |
			((uint32_t)(input[60] & 0xf8) << 21);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 485 to 492
	value = ((uint32_t)(input[60] & 0x07) << 29) |
			((uint32_t)(input[61] & 0xf8) << 21);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 493 to 500
	value = ((uint32_t)(input[61] & 0x07) << 29) |
			((uint32_t)(input[62] & 0xf8) << 21);
	output[61] = (double)(value >> 24);

	// read output[62]: from bit 501 to 508
	value = ((uint32_t)(input[62] & 0x07) << 29) |
			((uint32_t)(input[63] & 0xf8) << 21);
	output[62] = (double)(value >> 24);
}

static void unpack_63_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 63 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 504 bits of data.
	// Input must be at least 64 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 334 to 341
	value = ((uint32_t)(input[41] & 0x03) << 30) |
			((uint32_t)(input[42] & 0xfc) << 22);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 342 to 349
	value = ((uint32_t)(input[42] & 0x03) << 30) |
			((uint32_t)(input[43] & 0xfc) << 22);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 350 to 357
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)(input[44] & 0xfc) << 22);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 358 to 365
	value = ((uint32_t)(input[44] & 0x03) << 30) |
			((uint32_t)(input[45] & 0xfc) << 22);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 366 to 373
	value = ((uint32_t)(input[45] & 0x03) << 30) |
			((uint32_t)(input[46] & 0xfc) << 22);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 374 to 381
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)(input[47] & 0xfc) << 22);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 382 to 389
	value = ((uint32_t)(input[47] & 0x03) << 30) |
			((uint32_t)(input[48] & 0xfc) << 22);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 390 to 397
	value = ((uint32_t)(input[48] & 0x03) << 30) |
			((uint32_t)(input[49] & 0xfc) << 22);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 398 to 405
	value = ((uint32_t)(input[49] & 0x03) << 30) |
			((uint32_t)(input[50] & 0xfc) << 22);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 406 to 413
	value = ((uint32_t)(input[50] & 0x03) << 30) |
			((uint32_t)(input[51] & 0xfc) << 22);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 414 to 421
	value = ((uint32_t)(input[51] & 0x03) << 30) |
			((uint32_t)(input[52] & 0xfc) << 22);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 422 to 429
	value = ((uint32_t)(input[52] & 0x03) << 30) |
			((uint32_t)(input[53] & 0xfc) << 22);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 430 to 437
	value = ((uint32_t)(input[53] & 0x03) << 30) |
			((uint32_t)(input[54] & 0xfc) << 22);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 438 to 445
	value = ((uint32_t)(input[54] & 0x03) << 30) |
			((uint32_t)(input[55] & 0xfc) << 22);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 446 to 453
	value = ((uint32_t)(input[55] & 0x03) << 30) |
			((uint32_t)(input[56] & 0xfc) << 22);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 454 to 461
	value = ((uint32_t)(input[56] & 0x03) << 30) |
			((uint32_t)(input[57] & 0xfc) << 22);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 462 to 469
	value = ((uint32_t)(input[57] & 0x03) << 30) |
			((uint32_t)(input[58] & 0xfc) << 22);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 470 to 477
	value = ((uint32_t)(input[58] & 0x03) << 30) |
			((uint32_t)(input[59] & 0xfc) << 22);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 478 to 485
	value = ((uint32_t)(input[59] & 0x03) << 30) |
			((uint32_t)(input[60] & 0xfc) << 22);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 486 to 493
	value = ((uint32_t)(input[60] & 0x03) << 30) |
			((uint32_t)(input[61] & 0xfc) << 22);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 494 to 501
	value = ((uint32_t)(input[61] & 0x03) << 30) |
			((uint32_t)(input[62] & 0xfc) << 22);
	output[61] = (double)(value >> 24);

	// read output[62]: from bit 502 to 509
	value = ((uint32_t)(input[62] & 0x03) << 30) |
			((uint32_t)(input[63] & 0xfc) << 22);
	output[62] = (double)(value >> 24);
}

static void unpack_63_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 63 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 504 bits of data.
	// Input must be at least 64 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 334 to 341
	value = ((uint32_t)(input[41] & 0x03) << 30) |
			((uint32_t)(input[42] & 0xfc) << 22);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 342 to 349
	value = ((uint32_t)(input[42] & 0x03) << 30) |
			((uint32_t)(input[43] & 0xfc) << 22);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 350 to 357
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)(input[44] & 0xfc) << 22);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 358 to 365
	value = ((uint32_t)(input[44] & 0x03) << 30) |
			((uint32_t)(input[45] & 0xfc) << 22);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 366 to 373
	value = ((uint32_t)(input[45] & 0x03) << 30) |
			((uint32_t)(input[46] & 0xfc) << 22);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 374 to 381
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)(input[47] & 0xfc) << 22);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 382 to 389
	value = ((uint32_t)(input[47] & 0x03) << 30) |
			((uint32_t)(input[48] & 0xfc) << 22);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 390 to 397
	value = ((uint32_t)(input[48] & 0x03) << 30) |
			((uint32_t)(input[49] & 0xfc) << 22);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 398 to 405
	value = ((uint32_t)(input[49] & 0x03) << 30) |
			((uint32_t)(input[50] & 0xfc) << 22);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 406 to 413
	value = ((uint32_t)(input[50] & 0x03) << 30) |
			((uint32_t)(input[51] & 0xfc) << 22);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 414 to 421
	value = ((uint32_t)(input[51] & 0x03) << 30) |
			((uint32_t)(input[52] & 0xfc) << 22);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 422 to 429
	value = ((uint32_t)(input[52] & 0x03) << 30) |
			((uint32_t)(input[53] & 0xfc) << 22);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 430 to 437
	value = ((uint32_t)(input[53] & 0x03) << 30) |
			((uint32_t)(input[54] & 0xfc) << 22);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 438 to 445
	value = ((uint32_t)(input[54] & 0x03) << 30) |
			((uint32_t)(input[55] & 0xfc) << 22);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 446 to 453
	value = ((uint32_t)(input[55] & 0x03) << 30) |
			((uint32_t)(input[56] & 0xfc) << 22);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 454 to 461
	value = ((uint32_t)(input[56] & 0x03) << 30) |
			((uint32_t)(input[57] & 0xfc) << 22);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 462 to 469
	value = ((uint32_t)(input[57] & 0x03) << 30) |
			((uint32_t)(input[58] & 0xfc) << 22);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 470 to 477
	value = ((uint32_t)(input[58] & 0x03) << 30) |
			((uint32_t)(input[59] & 0xfc) << 22);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 478 to 485
	value = ((uint32_t)(input[59] & 0x03) << 30) |
			((uint32_t)(input[60] & 0xfc) << 22);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 486 to 493
	value = ((uint32_t)(input[60] & 0x03) << 30) |
			((uint32_t)(input[61] & 0xfc) << 22);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 494 to 501
	value = ((uint32_t)(input[61] & 0x03) << 30) |
			((uint32_t)(input[62] & 0xfc) << 22);
	output[61] = (double)(value >> 24);

	// read output[62]: from bit 502 to 509
	value = ((uint32_t)(input[62] & 0x03) << 30) |
			((uint32_t)(input[63] & 0xfc) << 22);
	output[62] = (double)(value >> 24);
}

static void unpack_63_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 63 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 504 bits of data.
	// Input must be at least 64 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 335 to 342
	value = ((uint32_t)(input[41] & 0x01) << 31) |
			((uint32_t)(input[42] & 0xfe) << 23);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 343 to 350
	value = ((uint32_t)(input[42] & 0x01) << 31) |
			((uint32_t)(input[43] & 0xfe) << 23);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 351 to 358
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)(input[44] & 0xfe) << 23);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 359 to 366
	value = ((uint32_t)(input[44] & 0x01) << 31) |
			((uint32_t)(input[45] & 0xfe) << 23);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 367 to 374
	value = ((uint32_t)(input[45] & 0x01) << 31) |
			((uint32_t)(input[46] & 0xfe) << 23);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 375 to 382
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)(input[47] & 0xfe) << 23);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 383 to 390
	value = ((uint32_t)(input[47] & 0x01) << 31) |
			((uint32_t)(input[48] & 0xfe) << 23);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 391 to 398
	value = ((uint32_t)(input[48] & 0x01) << 31) |
			((uint32_t)(input[49] & 0xfe) << 23);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 399 to 406
	value = ((uint32_t)(input[49] & 0x01) << 31) |
			((uint32_t)(input[50] & 0xfe) << 23);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 407 to 414
	value = ((uint32_t)(input[50] & 0x01) << 31) |
			((uint32_t)(input[51] & 0xfe) << 23);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 415 to 422
	value = ((uint32_t)(input[51] & 0x01) << 31) |
			((uint32_t)(input[52] & 0xfe) << 23);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 423 to 430
	value = ((uint32_t)(input[52] & 0x01) << 31) |
			((uint32_t)(input[53] & 0xfe) << 23);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 431 to 438
	value = ((uint32_t)(input[53] & 0x01) << 31) |
			((uint32_t)(input[54] & 0xfe) << 23);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 439 to 446
	value = ((uint32_t)(input[54] & 0x01) << 31) |
			((uint32_t)(input[55] & 0xfe) << 23);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 447 to 454
	value = ((uint32_t)(input[55] & 0x01) << 31) |
			((uint32_t)(input[56] & 0xfe) << 23);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 455 to 462
	value = ((uint32_t)(input[56] & 0x01) << 31) |
			((uint32_t)(input[57] & 0xfe) << 23);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 463 to 470
	value = ((uint32_t)(input[57] & 0x01) << 31) |
			((uint32_t)(input[58] & 0xfe) << 23);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 471 to 478
	value = ((uint32_t)(input[58] & 0x01) << 31) |
			((uint32_t)(input[59] & 0xfe) << 23);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 479 to 486
	value = ((uint32_t)(input[59] & 0x01) << 31) |
			((uint32_t)(input[60] & 0xfe) << 23);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 487 to 494
	value = ((uint32_t)(input[60] & 0x01) << 31) |
			((uint32_t)(input[61] & 0xfe) << 23);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 495 to 502
	value = ((uint32_t)(input[61] & 0x01) << 31) |
			((uint32_t)(input[62] & 0xfe) << 23);
	output[61] = (double)(value >> 24);

	// read output[62]: from bit 503 to 510
	value = ((uint32_t)(input[62] & 0x01) << 31) |
			((uint32_t)(input[63] & 0xfe) << 23);
	output[62] = (double)(value >> 24);
}

static void unpack_63_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 63 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 504 bits of data.
	// Input must be at least 64 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 335 to 342
	value = ((uint32_t)(input[41] & 0x01) << 31) |
			((uint32_t)(input[42] & 0xfe) << 23);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 343 to 350
	value = ((uint32_t)(input[42] & 0x01) << 31) |
			((uint32_t)(input[43] & 0xfe) << 23);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 351 to 358
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)(input[44] & 0xfe) << 23);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 359 to 366
	value = ((uint32_t)(input[44] & 0x01) << 31) |
			((uint32_t)(input[45] & 0xfe) << 23);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 367 to 374
	value = ((uint32_t)(input[45] & 0x01) << 31) |
			((uint32_t)(input[46] & 0xfe) << 23);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 375 to 382
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)(input[47] & 0xfe) << 23);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 383 to 390
	value = ((uint32_t)(input[47] & 0x01) << 31) |
			((uint32_t)(input[48] & 0xfe) << 23);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 391 to 398
	value = ((uint32_t)(input[48] & 0x01) << 31) |
			((uint32_t)(input[49] & 0xfe) << 23);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 399 to 406
	value = ((uint32_t)(input[49] & 0x01) << 31) |
			((uint32_t)(input[50] & 0xfe) << 23);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 407 to 414
	value = ((uint32_t)(input[50] & 0x01) << 31) |
			((uint32_t)(input[51] & 0xfe) << 23);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 415 to 422
	value = ((uint32_t)(input[51] & 0x01) << 31) |
			((uint32_t)(input[52] & 0xfe) << 23);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 423 to 430
	value = ((uint32_t)(input[52] & 0x01) << 31) |
			((uint32_t)(input[53] & 0xfe) << 23);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 431 to 438
	value = ((uint32_t)(input[53] & 0x01) << 31) |
			((uint32_t)(input[54] & 0xfe) << 23);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 439 to 446
	value = ((uint32_t)(input[54] & 0x01) << 31) |
			((uint32_t)(input[55] & 0xfe) << 23);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 447 to 454
	value = ((uint32_t)(input[55] & 0x01) << 31) |
			((uint32_t)(input[56] & 0xfe) << 23);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 455 to 462
	value = ((uint32_t)(input[56] & 0x01) << 31) |
			((uint32_t)(input[57] & 0xfe) << 23);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 463 to 470
	value = ((uint32_t)(input[57] & 0x01) << 31) |
			((uint32_t)(input[58] & 0xfe) << 23);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 471 to 478
	value = ((uint32_t)(input[58] & 0x01) << 31) |
			((uint32_t)(input[59] & 0xfe) << 23);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 479 to 486
	value = ((uint32_t)(input[59] & 0x01) << 31) |
			((uint32_t)(input[60] & 0xfe) << 23);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 487 to 494
	value = ((uint32_t)(input[60] & 0x01) << 31) |
			((uint32_t)(input[61] & 0xfe) << 23);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 495 to 502
	value = ((uint32_t)(input[61] & 0x01) << 31) |
			((uint32_t)(input[62] & 0xfe) << 23);
	output[61] = (double)(value >> 24);

	// read output[62]: from bit 503 to 510
	value = ((uint32_t)(input[62] & 0x01) << 31) |
			((uint32_t)(input[63] & 0xfe) << 23);
	output[62] = (double)(value >> 24);
}

static void unpack_64_8bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 64 values into output
	// Values are 8-bit signed
	// Skip 0 bits, read 512 bits of data.
	// Input must be at least 64 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 328 to 335
	value = ((uint32_t)input[41] << 24);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 336 to 343
	value = ((uint32_t)input[42] << 24);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 344 to 351
	value = ((uint32_t)input[43] << 24);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 352 to 359
	value = ((uint32_t)input[44] << 24);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 360 to 367
	value = ((uint32_t)input[45] << 24);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 368 to 375
	value = ((uint32_t)input[46] << 24);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 376 to 383
	value = ((uint32_t)input[47] << 24);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 384 to 391
	value = ((uint32_t)input[48] << 24);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 392 to 399
	value = ((uint32_t)input[49] << 24);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 400 to 407
	value = ((uint32_t)input[50] << 24);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 408 to 415
	value = ((uint32_t)input[51] << 24);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 416 to 423
	value = ((uint32_t)input[52] << 24);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 424 to 431
	value = ((uint32_t)input[53] << 24);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 432 to 439
	value = ((uint32_t)input[54] << 24);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 440 to 447
	value = ((uint32_t)input[55] << 24);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 448 to 455
	value = ((uint32_t)input[56] << 24);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 456 to 463
	value = ((uint32_t)input[57] << 24);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 464 to 471
	value = ((uint32_t)input[58] << 24);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 472 to 479
	value = ((uint32_t)input[59] << 24);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 480 to 487
	value = ((uint32_t)input[60] << 24);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 488 to 495
	value = ((uint32_t)input[61] << 24);
	output[61] = (double)(value >> 24);

	// read output[62]: from bit 496 to 503
	value = ((uint32_t)input[62] << 24);
	output[62] = (double)(value >> 24);

	// read output[63]: from bit 504 to 511
	value = ((uint32_t)input[63] << 24);
	output[63] = (double)(value >> 24);
}

static void unpack_64_8bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 64 values into output
	// Values are 8-bit unsigned
	// Skip 0 bits, read 512 bits of data.
	// Input must be at least 64 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 7
	value = ((uint32_t)input[0] << 24);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 8 to 15
	value = ((uint32_t)input[1] << 24);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 16 to 23
	value = ((uint32_t)input[2] << 24);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 24 to 31
	value = ((uint32_t)input[3] << 24);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 32 to 39
	value = ((uint32_t)input[4] << 24);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 40 to 47
	value = ((uint32_t)input[5] << 24);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 48 to 55
	value = ((uint32_t)input[6] << 24);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 56 to 63
	value = ((uint32_t)input[7] << 24);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 64 to 71
	value = ((uint32_t)input[8] << 24);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 72 to 79
	value = ((uint32_t)input[9] << 24);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 80 to 87
	value = ((uint32_t)input[10] << 24);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 88 to 95
	value = ((uint32_t)input[11] << 24);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 96 to 103
	value = ((uint32_t)input[12] << 24);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 104 to 111
	value = ((uint32_t)input[13] << 24);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 112 to 119
	value = ((uint32_t)input[14] << 24);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 120 to 127
	value = ((uint32_t)input[15] << 24);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 128 to 135
	value = ((uint32_t)input[16] << 24);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 136 to 143
	value = ((uint32_t)input[17] << 24);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 144 to 151
	value = ((uint32_t)input[18] << 24);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 152 to 159
	value = ((uint32_t)input[19] << 24);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 160 to 167
	value = ((uint32_t)input[20] << 24);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 168 to 175
	value = ((uint32_t)input[21] << 24);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 176 to 183
	value = ((uint32_t)input[22] << 24);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 184 to 191
	value = ((uint32_t)input[23] << 24);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 192 to 199
	value = ((uint32_t)input[24] << 24);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 200 to 207
	value = ((uint32_t)input[25] << 24);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 208 to 215
	value = ((uint32_t)input[26] << 24);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 216 to 223
	value = ((uint32_t)input[27] << 24);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 224 to 231
	value = ((uint32_t)input[28] << 24);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 232 to 239
	value = ((uint32_t)input[29] << 24);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 240 to 247
	value = ((uint32_t)input[30] << 24);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 248 to 255
	value = ((uint32_t)input[31] << 24);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 256 to 263
	value = ((uint32_t)input[32] << 24);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 264 to 271
	value = ((uint32_t)input[33] << 24);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 272 to 279
	value = ((uint32_t)input[34] << 24);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 280 to 287
	value = ((uint32_t)input[35] << 24);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 288 to 295
	value = ((uint32_t)input[36] << 24);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 296 to 303
	value = ((uint32_t)input[37] << 24);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 304 to 311
	value = ((uint32_t)input[38] << 24);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 312 to 319
	value = ((uint32_t)input[39] << 24);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 320 to 327
	value = ((uint32_t)input[40] << 24);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 328 to 335
	value = ((uint32_t)input[41] << 24);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 336 to 343
	value = ((uint32_t)input[42] << 24);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 344 to 351
	value = ((uint32_t)input[43] << 24);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 352 to 359
	value = ((uint32_t)input[44] << 24);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 360 to 367
	value = ((uint32_t)input[45] << 24);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 368 to 375
	value = ((uint32_t)input[46] << 24);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 376 to 383
	value = ((uint32_t)input[47] << 24);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 384 to 391
	value = ((uint32_t)input[48] << 24);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 392 to 399
	value = ((uint32_t)input[49] << 24);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 400 to 407
	value = ((uint32_t)input[50] << 24);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 408 to 415
	value = ((uint32_t)input[51] << 24);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 416 to 423
	value = ((uint32_t)input[52] << 24);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 424 to 431
	value = ((uint32_t)input[53] << 24);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 432 to 439
	value = ((uint32_t)input[54] << 24);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 440 to 447
	value = ((uint32_t)input[55] << 24);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 448 to 455
	value = ((uint32_t)input[56] << 24);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 456 to 463
	value = ((uint32_t)input[57] << 24);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 464 to 471
	value = ((uint32_t)input[58] << 24);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 472 to 479
	value = ((uint32_t)input[59] << 24);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 480 to 487
	value = ((uint32_t)input[60] << 24);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 488 to 495
	value = ((uint32_t)input[61] << 24);
	output[61] = (double)(value >> 24);

	// read output[62]: from bit 496 to 503
	value = ((uint32_t)input[62] << 24);
	output[62] = (double)(value >> 24);

	// read output[63]: from bit 504 to 511
	value = ((uint32_t)input[63] << 24);
	output[63] = (double)(value >> 24);
}

static void unpack_64_8bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 64 values into output
	// Values are 8-bit signed
	// Skip 1 bits, read 512 bits of data.
	// Input must be at least 65 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 329 to 336
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)(input[42] & 0x80) << 17);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 337 to 344
	value = ((uint32_t)(input[42] & 0x7f) << 25) |
			((uint32_t)(input[43] & 0x80) << 17);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 345 to 352
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)(input[44] & 0x80) << 17);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 353 to 360
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)(input[45] & 0x80) << 17);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 361 to 368
	value = ((uint32_t)(input[45] & 0x7f) << 25) |
			((uint32_t)(input[46] & 0x80) << 17);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 369 to 376
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)(input[47] & 0x80) << 17);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 377 to 384
	value = ((uint32_t)(input[47] & 0x7f) << 25) |
			((uint32_t)(input[48] & 0x80) << 17);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 385 to 392
	value = ((uint32_t)(input[48] & 0x7f) << 25) |
			((uint32_t)(input[49] & 0x80) << 17);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 393 to 400
	value = ((uint32_t)(input[49] & 0x7f) << 25) |
			((uint32_t)(input[50] & 0x80) << 17);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 401 to 408
	value = ((uint32_t)(input[50] & 0x7f) << 25) |
			((uint32_t)(input[51] & 0x80) << 17);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 409 to 416
	value = ((uint32_t)(input[51] & 0x7f) << 25) |
			((uint32_t)(input[52] & 0x80) << 17);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 417 to 424
	value = ((uint32_t)(input[52] & 0x7f) << 25) |
			((uint32_t)(input[53] & 0x80) << 17);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 425 to 432
	value = ((uint32_t)(input[53] & 0x7f) << 25) |
			((uint32_t)(input[54] & 0x80) << 17);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 433 to 440
	value = ((uint32_t)(input[54] & 0x7f) << 25) |
			((uint32_t)(input[55] & 0x80) << 17);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 441 to 448
	value = ((uint32_t)(input[55] & 0x7f) << 25) |
			((uint32_t)(input[56] & 0x80) << 17);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 449 to 456
	value = ((uint32_t)(input[56] & 0x7f) << 25) |
			((uint32_t)(input[57] & 0x80) << 17);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 457 to 464
	value = ((uint32_t)(input[57] & 0x7f) << 25) |
			((uint32_t)(input[58] & 0x80) << 17);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 465 to 472
	value = ((uint32_t)(input[58] & 0x7f) << 25) |
			((uint32_t)(input[59] & 0x80) << 17);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 473 to 480
	value = ((uint32_t)(input[59] & 0x7f) << 25) |
			((uint32_t)(input[60] & 0x80) << 17);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 481 to 488
	value = ((uint32_t)(input[60] & 0x7f) << 25) |
			((uint32_t)(input[61] & 0x80) << 17);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 489 to 496
	value = ((uint32_t)(input[61] & 0x7f) << 25) |
			((uint32_t)(input[62] & 0x80) << 17);
	output[61] = (double)(value >> 24);

	// read output[62]: from bit 497 to 504
	value = ((uint32_t)(input[62] & 0x7f) << 25) |
			((uint32_t)(input[63] & 0x80) << 17);
	output[62] = (double)(value >> 24);

	// read output[63]: from bit 505 to 512
	value = ((uint32_t)(input[63] & 0x7f) << 25) |
			((uint32_t)(input[64] & 0x80) << 17);
	output[63] = (double)(value >> 24);
}

static void unpack_64_8bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 64 values into output
	// Values are 8-bit unsigned
	// Skip 1 bits, read 512 bits of data.
	// Input must be at least 65 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 8
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0x80) << 17);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 9 to 16
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0x80) << 17);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 17 to 24
	value = ((uint32_t)(input[2] & 0x7f) << 25) |
			((uint32_t)(input[3] & 0x80) << 17);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 25 to 32
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0x80) << 17);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 33 to 40
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0x80) << 17);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 41 to 48
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0x80) << 17);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 49 to 56
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0x80) << 17);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 57 to 64
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0x80) << 17);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 65 to 72
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0x80) << 17);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 73 to 80
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)(input[10] & 0x80) << 17);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 81 to 88
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)(input[11] & 0x80) << 17);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 89 to 96
	value = ((uint32_t)(input[11] & 0x7f) << 25) |
			((uint32_t)(input[12] & 0x80) << 17);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 97 to 104
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)(input[13] & 0x80) << 17);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 105 to 112
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)(input[14] & 0x80) << 17);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 113 to 120
	value = ((uint32_t)(input[14] & 0x7f) << 25) |
			((uint32_t)(input[15] & 0x80) << 17);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 121 to 128
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)(input[16] & 0x80) << 17);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 129 to 136
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)(input[17] & 0x80) << 17);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 137 to 144
	value = ((uint32_t)(input[17] & 0x7f) << 25) |
			((uint32_t)(input[18] & 0x80) << 17);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 145 to 152
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)(input[19] & 0x80) << 17);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 153 to 160
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)(input[20] & 0x80) << 17);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 161 to 168
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)(input[21] & 0x80) << 17);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 169 to 176
	value = ((uint32_t)(input[21] & 0x7f) << 25) |
			((uint32_t)(input[22] & 0x80) << 17);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 177 to 184
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)(input[23] & 0x80) << 17);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 185 to 192
	value = ((uint32_t)(input[23] & 0x7f) << 25) |
			((uint32_t)(input[24] & 0x80) << 17);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 193 to 200
	value = ((uint32_t)(input[24] & 0x7f) << 25) |
			((uint32_t)(input[25] & 0x80) << 17);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 201 to 208
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)(input[26] & 0x80) << 17);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 209 to 216
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)(input[27] & 0x80) << 17);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 217 to 224
	value = ((uint32_t)(input[27] & 0x7f) << 25) |
			((uint32_t)(input[28] & 0x80) << 17);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 225 to 232
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)(input[29] & 0x80) << 17);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 233 to 240
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)(input[30] & 0x80) << 17);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 241 to 248
	value = ((uint32_t)(input[30] & 0x7f) << 25) |
			((uint32_t)(input[31] & 0x80) << 17);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 249 to 256
	value = ((uint32_t)(input[31] & 0x7f) << 25) |
			((uint32_t)(input[32] & 0x80) << 17);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 257 to 264
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)(input[33] & 0x80) << 17);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 265 to 272
	value = ((uint32_t)(input[33] & 0x7f) << 25) |
			((uint32_t)(input[34] & 0x80) << 17);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 273 to 280
	value = ((uint32_t)(input[34] & 0x7f) << 25) |
			((uint32_t)(input[35] & 0x80) << 17);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 281 to 288
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)(input[36] & 0x80) << 17);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 289 to 296
	value = ((uint32_t)(input[36] & 0x7f) << 25) |
			((uint32_t)(input[37] & 0x80) << 17);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 297 to 304
	value = ((uint32_t)(input[37] & 0x7f) << 25) |
			((uint32_t)(input[38] & 0x80) << 17);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 305 to 312
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)(input[39] & 0x80) << 17);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 313 to 320
	value = ((uint32_t)(input[39] & 0x7f) << 25) |
			((uint32_t)(input[40] & 0x80) << 17);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 321 to 328
	value = ((uint32_t)(input[40] & 0x7f) << 25) |
			((uint32_t)(input[41] & 0x80) << 17);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 329 to 336
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)(input[42] & 0x80) << 17);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 337 to 344
	value = ((uint32_t)(input[42] & 0x7f) << 25) |
			((uint32_t)(input[43] & 0x80) << 17);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 345 to 352
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)(input[44] & 0x80) << 17);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 353 to 360
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)(input[45] & 0x80) << 17);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 361 to 368
	value = ((uint32_t)(input[45] & 0x7f) << 25) |
			((uint32_t)(input[46] & 0x80) << 17);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 369 to 376
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)(input[47] & 0x80) << 17);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 377 to 384
	value = ((uint32_t)(input[47] & 0x7f) << 25) |
			((uint32_t)(input[48] & 0x80) << 17);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 385 to 392
	value = ((uint32_t)(input[48] & 0x7f) << 25) |
			((uint32_t)(input[49] & 0x80) << 17);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 393 to 400
	value = ((uint32_t)(input[49] & 0x7f) << 25) |
			((uint32_t)(input[50] & 0x80) << 17);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 401 to 408
	value = ((uint32_t)(input[50] & 0x7f) << 25) |
			((uint32_t)(input[51] & 0x80) << 17);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 409 to 416
	value = ((uint32_t)(input[51] & 0x7f) << 25) |
			((uint32_t)(input[52] & 0x80) << 17);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 417 to 424
	value = ((uint32_t)(input[52] & 0x7f) << 25) |
			((uint32_t)(input[53] & 0x80) << 17);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 425 to 432
	value = ((uint32_t)(input[53] & 0x7f) << 25) |
			((uint32_t)(input[54] & 0x80) << 17);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 433 to 440
	value = ((uint32_t)(input[54] & 0x7f) << 25) |
			((uint32_t)(input[55] & 0x80) << 17);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 441 to 448
	value = ((uint32_t)(input[55] & 0x7f) << 25) |
			((uint32_t)(input[56] & 0x80) << 17);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 449 to 456
	value = ((uint32_t)(input[56] & 0x7f) << 25) |
			((uint32_t)(input[57] & 0x80) << 17);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 457 to 464
	value = ((uint32_t)(input[57] & 0x7f) << 25) |
			((uint32_t)(input[58] & 0x80) << 17);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 465 to 472
	value = ((uint32_t)(input[58] & 0x7f) << 25) |
			((uint32_t)(input[59] & 0x80) << 17);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 473 to 480
	value = ((uint32_t)(input[59] & 0x7f) << 25) |
			((uint32_t)(input[60] & 0x80) << 17);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 481 to 488
	value = ((uint32_t)(input[60] & 0x7f) << 25) |
			((uint32_t)(input[61] & 0x80) << 17);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 489 to 496
	value = ((uint32_t)(input[61] & 0x7f) << 25) |
			((uint32_t)(input[62] & 0x80) << 17);
	output[61] = (double)(value >> 24);

	// read output[62]: from bit 497 to 504
	value = ((uint32_t)(input[62] & 0x7f) << 25) |
			((uint32_t)(input[63] & 0x80) << 17);
	output[62] = (double)(value >> 24);

	// read output[63]: from bit 505 to 512
	value = ((uint32_t)(input[63] & 0x7f) << 25) |
			((uint32_t)(input[64] & 0x80) << 17);
	output[63] = (double)(value >> 24);
}

static void unpack_64_8bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 64 values into output
	// Values are 8-bit signed
	// Skip 2 bits, read 512 bits of data.
	// Input must be at least 65 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 330 to 337
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)(input[42] & 0xc0) << 18);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 338 to 345
	value = ((uint32_t)(input[42] & 0x3f) << 26) |
			((uint32_t)(input[43] & 0xc0) << 18);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 346 to 353
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)(input[44] & 0xc0) << 18);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 354 to 361
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)(input[45] & 0xc0) << 18);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 362 to 369
	value = ((uint32_t)(input[45] & 0x3f) << 26) |
			((uint32_t)(input[46] & 0xc0) << 18);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 370 to 377
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)(input[47] & 0xc0) << 18);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 378 to 385
	value = ((uint32_t)(input[47] & 0x3f) << 26) |
			((uint32_t)(input[48] & 0xc0) << 18);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 386 to 393
	value = ((uint32_t)(input[48] & 0x3f) << 26) |
			((uint32_t)(input[49] & 0xc0) << 18);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 394 to 401
	value = ((uint32_t)(input[49] & 0x3f) << 26) |
			((uint32_t)(input[50] & 0xc0) << 18);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 402 to 409
	value = ((uint32_t)(input[50] & 0x3f) << 26) |
			((uint32_t)(input[51] & 0xc0) << 18);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 410 to 417
	value = ((uint32_t)(input[51] & 0x3f) << 26) |
			((uint32_t)(input[52] & 0xc0) << 18);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 418 to 425
	value = ((uint32_t)(input[52] & 0x3f) << 26) |
			((uint32_t)(input[53] & 0xc0) << 18);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 426 to 433
	value = ((uint32_t)(input[53] & 0x3f) << 26) |
			((uint32_t)(input[54] & 0xc0) << 18);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 434 to 441
	value = ((uint32_t)(input[54] & 0x3f) << 26) |
			((uint32_t)(input[55] & 0xc0) << 18);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 442 to 449
	value = ((uint32_t)(input[55] & 0x3f) << 26) |
			((uint32_t)(input[56] & 0xc0) << 18);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 450 to 457
	value = ((uint32_t)(input[56] & 0x3f) << 26) |
			((uint32_t)(input[57] & 0xc0) << 18);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 458 to 465
	value = ((uint32_t)(input[57] & 0x3f) << 26) |
			((uint32_t)(input[58] & 0xc0) << 18);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 466 to 473
	value = ((uint32_t)(input[58] & 0x3f) << 26) |
			((uint32_t)(input[59] & 0xc0) << 18);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 474 to 481
	value = ((uint32_t)(input[59] & 0x3f) << 26) |
			((uint32_t)(input[60] & 0xc0) << 18);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 482 to 489
	value = ((uint32_t)(input[60] & 0x3f) << 26) |
			((uint32_t)(input[61] & 0xc0) << 18);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 490 to 497
	value = ((uint32_t)(input[61] & 0x3f) << 26) |
			((uint32_t)(input[62] & 0xc0) << 18);
	output[61] = (double)(value >> 24);

	// read output[62]: from bit 498 to 505
	value = ((uint32_t)(input[62] & 0x3f) << 26) |
			((uint32_t)(input[63] & 0xc0) << 18);
	output[62] = (double)(value >> 24);

	// read output[63]: from bit 506 to 513
	value = ((uint32_t)(input[63] & 0x3f) << 26) |
			((uint32_t)(input[64] & 0xc0) << 18);
	output[63] = (double)(value >> 24);
}

static void unpack_64_8bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 64 values into output
	// Values are 8-bit unsigned
	// Skip 2 bits, read 512 bits of data.
	// Input must be at least 65 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 9
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xc0) << 18);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 10 to 17
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xc0) << 18);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 18 to 25
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xc0) << 18);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 26 to 33
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)(input[4] & 0xc0) << 18);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 34 to 41
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xc0) << 18);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 42 to 49
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xc0) << 18);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 50 to 57
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xc0) << 18);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 58 to 65
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xc0) << 18);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 66 to 73
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xc0) << 18);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 74 to 81
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)(input[10] & 0xc0) << 18);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 82 to 89
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)(input[11] & 0xc0) << 18);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 90 to 97
	value = ((uint32_t)(input[11] & 0x3f) << 26) |
			((uint32_t)(input[12] & 0xc0) << 18);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 98 to 105
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)(input[13] & 0xc0) << 18);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 106 to 113
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)(input[14] & 0xc0) << 18);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 114 to 121
	value = ((uint32_t)(input[14] & 0x3f) << 26) |
			((uint32_t)(input[15] & 0xc0) << 18);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 122 to 129
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)(input[16] & 0xc0) << 18);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 130 to 137
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)(input[17] & 0xc0) << 18);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 138 to 145
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)(input[18] & 0xc0) << 18);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 146 to 153
	value = ((uint32_t)(input[18] & 0x3f) << 26) |
			((uint32_t)(input[19] & 0xc0) << 18);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 154 to 161
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)(input[20] & 0xc0) << 18);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 162 to 169
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)(input[21] & 0xc0) << 18);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 170 to 177
	value = ((uint32_t)(input[21] & 0x3f) << 26) |
			((uint32_t)(input[22] & 0xc0) << 18);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 178 to 185
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)(input[23] & 0xc0) << 18);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 186 to 193
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)(input[24] & 0xc0) << 18);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 194 to 201
	value = ((uint32_t)(input[24] & 0x3f) << 26) |
			((uint32_t)(input[25] & 0xc0) << 18);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 202 to 209
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)(input[26] & 0xc0) << 18);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 210 to 217
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)(input[27] & 0xc0) << 18);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 218 to 225
	value = ((uint32_t)(input[27] & 0x3f) << 26) |
			((uint32_t)(input[28] & 0xc0) << 18);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 226 to 233
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)(input[29] & 0xc0) << 18);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 234 to 241
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)(input[30] & 0xc0) << 18);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 242 to 249
	value = ((uint32_t)(input[30] & 0x3f) << 26) |
			((uint32_t)(input[31] & 0xc0) << 18);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 250 to 257
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)(input[32] & 0xc0) << 18);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 258 to 265
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)(input[33] & 0xc0) << 18);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 266 to 273
	value = ((uint32_t)(input[33] & 0x3f) << 26) |
			((uint32_t)(input[34] & 0xc0) << 18);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 274 to 281
	value = ((uint32_t)(input[34] & 0x3f) << 26) |
			((uint32_t)(input[35] & 0xc0) << 18);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 282 to 289
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)(input[36] & 0xc0) << 18);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 290 to 297
	value = ((uint32_t)(input[36] & 0x3f) << 26) |
			((uint32_t)(input[37] & 0xc0) << 18);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 298 to 305
	value = ((uint32_t)(input[37] & 0x3f) << 26) |
			((uint32_t)(input[38] & 0xc0) << 18);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 306 to 313
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)(input[39] & 0xc0) << 18);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 314 to 321
	value = ((uint32_t)(input[39] & 0x3f) << 26) |
			((uint32_t)(input[40] & 0xc0) << 18);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 322 to 329
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)(input[41] & 0xc0) << 18);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 330 to 337
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)(input[42] & 0xc0) << 18);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 338 to 345
	value = ((uint32_t)(input[42] & 0x3f) << 26) |
			((uint32_t)(input[43] & 0xc0) << 18);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 346 to 353
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)(input[44] & 0xc0) << 18);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 354 to 361
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)(input[45] & 0xc0) << 18);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 362 to 369
	value = ((uint32_t)(input[45] & 0x3f) << 26) |
			((uint32_t)(input[46] & 0xc0) << 18);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 370 to 377
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)(input[47] & 0xc0) << 18);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 378 to 385
	value = ((uint32_t)(input[47] & 0x3f) << 26) |
			((uint32_t)(input[48] & 0xc0) << 18);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 386 to 393
	value = ((uint32_t)(input[48] & 0x3f) << 26) |
			((uint32_t)(input[49] & 0xc0) << 18);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 394 to 401
	value = ((uint32_t)(input[49] & 0x3f) << 26) |
			((uint32_t)(input[50] & 0xc0) << 18);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 402 to 409
	value = ((uint32_t)(input[50] & 0x3f) << 26) |
			((uint32_t)(input[51] & 0xc0) << 18);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 410 to 417
	value = ((uint32_t)(input[51] & 0x3f) << 26) |
			((uint32_t)(input[52] & 0xc0) << 18);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 418 to 425
	value = ((uint32_t)(input[52] & 0x3f) << 26) |
			((uint32_t)(input[53] & 0xc0) << 18);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 426 to 433
	value = ((uint32_t)(input[53] & 0x3f) << 26) |
			((uint32_t)(input[54] & 0xc0) << 18);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 434 to 441
	value = ((uint32_t)(input[54] & 0x3f) << 26) |
			((uint32_t)(input[55] & 0xc0) << 18);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 442 to 449
	value = ((uint32_t)(input[55] & 0x3f) << 26) |
			((uint32_t)(input[56] & 0xc0) << 18);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 450 to 457
	value = ((uint32_t)(input[56] & 0x3f) << 26) |
			((uint32_t)(input[57] & 0xc0) << 18);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 458 to 465
	value = ((uint32_t)(input[57] & 0x3f) << 26) |
			((uint32_t)(input[58] & 0xc0) << 18);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 466 to 473
	value = ((uint32_t)(input[58] & 0x3f) << 26) |
			((uint32_t)(input[59] & 0xc0) << 18);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 474 to 481
	value = ((uint32_t)(input[59] & 0x3f) << 26) |
			((uint32_t)(input[60] & 0xc0) << 18);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 482 to 489
	value = ((uint32_t)(input[60] & 0x3f) << 26) |
			((uint32_t)(input[61] & 0xc0) << 18);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 490 to 497
	value = ((uint32_t)(input[61] & 0x3f) << 26) |
			((uint32_t)(input[62] & 0xc0) << 18);
	output[61] = (double)(value >> 24);

	// read output[62]: from bit 498 to 505
	value = ((uint32_t)(input[62] & 0x3f) << 26) |
			((uint32_t)(input[63] & 0xc0) << 18);
	output[62] = (double)(value >> 24);

	// read output[63]: from bit 506 to 513
	value = ((uint32_t)(input[63] & 0x3f) << 26) |
			((uint32_t)(input[64] & 0xc0) << 18);
	output[63] = (double)(value >> 24);
}

static void unpack_64_8bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 64 values into output
	// Values are 8-bit signed
	// Skip 3 bits, read 512 bits of data.
	// Input must be at least 65 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 331 to 338
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)(input[42] & 0xe0) << 19);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 339 to 346
	value = ((uint32_t)(input[42] & 0x1f) << 27) |
			((uint32_t)(input[43] & 0xe0) << 19);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 347 to 354
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)(input[44] & 0xe0) << 19);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 355 to 362
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)(input[45] & 0xe0) << 19);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 363 to 370
	value = ((uint32_t)(input[45] & 0x1f) << 27) |
			((uint32_t)(input[46] & 0xe0) << 19);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 371 to 378
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)(input[47] & 0xe0) << 19);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 379 to 386
	value = ((uint32_t)(input[47] & 0x1f) << 27) |
			((uint32_t)(input[48] & 0xe0) << 19);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 387 to 394
	value = ((uint32_t)(input[48] & 0x1f) << 27) |
			((uint32_t)(input[49] & 0xe0) << 19);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 395 to 402
	value = ((uint32_t)(input[49] & 0x1f) << 27) |
			((uint32_t)(input[50] & 0xe0) << 19);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 403 to 410
	value = ((uint32_t)(input[50] & 0x1f) << 27) |
			((uint32_t)(input[51] & 0xe0) << 19);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 411 to 418
	value = ((uint32_t)(input[51] & 0x1f) << 27) |
			((uint32_t)(input[52] & 0xe0) << 19);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 419 to 426
	value = ((uint32_t)(input[52] & 0x1f) << 27) |
			((uint32_t)(input[53] & 0xe0) << 19);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 427 to 434
	value = ((uint32_t)(input[53] & 0x1f) << 27) |
			((uint32_t)(input[54] & 0xe0) << 19);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 435 to 442
	value = ((uint32_t)(input[54] & 0x1f) << 27) |
			((uint32_t)(input[55] & 0xe0) << 19);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 443 to 450
	value = ((uint32_t)(input[55] & 0x1f) << 27) |
			((uint32_t)(input[56] & 0xe0) << 19);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 451 to 458
	value = ((uint32_t)(input[56] & 0x1f) << 27) |
			((uint32_t)(input[57] & 0xe0) << 19);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 459 to 466
	value = ((uint32_t)(input[57] & 0x1f) << 27) |
			((uint32_t)(input[58] & 0xe0) << 19);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 467 to 474
	value = ((uint32_t)(input[58] & 0x1f) << 27) |
			((uint32_t)(input[59] & 0xe0) << 19);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 475 to 482
	value = ((uint32_t)(input[59] & 0x1f) << 27) |
			((uint32_t)(input[60] & 0xe0) << 19);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 483 to 490
	value = ((uint32_t)(input[60] & 0x1f) << 27) |
			((uint32_t)(input[61] & 0xe0) << 19);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 491 to 498
	value = ((uint32_t)(input[61] & 0x1f) << 27) |
			((uint32_t)(input[62] & 0xe0) << 19);
	output[61] = (double)(value >> 24);

	// read output[62]: from bit 499 to 506
	value = ((uint32_t)(input[62] & 0x1f) << 27) |
			((uint32_t)(input[63] & 0xe0) << 19);
	output[62] = (double)(value >> 24);

	// read output[63]: from bit 507 to 514
	value = ((uint32_t)(input[63] & 0x1f) << 27) |
			((uint32_t)(input[64] & 0xe0) << 19);
	output[63] = (double)(value >> 24);
}

static void unpack_64_8bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 64 values into output
	// Values are 8-bit unsigned
	// Skip 3 bits, read 512 bits of data.
	// Input must be at least 65 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 10
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xe0) << 19);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 11 to 18
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xe0) << 19);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 19 to 26
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xe0) << 19);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 27 to 34
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xe0) << 19);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 35 to 42
	value = ((uint32_t)(input[4] & 0x1f) << 27) |
			((uint32_t)(input[5] & 0xe0) << 19);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 43 to 50
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xe0) << 19);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 51 to 58
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xe0) << 19);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 59 to 66
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xe0) << 19);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 67 to 74
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xe0) << 19);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 75 to 82
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)(input[10] & 0xe0) << 19);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 83 to 90
	value = ((uint32_t)(input[10] & 0x1f) << 27) |
			((uint32_t)(input[11] & 0xe0) << 19);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 91 to 98
	value = ((uint32_t)(input[11] & 0x1f) << 27) |
			((uint32_t)(input[12] & 0xe0) << 19);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 99 to 106
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)(input[13] & 0xe0) << 19);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 107 to 114
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)(input[14] & 0xe0) << 19);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 115 to 122
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)(input[15] & 0xe0) << 19);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 123 to 130
	value = ((uint32_t)(input[15] & 0x1f) << 27) |
			((uint32_t)(input[16] & 0xe0) << 19);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 131 to 138
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)(input[17] & 0xe0) << 19);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 139 to 146
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)(input[18] & 0xe0) << 19);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 147 to 154
	value = ((uint32_t)(input[18] & 0x1f) << 27) |
			((uint32_t)(input[19] & 0xe0) << 19);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 155 to 162
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)(input[20] & 0xe0) << 19);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 163 to 170
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)(input[21] & 0xe0) << 19);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 171 to 178
	value = ((uint32_t)(input[21] & 0x1f) << 27) |
			((uint32_t)(input[22] & 0xe0) << 19);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 179 to 186
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)(input[23] & 0xe0) << 19);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 187 to 194
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)(input[24] & 0xe0) << 19);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 195 to 202
	value = ((uint32_t)(input[24] & 0x1f) << 27) |
			((uint32_t)(input[25] & 0xe0) << 19);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 203 to 210
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)(input[26] & 0xe0) << 19);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 211 to 218
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)(input[27] & 0xe0) << 19);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 219 to 226
	value = ((uint32_t)(input[27] & 0x1f) << 27) |
			((uint32_t)(input[28] & 0xe0) << 19);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 227 to 234
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)(input[29] & 0xe0) << 19);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 235 to 242
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)(input[30] & 0xe0) << 19);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 243 to 250
	value = ((uint32_t)(input[30] & 0x1f) << 27) |
			((uint32_t)(input[31] & 0xe0) << 19);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 251 to 258
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)(input[32] & 0xe0) << 19);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 259 to 266
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)(input[33] & 0xe0) << 19);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 267 to 274
	value = ((uint32_t)(input[33] & 0x1f) << 27) |
			((uint32_t)(input[34] & 0xe0) << 19);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 275 to 282
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)(input[35] & 0xe0) << 19);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 283 to 290
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)(input[36] & 0xe0) << 19);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 291 to 298
	value = ((uint32_t)(input[36] & 0x1f) << 27) |
			((uint32_t)(input[37] & 0xe0) << 19);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 299 to 306
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)(input[38] & 0xe0) << 19);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 307 to 314
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)(input[39] & 0xe0) << 19);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 315 to 322
	value = ((uint32_t)(input[39] & 0x1f) << 27) |
			((uint32_t)(input[40] & 0xe0) << 19);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 323 to 330
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)(input[41] & 0xe0) << 19);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 331 to 338
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)(input[42] & 0xe0) << 19);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 339 to 346
	value = ((uint32_t)(input[42] & 0x1f) << 27) |
			((uint32_t)(input[43] & 0xe0) << 19);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 347 to 354
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)(input[44] & 0xe0) << 19);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 355 to 362
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)(input[45] & 0xe0) << 19);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 363 to 370
	value = ((uint32_t)(input[45] & 0x1f) << 27) |
			((uint32_t)(input[46] & 0xe0) << 19);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 371 to 378
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)(input[47] & 0xe0) << 19);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 379 to 386
	value = ((uint32_t)(input[47] & 0x1f) << 27) |
			((uint32_t)(input[48] & 0xe0) << 19);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 387 to 394
	value = ((uint32_t)(input[48] & 0x1f) << 27) |
			((uint32_t)(input[49] & 0xe0) << 19);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 395 to 402
	value = ((uint32_t)(input[49] & 0x1f) << 27) |
			((uint32_t)(input[50] & 0xe0) << 19);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 403 to 410
	value = ((uint32_t)(input[50] & 0x1f) << 27) |
			((uint32_t)(input[51] & 0xe0) << 19);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 411 to 418
	value = ((uint32_t)(input[51] & 0x1f) << 27) |
			((uint32_t)(input[52] & 0xe0) << 19);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 419 to 426
	value = ((uint32_t)(input[52] & 0x1f) << 27) |
			((uint32_t)(input[53] & 0xe0) << 19);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 427 to 434
	value = ((uint32_t)(input[53] & 0x1f) << 27) |
			((uint32_t)(input[54] & 0xe0) << 19);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 435 to 442
	value = ((uint32_t)(input[54] & 0x1f) << 27) |
			((uint32_t)(input[55] & 0xe0) << 19);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 443 to 450
	value = ((uint32_t)(input[55] & 0x1f) << 27) |
			((uint32_t)(input[56] & 0xe0) << 19);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 451 to 458
	value = ((uint32_t)(input[56] & 0x1f) << 27) |
			((uint32_t)(input[57] & 0xe0) << 19);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 459 to 466
	value = ((uint32_t)(input[57] & 0x1f) << 27) |
			((uint32_t)(input[58] & 0xe0) << 19);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 467 to 474
	value = ((uint32_t)(input[58] & 0x1f) << 27) |
			((uint32_t)(input[59] & 0xe0) << 19);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 475 to 482
	value = ((uint32_t)(input[59] & 0x1f) << 27) |
			((uint32_t)(input[60] & 0xe0) << 19);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 483 to 490
	value = ((uint32_t)(input[60] & 0x1f) << 27) |
			((uint32_t)(input[61] & 0xe0) << 19);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 491 to 498
	value = ((uint32_t)(input[61] & 0x1f) << 27) |
			((uint32_t)(input[62] & 0xe0) << 19);
	output[61] = (double)(value >> 24);

	// read output[62]: from bit 499 to 506
	value = ((uint32_t)(input[62] & 0x1f) << 27) |
			((uint32_t)(input[63] & 0xe0) << 19);
	output[62] = (double)(value >> 24);

	// read output[63]: from bit 507 to 514
	value = ((uint32_t)(input[63] & 0x1f) << 27) |
			((uint32_t)(input[64] & 0xe0) << 19);
	output[63] = (double)(value >> 24);
}

static void unpack_64_8bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 64 values into output
	// Values are 8-bit signed
	// Skip 4 bits, read 512 bits of data.
	// Input must be at least 65 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 332 to 339
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)(input[42] & 0xf0) << 20);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 340 to 347
	value = ((uint32_t)(input[42] & 0x0f) << 28) |
			((uint32_t)(input[43] & 0xf0) << 20);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 348 to 355
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)(input[44] & 0xf0) << 20);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 356 to 363
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)(input[45] & 0xf0) << 20);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 364 to 371
	value = ((uint32_t)(input[45] & 0x0f) << 28) |
			((uint32_t)(input[46] & 0xf0) << 20);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 372 to 379
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)(input[47] & 0xf0) << 20);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 380 to 387
	value = ((uint32_t)(input[47] & 0x0f) << 28) |
			((uint32_t)(input[48] & 0xf0) << 20);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 388 to 395
	value = ((uint32_t)(input[48] & 0x0f) << 28) |
			((uint32_t)(input[49] & 0xf0) << 20);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 396 to 403
	value = ((uint32_t)(input[49] & 0x0f) << 28) |
			((uint32_t)(input[50] & 0xf0) << 20);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 404 to 411
	value = ((uint32_t)(input[50] & 0x0f) << 28) |
			((uint32_t)(input[51] & 0xf0) << 20);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 412 to 419
	value = ((uint32_t)(input[51] & 0x0f) << 28) |
			((uint32_t)(input[52] & 0xf0) << 20);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 420 to 427
	value = ((uint32_t)(input[52] & 0x0f) << 28) |
			((uint32_t)(input[53] & 0xf0) << 20);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 428 to 435
	value = ((uint32_t)(input[53] & 0x0f) << 28) |
			((uint32_t)(input[54] & 0xf0) << 20);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 436 to 443
	value = ((uint32_t)(input[54] & 0x0f) << 28) |
			((uint32_t)(input[55] & 0xf0) << 20);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 444 to 451
	value = ((uint32_t)(input[55] & 0x0f) << 28) |
			((uint32_t)(input[56] & 0xf0) << 20);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 452 to 459
	value = ((uint32_t)(input[56] & 0x0f) << 28) |
			((uint32_t)(input[57] & 0xf0) << 20);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 460 to 467
	value = ((uint32_t)(input[57] & 0x0f) << 28) |
			((uint32_t)(input[58] & 0xf0) << 20);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 468 to 475
	value = ((uint32_t)(input[58] & 0x0f) << 28) |
			((uint32_t)(input[59] & 0xf0) << 20);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 476 to 483
	value = ((uint32_t)(input[59] & 0x0f) << 28) |
			((uint32_t)(input[60] & 0xf0) << 20);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 484 to 491
	value = ((uint32_t)(input[60] & 0x0f) << 28) |
			((uint32_t)(input[61] & 0xf0) << 20);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 492 to 499
	value = ((uint32_t)(input[61] & 0x0f) << 28) |
			((uint32_t)(input[62] & 0xf0) << 20);
	output[61] = (double)(value >> 24);

	// read output[62]: from bit 500 to 507
	value = ((uint32_t)(input[62] & 0x0f) << 28) |
			((uint32_t)(input[63] & 0xf0) << 20);
	output[62] = (double)(value >> 24);

	// read output[63]: from bit 508 to 515
	value = ((uint32_t)(input[63] & 0x0f) << 28) |
			((uint32_t)(input[64] & 0xf0) << 20);
	output[63] = (double)(value >> 24);
}

static void unpack_64_8bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 64 values into output
	// Values are 8-bit unsigned
	// Skip 4 bits, read 512 bits of data.
	// Input must be at least 65 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 11
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf0) << 20);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 12 to 19
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf0) << 20);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 20 to 27
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf0) << 20);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 28 to 35
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf0) << 20);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 36 to 43
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf0) << 20);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 44 to 51
	value = ((uint32_t)(input[5] & 0x0f) << 28) |
			((uint32_t)(input[6] & 0xf0) << 20);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 52 to 59
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf0) << 20);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 60 to 67
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf0) << 20);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 68 to 75
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf0) << 20);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 76 to 83
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)(input[10] & 0xf0) << 20);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 84 to 91
	value = ((uint32_t)(input[10] & 0x0f) << 28) |
			((uint32_t)(input[11] & 0xf0) << 20);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 92 to 99
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)(input[12] & 0xf0) << 20);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 100 to 107
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)(input[13] & 0xf0) << 20);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 108 to 115
	value = ((uint32_t)(input[13] & 0x0f) << 28) |
			((uint32_t)(input[14] & 0xf0) << 20);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 116 to 123
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)(input[15] & 0xf0) << 20);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 124 to 131
	value = ((uint32_t)(input[15] & 0x0f) << 28) |
			((uint32_t)(input[16] & 0xf0) << 20);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 132 to 139
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)(input[17] & 0xf0) << 20);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 140 to 147
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)(input[18] & 0xf0) << 20);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 148 to 155
	value = ((uint32_t)(input[18] & 0x0f) << 28) |
			((uint32_t)(input[19] & 0xf0) << 20);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 156 to 163
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)(input[20] & 0xf0) << 20);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 164 to 171
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)(input[21] & 0xf0) << 20);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 172 to 179
	value = ((uint32_t)(input[21] & 0x0f) << 28) |
			((uint32_t)(input[22] & 0xf0) << 20);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 180 to 187
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)(input[23] & 0xf0) << 20);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 188 to 195
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)(input[24] & 0xf0) << 20);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 196 to 203
	value = ((uint32_t)(input[24] & 0x0f) << 28) |
			((uint32_t)(input[25] & 0xf0) << 20);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 204 to 211
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)(input[26] & 0xf0) << 20);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 212 to 219
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)(input[27] & 0xf0) << 20);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 220 to 227
	value = ((uint32_t)(input[27] & 0x0f) << 28) |
			((uint32_t)(input[28] & 0xf0) << 20);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 228 to 235
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)(input[29] & 0xf0) << 20);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 236 to 243
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)(input[30] & 0xf0) << 20);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 244 to 251
	value = ((uint32_t)(input[30] & 0x0f) << 28) |
			((uint32_t)(input[31] & 0xf0) << 20);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 252 to 259
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)(input[32] & 0xf0) << 20);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 260 to 267
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)(input[33] & 0xf0) << 20);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 268 to 275
	value = ((uint32_t)(input[33] & 0x0f) << 28) |
			((uint32_t)(input[34] & 0xf0) << 20);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 276 to 283
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)(input[35] & 0xf0) << 20);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 284 to 291
	value = ((uint32_t)(input[35] & 0x0f) << 28) |
			((uint32_t)(input[36] & 0xf0) << 20);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 292 to 299
	value = ((uint32_t)(input[36] & 0x0f) << 28) |
			((uint32_t)(input[37] & 0xf0) << 20);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 300 to 307
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)(input[38] & 0xf0) << 20);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 308 to 315
	value = ((uint32_t)(input[38] & 0x0f) << 28) |
			((uint32_t)(input[39] & 0xf0) << 20);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 316 to 323
	value = ((uint32_t)(input[39] & 0x0f) << 28) |
			((uint32_t)(input[40] & 0xf0) << 20);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 324 to 331
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)(input[41] & 0xf0) << 20);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 332 to 339
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)(input[42] & 0xf0) << 20);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 340 to 347
	value = ((uint32_t)(input[42] & 0x0f) << 28) |
			((uint32_t)(input[43] & 0xf0) << 20);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 348 to 355
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)(input[44] & 0xf0) << 20);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 356 to 363
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)(input[45] & 0xf0) << 20);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 364 to 371
	value = ((uint32_t)(input[45] & 0x0f) << 28) |
			((uint32_t)(input[46] & 0xf0) << 20);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 372 to 379
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)(input[47] & 0xf0) << 20);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 380 to 387
	value = ((uint32_t)(input[47] & 0x0f) << 28) |
			((uint32_t)(input[48] & 0xf0) << 20);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 388 to 395
	value = ((uint32_t)(input[48] & 0x0f) << 28) |
			((uint32_t)(input[49] & 0xf0) << 20);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 396 to 403
	value = ((uint32_t)(input[49] & 0x0f) << 28) |
			((uint32_t)(input[50] & 0xf0) << 20);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 404 to 411
	value = ((uint32_t)(input[50] & 0x0f) << 28) |
			((uint32_t)(input[51] & 0xf0) << 20);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 412 to 419
	value = ((uint32_t)(input[51] & 0x0f) << 28) |
			((uint32_t)(input[52] & 0xf0) << 20);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 420 to 427
	value = ((uint32_t)(input[52] & 0x0f) << 28) |
			((uint32_t)(input[53] & 0xf0) << 20);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 428 to 435
	value = ((uint32_t)(input[53] & 0x0f) << 28) |
			((uint32_t)(input[54] & 0xf0) << 20);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 436 to 443
	value = ((uint32_t)(input[54] & 0x0f) << 28) |
			((uint32_t)(input[55] & 0xf0) << 20);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 444 to 451
	value = ((uint32_t)(input[55] & 0x0f) << 28) |
			((uint32_t)(input[56] & 0xf0) << 20);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 452 to 459
	value = ((uint32_t)(input[56] & 0x0f) << 28) |
			((uint32_t)(input[57] & 0xf0) << 20);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 460 to 467
	value = ((uint32_t)(input[57] & 0x0f) << 28) |
			((uint32_t)(input[58] & 0xf0) << 20);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 468 to 475
	value = ((uint32_t)(input[58] & 0x0f) << 28) |
			((uint32_t)(input[59] & 0xf0) << 20);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 476 to 483
	value = ((uint32_t)(input[59] & 0x0f) << 28) |
			((uint32_t)(input[60] & 0xf0) << 20);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 484 to 491
	value = ((uint32_t)(input[60] & 0x0f) << 28) |
			((uint32_t)(input[61] & 0xf0) << 20);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 492 to 499
	value = ((uint32_t)(input[61] & 0x0f) << 28) |
			((uint32_t)(input[62] & 0xf0) << 20);
	output[61] = (double)(value >> 24);

	// read output[62]: from bit 500 to 507
	value = ((uint32_t)(input[62] & 0x0f) << 28) |
			((uint32_t)(input[63] & 0xf0) << 20);
	output[62] = (double)(value >> 24);

	// read output[63]: from bit 508 to 515
	value = ((uint32_t)(input[63] & 0x0f) << 28) |
			((uint32_t)(input[64] & 0xf0) << 20);
	output[63] = (double)(value >> 24);
}

static void unpack_64_8bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 64 values into output
	// Values are 8-bit signed
	// Skip 5 bits, read 512 bits of data.
	// Input must be at least 65 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 333 to 340
	value = ((uint32_t)(input[41] & 0x07) << 29) |
			((uint32_t)(input[42] & 0xf8) << 21);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 341 to 348
	value = ((uint32_t)(input[42] & 0x07) << 29) |
			((uint32_t)(input[43] & 0xf8) << 21);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 349 to 356
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)(input[44] & 0xf8) << 21);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 357 to 364
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)(input[45] & 0xf8) << 21);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 365 to 372
	value = ((uint32_t)(input[45] & 0x07) << 29) |
			((uint32_t)(input[46] & 0xf8) << 21);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 373 to 380
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)(input[47] & 0xf8) << 21);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 381 to 388
	value = ((uint32_t)(input[47] & 0x07) << 29) |
			((uint32_t)(input[48] & 0xf8) << 21);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 389 to 396
	value = ((uint32_t)(input[48] & 0x07) << 29) |
			((uint32_t)(input[49] & 0xf8) << 21);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 397 to 404
	value = ((uint32_t)(input[49] & 0x07) << 29) |
			((uint32_t)(input[50] & 0xf8) << 21);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 405 to 412
	value = ((uint32_t)(input[50] & 0x07) << 29) |
			((uint32_t)(input[51] & 0xf8) << 21);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 413 to 420
	value = ((uint32_t)(input[51] & 0x07) << 29) |
			((uint32_t)(input[52] & 0xf8) << 21);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 421 to 428
	value = ((uint32_t)(input[52] & 0x07) << 29) |
			((uint32_t)(input[53] & 0xf8) << 21);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 429 to 436
	value = ((uint32_t)(input[53] & 0x07) << 29) |
			((uint32_t)(input[54] & 0xf8) << 21);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 437 to 444
	value = ((uint32_t)(input[54] & 0x07) << 29) |
			((uint32_t)(input[55] & 0xf8) << 21);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 445 to 452
	value = ((uint32_t)(input[55] & 0x07) << 29) |
			((uint32_t)(input[56] & 0xf8) << 21);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 453 to 460
	value = ((uint32_t)(input[56] & 0x07) << 29) |
			((uint32_t)(input[57] & 0xf8) << 21);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 461 to 468
	value = ((uint32_t)(input[57] & 0x07) << 29) |
			((uint32_t)(input[58] & 0xf8) << 21);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 469 to 476
	value = ((uint32_t)(input[58] & 0x07) << 29) |
			((uint32_t)(input[59] & 0xf8) << 21);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 477 to 484
	value = ((uint32_t)(input[59] & 0x07) << 29) |
			((uint32_t)(input[60] & 0xf8) << 21);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 485 to 492
	value = ((uint32_t)(input[60] & 0x07) << 29) |
			((uint32_t)(input[61] & 0xf8) << 21);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 493 to 500
	value = ((uint32_t)(input[61] & 0x07) << 29) |
			((uint32_t)(input[62] & 0xf8) << 21);
	output[61] = (double)(value >> 24);

	// read output[62]: from bit 501 to 508
	value = ((uint32_t)(input[62] & 0x07) << 29) |
			((uint32_t)(input[63] & 0xf8) << 21);
	output[62] = (double)(value >> 24);

	// read output[63]: from bit 509 to 516
	value = ((uint32_t)(input[63] & 0x07) << 29) |
			((uint32_t)(input[64] & 0xf8) << 21);
	output[63] = (double)(value >> 24);
}

static void unpack_64_8bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 64 values into output
	// Values are 8-bit unsigned
	// Skip 5 bits, read 512 bits of data.
	// Input must be at least 65 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 12
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xf8) << 21);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 13 to 20
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xf8) << 21);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 21 to 28
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xf8) << 21);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 29 to 36
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xf8) << 21);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 37 to 44
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xf8) << 21);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 45 to 52
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xf8) << 21);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 53 to 60
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)(input[7] & 0xf8) << 21);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 61 to 68
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xf8) << 21);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 69 to 76
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xf8) << 21);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 77 to 84
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)(input[10] & 0xf8) << 21);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 85 to 92
	value = ((uint32_t)(input[10] & 0x07) << 29) |
			((uint32_t)(input[11] & 0xf8) << 21);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 93 to 100
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)(input[12] & 0xf8) << 21);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 101 to 108
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)(input[13] & 0xf8) << 21);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 109 to 116
	value = ((uint32_t)(input[13] & 0x07) << 29) |
			((uint32_t)(input[14] & 0xf8) << 21);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 117 to 124
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)(input[15] & 0xf8) << 21);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 125 to 132
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)(input[16] & 0xf8) << 21);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 133 to 140
	value = ((uint32_t)(input[16] & 0x07) << 29) |
			((uint32_t)(input[17] & 0xf8) << 21);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 141 to 148
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)(input[18] & 0xf8) << 21);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 149 to 156
	value = ((uint32_t)(input[18] & 0x07) << 29) |
			((uint32_t)(input[19] & 0xf8) << 21);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 157 to 164
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)(input[20] & 0xf8) << 21);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 165 to 172
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)(input[21] & 0xf8) << 21);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 173 to 180
	value = ((uint32_t)(input[21] & 0x07) << 29) |
			((uint32_t)(input[22] & 0xf8) << 21);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 181 to 188
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)(input[23] & 0xf8) << 21);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 189 to 196
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)(input[24] & 0xf8) << 21);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 197 to 204
	value = ((uint32_t)(input[24] & 0x07) << 29) |
			((uint32_t)(input[25] & 0xf8) << 21);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 205 to 212
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)(input[26] & 0xf8) << 21);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 213 to 220
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)(input[27] & 0xf8) << 21);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 221 to 228
	value = ((uint32_t)(input[27] & 0x07) << 29) |
			((uint32_t)(input[28] & 0xf8) << 21);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 229 to 236
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)(input[29] & 0xf8) << 21);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 237 to 244
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)(input[30] & 0xf8) << 21);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 245 to 252
	value = ((uint32_t)(input[30] & 0x07) << 29) |
			((uint32_t)(input[31] & 0xf8) << 21);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 253 to 260
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)(input[32] & 0xf8) << 21);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 261 to 268
	value = ((uint32_t)(input[32] & 0x07) << 29) |
			((uint32_t)(input[33] & 0xf8) << 21);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 269 to 276
	value = ((uint32_t)(input[33] & 0x07) << 29) |
			((uint32_t)(input[34] & 0xf8) << 21);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 277 to 284
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)(input[35] & 0xf8) << 21);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 285 to 292
	value = ((uint32_t)(input[35] & 0x07) << 29) |
			((uint32_t)(input[36] & 0xf8) << 21);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 293 to 300
	value = ((uint32_t)(input[36] & 0x07) << 29) |
			((uint32_t)(input[37] & 0xf8) << 21);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 301 to 308
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)(input[38] & 0xf8) << 21);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 309 to 316
	value = ((uint32_t)(input[38] & 0x07) << 29) |
			((uint32_t)(input[39] & 0xf8) << 21);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 317 to 324
	value = ((uint32_t)(input[39] & 0x07) << 29) |
			((uint32_t)(input[40] & 0xf8) << 21);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 325 to 332
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)(input[41] & 0xf8) << 21);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 333 to 340
	value = ((uint32_t)(input[41] & 0x07) << 29) |
			((uint32_t)(input[42] & 0xf8) << 21);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 341 to 348
	value = ((uint32_t)(input[42] & 0x07) << 29) |
			((uint32_t)(input[43] & 0xf8) << 21);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 349 to 356
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)(input[44] & 0xf8) << 21);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 357 to 364
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)(input[45] & 0xf8) << 21);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 365 to 372
	value = ((uint32_t)(input[45] & 0x07) << 29) |
			((uint32_t)(input[46] & 0xf8) << 21);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 373 to 380
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)(input[47] & 0xf8) << 21);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 381 to 388
	value = ((uint32_t)(input[47] & 0x07) << 29) |
			((uint32_t)(input[48] & 0xf8) << 21);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 389 to 396
	value = ((uint32_t)(input[48] & 0x07) << 29) |
			((uint32_t)(input[49] & 0xf8) << 21);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 397 to 404
	value = ((uint32_t)(input[49] & 0x07) << 29) |
			((uint32_t)(input[50] & 0xf8) << 21);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 405 to 412
	value = ((uint32_t)(input[50] & 0x07) << 29) |
			((uint32_t)(input[51] & 0xf8) << 21);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 413 to 420
	value = ((uint32_t)(input[51] & 0x07) << 29) |
			((uint32_t)(input[52] & 0xf8) << 21);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 421 to 428
	value = ((uint32_t)(input[52] & 0x07) << 29) |
			((uint32_t)(input[53] & 0xf8) << 21);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 429 to 436
	value = ((uint32_t)(input[53] & 0x07) << 29) |
			((uint32_t)(input[54] & 0xf8) << 21);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 437 to 444
	value = ((uint32_t)(input[54] & 0x07) << 29) |
			((uint32_t)(input[55] & 0xf8) << 21);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 445 to 452
	value = ((uint32_t)(input[55] & 0x07) << 29) |
			((uint32_t)(input[56] & 0xf8) << 21);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 453 to 460
	value = ((uint32_t)(input[56] & 0x07) << 29) |
			((uint32_t)(input[57] & 0xf8) << 21);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 461 to 468
	value = ((uint32_t)(input[57] & 0x07) << 29) |
			((uint32_t)(input[58] & 0xf8) << 21);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 469 to 476
	value = ((uint32_t)(input[58] & 0x07) << 29) |
			((uint32_t)(input[59] & 0xf8) << 21);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 477 to 484
	value = ((uint32_t)(input[59] & 0x07) << 29) |
			((uint32_t)(input[60] & 0xf8) << 21);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 485 to 492
	value = ((uint32_t)(input[60] & 0x07) << 29) |
			((uint32_t)(input[61] & 0xf8) << 21);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 493 to 500
	value = ((uint32_t)(input[61] & 0x07) << 29) |
			((uint32_t)(input[62] & 0xf8) << 21);
	output[61] = (double)(value >> 24);

	// read output[62]: from bit 501 to 508
	value = ((uint32_t)(input[62] & 0x07) << 29) |
			((uint32_t)(input[63] & 0xf8) << 21);
	output[62] = (double)(value >> 24);

	// read output[63]: from bit 509 to 516
	value = ((uint32_t)(input[63] & 0x07) << 29) |
			((uint32_t)(input[64] & 0xf8) << 21);
	output[63] = (double)(value >> 24);
}

static void unpack_64_8bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 64 values into output
	// Values are 8-bit signed
	// Skip 6 bits, read 512 bits of data.
	// Input must be at least 65 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 334 to 341
	value = ((uint32_t)(input[41] & 0x03) << 30) |
			((uint32_t)(input[42] & 0xfc) << 22);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 342 to 349
	value = ((uint32_t)(input[42] & 0x03) << 30) |
			((uint32_t)(input[43] & 0xfc) << 22);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 350 to 357
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)(input[44] & 0xfc) << 22);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 358 to 365
	value = ((uint32_t)(input[44] & 0x03) << 30) |
			((uint32_t)(input[45] & 0xfc) << 22);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 366 to 373
	value = ((uint32_t)(input[45] & 0x03) << 30) |
			((uint32_t)(input[46] & 0xfc) << 22);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 374 to 381
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)(input[47] & 0xfc) << 22);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 382 to 389
	value = ((uint32_t)(input[47] & 0x03) << 30) |
			((uint32_t)(input[48] & 0xfc) << 22);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 390 to 397
	value = ((uint32_t)(input[48] & 0x03) << 30) |
			((uint32_t)(input[49] & 0xfc) << 22);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 398 to 405
	value = ((uint32_t)(input[49] & 0x03) << 30) |
			((uint32_t)(input[50] & 0xfc) << 22);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 406 to 413
	value = ((uint32_t)(input[50] & 0x03) << 30) |
			((uint32_t)(input[51] & 0xfc) << 22);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 414 to 421
	value = ((uint32_t)(input[51] & 0x03) << 30) |
			((uint32_t)(input[52] & 0xfc) << 22);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 422 to 429
	value = ((uint32_t)(input[52] & 0x03) << 30) |
			((uint32_t)(input[53] & 0xfc) << 22);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 430 to 437
	value = ((uint32_t)(input[53] & 0x03) << 30) |
			((uint32_t)(input[54] & 0xfc) << 22);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 438 to 445
	value = ((uint32_t)(input[54] & 0x03) << 30) |
			((uint32_t)(input[55] & 0xfc) << 22);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 446 to 453
	value = ((uint32_t)(input[55] & 0x03) << 30) |
			((uint32_t)(input[56] & 0xfc) << 22);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 454 to 461
	value = ((uint32_t)(input[56] & 0x03) << 30) |
			((uint32_t)(input[57] & 0xfc) << 22);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 462 to 469
	value = ((uint32_t)(input[57] & 0x03) << 30) |
			((uint32_t)(input[58] & 0xfc) << 22);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 470 to 477
	value = ((uint32_t)(input[58] & 0x03) << 30) |
			((uint32_t)(input[59] & 0xfc) << 22);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 478 to 485
	value = ((uint32_t)(input[59] & 0x03) << 30) |
			((uint32_t)(input[60] & 0xfc) << 22);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 486 to 493
	value = ((uint32_t)(input[60] & 0x03) << 30) |
			((uint32_t)(input[61] & 0xfc) << 22);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 494 to 501
	value = ((uint32_t)(input[61] & 0x03) << 30) |
			((uint32_t)(input[62] & 0xfc) << 22);
	output[61] = (double)(value >> 24);

	// read output[62]: from bit 502 to 509
	value = ((uint32_t)(input[62] & 0x03) << 30) |
			((uint32_t)(input[63] & 0xfc) << 22);
	output[62] = (double)(value >> 24);

	// read output[63]: from bit 510 to 517
	value = ((uint32_t)(input[63] & 0x03) << 30) |
			((uint32_t)(input[64] & 0xfc) << 22);
	output[63] = (double)(value >> 24);
}

static void unpack_64_8bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 64 values into output
	// Values are 8-bit unsigned
	// Skip 6 bits, read 512 bits of data.
	// Input must be at least 65 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 13
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfc) << 22);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 14 to 21
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfc) << 22);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 22 to 29
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfc) << 22);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 30 to 37
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfc) << 22);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 38 to 45
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfc) << 22);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 46 to 53
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfc) << 22);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 54 to 61
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfc) << 22);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 62 to 69
	value = ((uint32_t)(input[7] & 0x03) << 30) |
			((uint32_t)(input[8] & 0xfc) << 22);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 70 to 77
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfc) << 22);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 78 to 85
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)(input[10] & 0xfc) << 22);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 86 to 93
	value = ((uint32_t)(input[10] & 0x03) << 30) |
			((uint32_t)(input[11] & 0xfc) << 22);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 94 to 101
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)(input[12] & 0xfc) << 22);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 102 to 109
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)(input[13] & 0xfc) << 22);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 110 to 117
	value = ((uint32_t)(input[13] & 0x03) << 30) |
			((uint32_t)(input[14] & 0xfc) << 22);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 118 to 125
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)(input[15] & 0xfc) << 22);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 126 to 133
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)(input[16] & 0xfc) << 22);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 134 to 141
	value = ((uint32_t)(input[16] & 0x03) << 30) |
			((uint32_t)(input[17] & 0xfc) << 22);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 142 to 149
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)(input[18] & 0xfc) << 22);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 150 to 157
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)(input[19] & 0xfc) << 22);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 158 to 165
	value = ((uint32_t)(input[19] & 0x03) << 30) |
			((uint32_t)(input[20] & 0xfc) << 22);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 166 to 173
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)(input[21] & 0xfc) << 22);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 174 to 181
	value = ((uint32_t)(input[21] & 0x03) << 30) |
			((uint32_t)(input[22] & 0xfc) << 22);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 182 to 189
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)(input[23] & 0xfc) << 22);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 190 to 197
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)(input[24] & 0xfc) << 22);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 198 to 205
	value = ((uint32_t)(input[24] & 0x03) << 30) |
			((uint32_t)(input[25] & 0xfc) << 22);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 206 to 213
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)(input[26] & 0xfc) << 22);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 214 to 221
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)(input[27] & 0xfc) << 22);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 222 to 229
	value = ((uint32_t)(input[27] & 0x03) << 30) |
			((uint32_t)(input[28] & 0xfc) << 22);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 230 to 237
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)(input[29] & 0xfc) << 22);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 238 to 245
	value = ((uint32_t)(input[29] & 0x03) << 30) |
			((uint32_t)(input[30] & 0xfc) << 22);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 246 to 253
	value = ((uint32_t)(input[30] & 0x03) << 30) |
			((uint32_t)(input[31] & 0xfc) << 22);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 254 to 261
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)(input[32] & 0xfc) << 22);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 262 to 269
	value = ((uint32_t)(input[32] & 0x03) << 30) |
			((uint32_t)(input[33] & 0xfc) << 22);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 270 to 277
	value = ((uint32_t)(input[33] & 0x03) << 30) |
			((uint32_t)(input[34] & 0xfc) << 22);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 278 to 285
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)(input[35] & 0xfc) << 22);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 286 to 293
	value = ((uint32_t)(input[35] & 0x03) << 30) |
			((uint32_t)(input[36] & 0xfc) << 22);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 294 to 301
	value = ((uint32_t)(input[36] & 0x03) << 30) |
			((uint32_t)(input[37] & 0xfc) << 22);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 302 to 309
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)(input[38] & 0xfc) << 22);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 310 to 317
	value = ((uint32_t)(input[38] & 0x03) << 30) |
			((uint32_t)(input[39] & 0xfc) << 22);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 318 to 325
	value = ((uint32_t)(input[39] & 0x03) << 30) |
			((uint32_t)(input[40] & 0xfc) << 22);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 326 to 333
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)(input[41] & 0xfc) << 22);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 334 to 341
	value = ((uint32_t)(input[41] & 0x03) << 30) |
			((uint32_t)(input[42] & 0xfc) << 22);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 342 to 349
	value = ((uint32_t)(input[42] & 0x03) << 30) |
			((uint32_t)(input[43] & 0xfc) << 22);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 350 to 357
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)(input[44] & 0xfc) << 22);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 358 to 365
	value = ((uint32_t)(input[44] & 0x03) << 30) |
			((uint32_t)(input[45] & 0xfc) << 22);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 366 to 373
	value = ((uint32_t)(input[45] & 0x03) << 30) |
			((uint32_t)(input[46] & 0xfc) << 22);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 374 to 381
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)(input[47] & 0xfc) << 22);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 382 to 389
	value = ((uint32_t)(input[47] & 0x03) << 30) |
			((uint32_t)(input[48] & 0xfc) << 22);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 390 to 397
	value = ((uint32_t)(input[48] & 0x03) << 30) |
			((uint32_t)(input[49] & 0xfc) << 22);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 398 to 405
	value = ((uint32_t)(input[49] & 0x03) << 30) |
			((uint32_t)(input[50] & 0xfc) << 22);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 406 to 413
	value = ((uint32_t)(input[50] & 0x03) << 30) |
			((uint32_t)(input[51] & 0xfc) << 22);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 414 to 421
	value = ((uint32_t)(input[51] & 0x03) << 30) |
			((uint32_t)(input[52] & 0xfc) << 22);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 422 to 429
	value = ((uint32_t)(input[52] & 0x03) << 30) |
			((uint32_t)(input[53] & 0xfc) << 22);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 430 to 437
	value = ((uint32_t)(input[53] & 0x03) << 30) |
			((uint32_t)(input[54] & 0xfc) << 22);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 438 to 445
	value = ((uint32_t)(input[54] & 0x03) << 30) |
			((uint32_t)(input[55] & 0xfc) << 22);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 446 to 453
	value = ((uint32_t)(input[55] & 0x03) << 30) |
			((uint32_t)(input[56] & 0xfc) << 22);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 454 to 461
	value = ((uint32_t)(input[56] & 0x03) << 30) |
			((uint32_t)(input[57] & 0xfc) << 22);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 462 to 469
	value = ((uint32_t)(input[57] & 0x03) << 30) |
			((uint32_t)(input[58] & 0xfc) << 22);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 470 to 477
	value = ((uint32_t)(input[58] & 0x03) << 30) |
			((uint32_t)(input[59] & 0xfc) << 22);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 478 to 485
	value = ((uint32_t)(input[59] & 0x03) << 30) |
			((uint32_t)(input[60] & 0xfc) << 22);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 486 to 493
	value = ((uint32_t)(input[60] & 0x03) << 30) |
			((uint32_t)(input[61] & 0xfc) << 22);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 494 to 501
	value = ((uint32_t)(input[61] & 0x03) << 30) |
			((uint32_t)(input[62] & 0xfc) << 22);
	output[61] = (double)(value >> 24);

	// read output[62]: from bit 502 to 509
	value = ((uint32_t)(input[62] & 0x03) << 30) |
			((uint32_t)(input[63] & 0xfc) << 22);
	output[62] = (double)(value >> 24);

	// read output[63]: from bit 510 to 517
	value = ((uint32_t)(input[63] & 0x03) << 30) |
			((uint32_t)(input[64] & 0xfc) << 22);
	output[63] = (double)(value >> 24);
}

static void unpack_64_8bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 64 values into output
	// Values are 8-bit signed
	// Skip 7 bits, read 512 bits of data.
	// Input must be at least 65 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 335 to 342
	value = ((uint32_t)(input[41] & 0x01) << 31) |
			((uint32_t)(input[42] & 0xfe) << 23);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 343 to 350
	value = ((uint32_t)(input[42] & 0x01) << 31) |
			((uint32_t)(input[43] & 0xfe) << 23);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 351 to 358
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)(input[44] & 0xfe) << 23);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 359 to 366
	value = ((uint32_t)(input[44] & 0x01) << 31) |
			((uint32_t)(input[45] & 0xfe) << 23);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 367 to 374
	value = ((uint32_t)(input[45] & 0x01) << 31) |
			((uint32_t)(input[46] & 0xfe) << 23);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 375 to 382
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)(input[47] & 0xfe) << 23);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 383 to 390
	value = ((uint32_t)(input[47] & 0x01) << 31) |
			((uint32_t)(input[48] & 0xfe) << 23);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 391 to 398
	value = ((uint32_t)(input[48] & 0x01) << 31) |
			((uint32_t)(input[49] & 0xfe) << 23);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 399 to 406
	value = ((uint32_t)(input[49] & 0x01) << 31) |
			((uint32_t)(input[50] & 0xfe) << 23);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 407 to 414
	value = ((uint32_t)(input[50] & 0x01) << 31) |
			((uint32_t)(input[51] & 0xfe) << 23);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 415 to 422
	value = ((uint32_t)(input[51] & 0x01) << 31) |
			((uint32_t)(input[52] & 0xfe) << 23);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 423 to 430
	value = ((uint32_t)(input[52] & 0x01) << 31) |
			((uint32_t)(input[53] & 0xfe) << 23);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 431 to 438
	value = ((uint32_t)(input[53] & 0x01) << 31) |
			((uint32_t)(input[54] & 0xfe) << 23);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 439 to 446
	value = ((uint32_t)(input[54] & 0x01) << 31) |
			((uint32_t)(input[55] & 0xfe) << 23);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 447 to 454
	value = ((uint32_t)(input[55] & 0x01) << 31) |
			((uint32_t)(input[56] & 0xfe) << 23);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 455 to 462
	value = ((uint32_t)(input[56] & 0x01) << 31) |
			((uint32_t)(input[57] & 0xfe) << 23);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 463 to 470
	value = ((uint32_t)(input[57] & 0x01) << 31) |
			((uint32_t)(input[58] & 0xfe) << 23);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 471 to 478
	value = ((uint32_t)(input[58] & 0x01) << 31) |
			((uint32_t)(input[59] & 0xfe) << 23);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 479 to 486
	value = ((uint32_t)(input[59] & 0x01) << 31) |
			((uint32_t)(input[60] & 0xfe) << 23);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 487 to 494
	value = ((uint32_t)(input[60] & 0x01) << 31) |
			((uint32_t)(input[61] & 0xfe) << 23);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 495 to 502
	value = ((uint32_t)(input[61] & 0x01) << 31) |
			((uint32_t)(input[62] & 0xfe) << 23);
	output[61] = (double)(value >> 24);

	// read output[62]: from bit 503 to 510
	value = ((uint32_t)(input[62] & 0x01) << 31) |
			((uint32_t)(input[63] & 0xfe) << 23);
	output[62] = (double)(value >> 24);

	// read output[63]: from bit 511 to 518
	value = ((uint32_t)(input[63] & 0x01) << 31) |
			((uint32_t)(input[64] & 0xfe) << 23);
	output[63] = (double)(value >> 24);
}

static void unpack_64_8bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 64 values into output
	// Values are 8-bit unsigned
	// Skip 7 bits, read 512 bits of data.
	// Input must be at least 65 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 14
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)(input[1] & 0xfe) << 23);
	output[0] = (double)(value >> 24);

	// read output[1]: from bit 15 to 22
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)(input[2] & 0xfe) << 23);
	output[1] = (double)(value >> 24);

	// read output[2]: from bit 23 to 30
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)(input[3] & 0xfe) << 23);
	output[2] = (double)(value >> 24);

	// read output[3]: from bit 31 to 38
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)(input[4] & 0xfe) << 23);
	output[3] = (double)(value >> 24);

	// read output[4]: from bit 39 to 46
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)(input[5] & 0xfe) << 23);
	output[4] = (double)(value >> 24);

	// read output[5]: from bit 47 to 54
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)(input[6] & 0xfe) << 23);
	output[5] = (double)(value >> 24);

	// read output[6]: from bit 55 to 62
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)(input[7] & 0xfe) << 23);
	output[6] = (double)(value >> 24);

	// read output[7]: from bit 63 to 70
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)(input[8] & 0xfe) << 23);
	output[7] = (double)(value >> 24);

	// read output[8]: from bit 71 to 78
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)(input[9] & 0xfe) << 23);
	output[8] = (double)(value >> 24);

	// read output[9]: from bit 79 to 86
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)(input[10] & 0xfe) << 23);
	output[9] = (double)(value >> 24);

	// read output[10]: from bit 87 to 94
	value = ((uint32_t)(input[10] & 0x01) << 31) |
			((uint32_t)(input[11] & 0xfe) << 23);
	output[10] = (double)(value >> 24);

	// read output[11]: from bit 95 to 102
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)(input[12] & 0xfe) << 23);
	output[11] = (double)(value >> 24);

	// read output[12]: from bit 103 to 110
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)(input[13] & 0xfe) << 23);
	output[12] = (double)(value >> 24);

	// read output[13]: from bit 111 to 118
	value = ((uint32_t)(input[13] & 0x01) << 31) |
			((uint32_t)(input[14] & 0xfe) << 23);
	output[13] = (double)(value >> 24);

	// read output[14]: from bit 119 to 126
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)(input[15] & 0xfe) << 23);
	output[14] = (double)(value >> 24);

	// read output[15]: from bit 127 to 134
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)(input[16] & 0xfe) << 23);
	output[15] = (double)(value >> 24);

	// read output[16]: from bit 135 to 142
	value = ((uint32_t)(input[16] & 0x01) << 31) |
			((uint32_t)(input[17] & 0xfe) << 23);
	output[16] = (double)(value >> 24);

	// read output[17]: from bit 143 to 150
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)(input[18] & 0xfe) << 23);
	output[17] = (double)(value >> 24);

	// read output[18]: from bit 151 to 158
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)(input[19] & 0xfe) << 23);
	output[18] = (double)(value >> 24);

	// read output[19]: from bit 159 to 166
	value = ((uint32_t)(input[19] & 0x01) << 31) |
			((uint32_t)(input[20] & 0xfe) << 23);
	output[19] = (double)(value >> 24);

	// read output[20]: from bit 167 to 174
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)(input[21] & 0xfe) << 23);
	output[20] = (double)(value >> 24);

	// read output[21]: from bit 175 to 182
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)(input[22] & 0xfe) << 23);
	output[21] = (double)(value >> 24);

	// read output[22]: from bit 183 to 190
	value = ((uint32_t)(input[22] & 0x01) << 31) |
			((uint32_t)(input[23] & 0xfe) << 23);
	output[22] = (double)(value >> 24);

	// read output[23]: from bit 191 to 198
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)(input[24] & 0xfe) << 23);
	output[23] = (double)(value >> 24);

	// read output[24]: from bit 199 to 206
	value = ((uint32_t)(input[24] & 0x01) << 31) |
			((uint32_t)(input[25] & 0xfe) << 23);
	output[24] = (double)(value >> 24);

	// read output[25]: from bit 207 to 214
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)(input[26] & 0xfe) << 23);
	output[25] = (double)(value >> 24);

	// read output[26]: from bit 215 to 222
	value = ((uint32_t)(input[26] & 0x01) << 31) |
			((uint32_t)(input[27] & 0xfe) << 23);
	output[26] = (double)(value >> 24);

	// read output[27]: from bit 223 to 230
	value = ((uint32_t)(input[27] & 0x01) << 31) |
			((uint32_t)(input[28] & 0xfe) << 23);
	output[27] = (double)(value >> 24);

	// read output[28]: from bit 231 to 238
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)(input[29] & 0xfe) << 23);
	output[28] = (double)(value >> 24);

	// read output[29]: from bit 239 to 246
	value = ((uint32_t)(input[29] & 0x01) << 31) |
			((uint32_t)(input[30] & 0xfe) << 23);
	output[29] = (double)(value >> 24);

	// read output[30]: from bit 247 to 254
	value = ((uint32_t)(input[30] & 0x01) << 31) |
			((uint32_t)(input[31] & 0xfe) << 23);
	output[30] = (double)(value >> 24);

	// read output[31]: from bit 255 to 262
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)(input[32] & 0xfe) << 23);
	output[31] = (double)(value >> 24);

	// read output[32]: from bit 263 to 270
	value = ((uint32_t)(input[32] & 0x01) << 31) |
			((uint32_t)(input[33] & 0xfe) << 23);
	output[32] = (double)(value >> 24);

	// read output[33]: from bit 271 to 278
	value = ((uint32_t)(input[33] & 0x01) << 31) |
			((uint32_t)(input[34] & 0xfe) << 23);
	output[33] = (double)(value >> 24);

	// read output[34]: from bit 279 to 286
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)(input[35] & 0xfe) << 23);
	output[34] = (double)(value >> 24);

	// read output[35]: from bit 287 to 294
	value = ((uint32_t)(input[35] & 0x01) << 31) |
			((uint32_t)(input[36] & 0xfe) << 23);
	output[35] = (double)(value >> 24);

	// read output[36]: from bit 295 to 302
	value = ((uint32_t)(input[36] & 0x01) << 31) |
			((uint32_t)(input[37] & 0xfe) << 23);
	output[36] = (double)(value >> 24);

	// read output[37]: from bit 303 to 310
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)(input[38] & 0xfe) << 23);
	output[37] = (double)(value >> 24);

	// read output[38]: from bit 311 to 318
	value = ((uint32_t)(input[38] & 0x01) << 31) |
			((uint32_t)(input[39] & 0xfe) << 23);
	output[38] = (double)(value >> 24);

	// read output[39]: from bit 319 to 326
	value = ((uint32_t)(input[39] & 0x01) << 31) |
			((uint32_t)(input[40] & 0xfe) << 23);
	output[39] = (double)(value >> 24);

	// read output[40]: from bit 327 to 334
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)(input[41] & 0xfe) << 23);
	output[40] = (double)(value >> 24);

	// read output[41]: from bit 335 to 342
	value = ((uint32_t)(input[41] & 0x01) << 31) |
			((uint32_t)(input[42] & 0xfe) << 23);
	output[41] = (double)(value >> 24);

	// read output[42]: from bit 343 to 350
	value = ((uint32_t)(input[42] & 0x01) << 31) |
			((uint32_t)(input[43] & 0xfe) << 23);
	output[42] = (double)(value >> 24);

	// read output[43]: from bit 351 to 358
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)(input[44] & 0xfe) << 23);
	output[43] = (double)(value >> 24);

	// read output[44]: from bit 359 to 366
	value = ((uint32_t)(input[44] & 0x01) << 31) |
			((uint32_t)(input[45] & 0xfe) << 23);
	output[44] = (double)(value >> 24);

	// read output[45]: from bit 367 to 374
	value = ((uint32_t)(input[45] & 0x01) << 31) |
			((uint32_t)(input[46] & 0xfe) << 23);
	output[45] = (double)(value >> 24);

	// read output[46]: from bit 375 to 382
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)(input[47] & 0xfe) << 23);
	output[46] = (double)(value >> 24);

	// read output[47]: from bit 383 to 390
	value = ((uint32_t)(input[47] & 0x01) << 31) |
			((uint32_t)(input[48] & 0xfe) << 23);
	output[47] = (double)(value >> 24);

	// read output[48]: from bit 391 to 398
	value = ((uint32_t)(input[48] & 0x01) << 31) |
			((uint32_t)(input[49] & 0xfe) << 23);
	output[48] = (double)(value >> 24);

	// read output[49]: from bit 399 to 406
	value = ((uint32_t)(input[49] & 0x01) << 31) |
			((uint32_t)(input[50] & 0xfe) << 23);
	output[49] = (double)(value >> 24);

	// read output[50]: from bit 407 to 414
	value = ((uint32_t)(input[50] & 0x01) << 31) |
			((uint32_t)(input[51] & 0xfe) << 23);
	output[50] = (double)(value >> 24);

	// read output[51]: from bit 415 to 422
	value = ((uint32_t)(input[51] & 0x01) << 31) |
			((uint32_t)(input[52] & 0xfe) << 23);
	output[51] = (double)(value >> 24);

	// read output[52]: from bit 423 to 430
	value = ((uint32_t)(input[52] & 0x01) << 31) |
			((uint32_t)(input[53] & 0xfe) << 23);
	output[52] = (double)(value >> 24);

	// read output[53]: from bit 431 to 438
	value = ((uint32_t)(input[53] & 0x01) << 31) |
			((uint32_t)(input[54] & 0xfe) << 23);
	output[53] = (double)(value >> 24);

	// read output[54]: from bit 439 to 446
	value = ((uint32_t)(input[54] & 0x01) << 31) |
			((uint32_t)(input[55] & 0xfe) << 23);
	output[54] = (double)(value >> 24);

	// read output[55]: from bit 447 to 454
	value = ((uint32_t)(input[55] & 0x01) << 31) |
			((uint32_t)(input[56] & 0xfe) << 23);
	output[55] = (double)(value >> 24);

	// read output[56]: from bit 455 to 462
	value = ((uint32_t)(input[56] & 0x01) << 31) |
			((uint32_t)(input[57] & 0xfe) << 23);
	output[56] = (double)(value >> 24);

	// read output[57]: from bit 463 to 470
	value = ((uint32_t)(input[57] & 0x01) << 31) |
			((uint32_t)(input[58] & 0xfe) << 23);
	output[57] = (double)(value >> 24);

	// read output[58]: from bit 471 to 478
	value = ((uint32_t)(input[58] & 0x01) << 31) |
			((uint32_t)(input[59] & 0xfe) << 23);
	output[58] = (double)(value >> 24);

	// read output[59]: from bit 479 to 486
	value = ((uint32_t)(input[59] & 0x01) << 31) |
			((uint32_t)(input[60] & 0xfe) << 23);
	output[59] = (double)(value >> 24);

	// read output[60]: from bit 487 to 494
	value = ((uint32_t)(input[60] & 0x01) << 31) |
			((uint32_t)(input[61] & 0xfe) << 23);
	output[60] = (double)(value >> 24);

	// read output[61]: from bit 495 to 502
	value = ((uint32_t)(input[61] & 0x01) << 31) |
			((uint32_t)(input[62] & 0xfe) << 23);
	output[61] = (double)(value >> 24);

	// read output[62]: from bit 503 to 510
	value = ((uint32_t)(input[62] & 0x01) << 31) |
			((uint32_t)(input[63] & 0xfe) << 23);
	output[62] = (double)(value >> 24);

	// read output[63]: from bit 511 to 518
	value = ((uint32_t)(input[63] & 0x01) << 31) |
			((uint32_t)(input[64] & 0xfe) << 23);
	output[63] = (double)(value >> 24);
}


unpack_func_t unpack_8bit[UNPACK_8BIT_MAX_COUNT][8][2] = {
	{
		{
			unpack_1_8bit_unsigned_0off,
			unpack_1_8bit_signed_0off,
		},
		{
			unpack_1_8bit_unsigned_1off,
			unpack_1_8bit_signed_1off,
		},
		{
			unpack_1_8bit_unsigned_2off,
			unpack_1_8bit_signed_2off,
		},
		{
			unpack_1_8bit_unsigned_3off,
			unpack_1_8bit_signed_3off,
		},
		{
			unpack_1_8bit_unsigned_4off,
			unpack_1_8bit_signed_4off,
		},
		{
			unpack_1_8bit_unsigned_5off,
			unpack_1_8bit_signed_5off,
		},
		{
			unpack_1_8bit_unsigned_6off,
			unpack_1_8bit_signed_6off,
		},
		{
			unpack_1_8bit_unsigned_7off,
			unpack_1_8bit_signed_7off,
		},
	},
	{
		{
			unpack_2_8bit_unsigned_0off,
			unpack_2_8bit_signed_0off,
		},
		{
			unpack_2_8bit_unsigned_1off,
			unpack_2_8bit_signed_1off,
		},
		{
			unpack_2_8bit_unsigned_2off,
			unpack_2_8bit_signed_2off,
		},
		{
			unpack_2_8bit_unsigned_3off,
			unpack_2_8bit_signed_3off,
		},
		{
			unpack_2_8bit_unsigned_4off,
			unpack_2_8bit_signed_4off,
		},
		{
			unpack_2_8bit_unsigned_5off,
			unpack_2_8bit_signed_5off,
		},
		{
			unpack_2_8bit_unsigned_6off,
			unpack_2_8bit_signed_6off,
		},
		{
			unpack_2_8bit_unsigned_7off,
			unpack_2_8bit_signed_7off,
		},
	},
	{
		{
			unpack_3_8bit_unsigned_0off,
			unpack_3_8bit_signed_0off,
		},
		{
			unpack_3_8bit_unsigned_1off,
			unpack_3_8bit_signed_1off,
		},
		{
			unpack_3_8bit_unsigned_2off,
			unpack_3_8bit_signed_2off,
		},
		{
			unpack_3_8bit_unsigned_3off,
			unpack_3_8bit_signed_3off,
		},
		{
			unpack_3_8bit_unsigned_4off,
			unpack_3_8bit_signed_4off,
		},
		{
			unpack_3_8bit_unsigned_5off,
			unpack_3_8bit_signed_5off,
		},
		{
			unpack_3_8bit_unsigned_6off,
			unpack_3_8bit_signed_6off,
		},
		{
			unpack_3_8bit_unsigned_7off,
			unpack_3_8bit_signed_7off,
		},
	},
	{
		{
			unpack_4_8bit_unsigned_0off,
			unpack_4_8bit_signed_0off,
		},
		{
			unpack_4_8bit_unsigned_1off,
			unpack_4_8bit_signed_1off,
		},
		{
			unpack_4_8bit_unsigned_2off,
			unpack_4_8bit_signed_2off,
		},
		{
			unpack_4_8bit_unsigned_3off,
			unpack_4_8bit_signed_3off,
		},
		{
			unpack_4_8bit_unsigned_4off,
			unpack_4_8bit_signed_4off,
		},
		{
			unpack_4_8bit_unsigned_5off,
			unpack_4_8bit_signed_5off,
		},
		{
			unpack_4_8bit_unsigned_6off,
			unpack_4_8bit_signed_6off,
		},
		{
			unpack_4_8bit_unsigned_7off,
			unpack_4_8bit_signed_7off,
		},
	},
	{
		{
			unpack_5_8bit_unsigned_0off,
			unpack_5_8bit_signed_0off,
		},
		{
			unpack_5_8bit_unsigned_1off,
			unpack_5_8bit_signed_1off,
		},
		{
			unpack_5_8bit_unsigned_2off,
			unpack_5_8bit_signed_2off,
		},
		{
			unpack_5_8bit_unsigned_3off,
			unpack_5_8bit_signed_3off,
		},
		{
			unpack_5_8bit_unsigned_4off,
			unpack_5_8bit_signed_4off,
		},
		{
			unpack_5_8bit_unsigned_5off,
			unpack_5_8bit_signed_5off,
		},
		{
			unpack_5_8bit_unsigned_6off,
			unpack_5_8bit_signed_6off,
		},
		{
			unpack_5_8bit_unsigned_7off,
			unpack_5_8bit_signed_7off,
		},
	},
	{
		{
			unpack_6_8bit_unsigned_0off,
			unpack_6_8bit_signed_0off,
		},
		{
			unpack_6_8bit_unsigned_1off,
			unpack_6_8bit_signed_1off,
		},
		{
			unpack_6_8bit_unsigned_2off,
			unpack_6_8bit_signed_2off,
		},
		{
			unpack_6_8bit_unsigned_3off,
			unpack_6_8bit_signed_3off,
		},
		{
			unpack_6_8bit_unsigned_4off,
			unpack_6_8bit_signed_4off,
		},
		{
			unpack_6_8bit_unsigned_5off,
			unpack_6_8bit_signed_5off,
		},
		{
			unpack_6_8bit_unsigned_6off,
			unpack_6_8bit_signed_6off,
		},
		{
			unpack_6_8bit_unsigned_7off,
			unpack_6_8bit_signed_7off,
		},
	},
	{
		{
			unpack_7_8bit_unsigned_0off,
			unpack_7_8bit_signed_0off,
		},
		{
			unpack_7_8bit_unsigned_1off,
			unpack_7_8bit_signed_1off,
		},
		{
			unpack_7_8bit_unsigned_2off,
			unpack_7_8bit_signed_2off,
		},
		{
			unpack_7_8bit_unsigned_3off,
			unpack_7_8bit_signed_3off,
		},
		{
			unpack_7_8bit_unsigned_4off,
			unpack_7_8bit_signed_4off,
		},
		{
			unpack_7_8bit_unsigned_5off,
			unpack_7_8bit_signed_5off,
		},
		{
			unpack_7_8bit_unsigned_6off,
			unpack_7_8bit_signed_6off,
		},
		{
			unpack_7_8bit_unsigned_7off,
			unpack_7_8bit_signed_7off,
		},
	},
	{
		{
			unpack_8_8bit_unsigned_0off,
			unpack_8_8bit_signed_0off,
		},
		{
			unpack_8_8bit_unsigned_1off,
			unpack_8_8bit_signed_1off,
		},
		{
			unpack_8_8bit_unsigned_2off,
			unpack_8_8bit_signed_2off,
		},
		{
			unpack_8_8bit_unsigned_3off,
			unpack_8_8bit_signed_3off,
		},
		{
			unpack_8_8bit_unsigned_4off,
			unpack_8_8bit_signed_4off,
		},
		{
			unpack_8_8bit_unsigned_5off,
			unpack_8_8bit_signed_5off,
		},
		{
			unpack_8_8bit_unsigned_6off,
			unpack_8_8bit_signed_6off,
		},
		{
			unpack_8_8bit_unsigned_7off,
			unpack_8_8bit_signed_7off,
		},
	},
	{
		{
			unpack_9_8bit_unsigned_0off,
			unpack_9_8bit_signed_0off,
		},
		{
			unpack_9_8bit_unsigned_1off,
			unpack_9_8bit_signed_1off,
		},
		{
			unpack_9_8bit_unsigned_2off,
			unpack_9_8bit_signed_2off,
		},
		{
			unpack_9_8bit_unsigned_3off,
			unpack_9_8bit_signed_3off,
		},
		{
			unpack_9_8bit_unsigned_4off,
			unpack_9_8bit_signed_4off,
		},
		{
			unpack_9_8bit_unsigned_5off,
			unpack_9_8bit_signed_5off,
		},
		{
			unpack_9_8bit_unsigned_6off,
			unpack_9_8bit_signed_6off,
		},
		{
			unpack_9_8bit_unsigned_7off,
			unpack_9_8bit_signed_7off,
		},
	},
	{
		{
			unpack_10_8bit_unsigned_0off,
			unpack_10_8bit_signed_0off,
		},
		{
			unpack_10_8bit_unsigned_1off,
			unpack_10_8bit_signed_1off,
		},
		{
			unpack_10_8bit_unsigned_2off,
			unpack_10_8bit_signed_2off,
		},
		{
			unpack_10_8bit_unsigned_3off,
			unpack_10_8bit_signed_3off,
		},
		{
			unpack_10_8bit_unsigned_4off,
			unpack_10_8bit_signed_4off,
		},
		{
			unpack_10_8bit_unsigned_5off,
			unpack_10_8bit_signed_5off,
		},
		{
			unpack_10_8bit_unsigned_6off,
			unpack_10_8bit_signed_6off,
		},
		{
			unpack_10_8bit_unsigned_7off,
			unpack_10_8bit_signed_7off,
		},
	},
	{
		{
			unpack_11_8bit_unsigned_0off,
			unpack_11_8bit_signed_0off,
		},
		{
			unpack_11_8bit_unsigned_1off,
			unpack_11_8bit_signed_1off,
		},
		{
			unpack_11_8bit_unsigned_2off,
			unpack_11_8bit_signed_2off,
		},
		{
			unpack_11_8bit_unsigned_3off,
			unpack_11_8bit_signed_3off,
		},
		{
			unpack_11_8bit_unsigned_4off,
			unpack_11_8bit_signed_4off,
		},
		{
			unpack_11_8bit_unsigned_5off,
			unpack_11_8bit_signed_5off,
		},
		{
			unpack_11_8bit_unsigned_6off,
			unpack_11_8bit_signed_6off,
		},
		{
			unpack_11_8bit_unsigned_7off,
			unpack_11_8bit_signed_7off,
		},
	},
	{
		{
			unpack_12_8bit_unsigned_0off,
			unpack_12_8bit_signed_0off,
		},
		{
			unpack_12_8bit_unsigned_1off,
			unpack_12_8bit_signed_1off,
		},
		{
			unpack_12_8bit_unsigned_2off,
			unpack_12_8bit_signed_2off,
		},
		{
			unpack_12_8bit_unsigned_3off,
			unpack_12_8bit_signed_3off,
		},
		{
			unpack_12_8bit_unsigned_4off,
			unpack_12_8bit_signed_4off,
		},
		{
			unpack_12_8bit_unsigned_5off,
			unpack_12_8bit_signed_5off,
		},
		{
			unpack_12_8bit_unsigned_6off,
			unpack_12_8bit_signed_6off,
		},
		{
			unpack_12_8bit_unsigned_7off,
			unpack_12_8bit_signed_7off,
		},
	},
	{
		{
			unpack_13_8bit_unsigned_0off,
			unpack_13_8bit_signed_0off,
		},
		{
			unpack_13_8bit_unsigned_1off,
			unpack_13_8bit_signed_1off,
		},
		{
			unpack_13_8bit_unsigned_2off,
			unpack_13_8bit_signed_2off,
		},
		{
			unpack_13_8bit_unsigned_3off,
			unpack_13_8bit_signed_3off,
		},
		{
			unpack_13_8bit_unsigned_4off,
			unpack_13_8bit_signed_4off,
		},
		{
			unpack_13_8bit_unsigned_5off,
			unpack_13_8bit_signed_5off,
		},
		{
			unpack_13_8bit_unsigned_6off,
			unpack_13_8bit_signed_6off,
		},
		{
			unpack_13_8bit_unsigned_7off,
			unpack_13_8bit_signed_7off,
		},
	},
	{
		{
			unpack_14_8bit_unsigned_0off,
			unpack_14_8bit_signed_0off,
		},
		{
			unpack_14_8bit_unsigned_1off,
			unpack_14_8bit_signed_1off,
		},
		{
			unpack_14_8bit_unsigned_2off,
			unpack_14_8bit_signed_2off,
		},
		{
			unpack_14_8bit_unsigned_3off,
			unpack_14_8bit_signed_3off,
		},
		{
			unpack_14_8bit_unsigned_4off,
			unpack_14_8bit_signed_4off,
		},
		{
			unpack_14_8bit_unsigned_5off,
			unpack_14_8bit_signed_5off,
		},
		{
			unpack_14_8bit_unsigned_6off,
			unpack_14_8bit_signed_6off,
		},
		{
			unpack_14_8bit_unsigned_7off,
			unpack_14_8bit_signed_7off,
		},
	},
	{
		{
			unpack_15_8bit_unsigned_0off,
			unpack_15_8bit_signed_0off,
		},
		{
			unpack_15_8bit_unsigned_1off,
			unpack_15_8bit_signed_1off,
		},
		{
			unpack_15_8bit_unsigned_2off,
			unpack_15_8bit_signed_2off,
		},
		{
			unpack_15_8bit_unsigned_3off,
			unpack_15_8bit_signed_3off,
		},
		{
			unpack_15_8bit_unsigned_4off,
			unpack_15_8bit_signed_4off,
		},
		{
			unpack_15_8bit_unsigned_5off,
			unpack_15_8bit_signed_5off,
		},
		{
			unpack_15_8bit_unsigned_6off,
			unpack_15_8bit_signed_6off,
		},
		{
			unpack_15_8bit_unsigned_7off,
			unpack_15_8bit_signed_7off,
		},
	},
	{
		{
			unpack_16_8bit_unsigned_0off,
			unpack_16_8bit_signed_0off,
		},
		{
			unpack_16_8bit_unsigned_1off,
			unpack_16_8bit_signed_1off,
		},
		{
			unpack_16_8bit_unsigned_2off,
			unpack_16_8bit_signed_2off,
		},
		{
			unpack_16_8bit_unsigned_3off,
			unpack_16_8bit_signed_3off,
		},
		{
			unpack_16_8bit_unsigned_4off,
			unpack_16_8bit_signed_4off,
		},
		{
			unpack_16_8bit_unsigned_5off,
			unpack_16_8bit_signed_5off,
		},
		{
			unpack_16_8bit_unsigned_6off,
			unpack_16_8bit_signed_6off,
		},
		{
			unpack_16_8bit_unsigned_7off,
			unpack_16_8bit_signed_7off,
		},
	},
	{
		{
			unpack_17_8bit_unsigned_0off,
			unpack_17_8bit_signed_0off,
		},
		{
			unpack_17_8bit_unsigned_1off,
			unpack_17_8bit_signed_1off,
		},
		{
			unpack_17_8bit_unsigned_2off,
			unpack_17_8bit_signed_2off,
		},
		{
			unpack_17_8bit_unsigned_3off,
			unpack_17_8bit_signed_3off,
		},
		{
			unpack_17_8bit_unsigned_4off,
			unpack_17_8bit_signed_4off,
		},
		{
			unpack_17_8bit_unsigned_5off,
			unpack_17_8bit_signed_5off,
		},
		{
			unpack_17_8bit_unsigned_6off,
			unpack_17_8bit_signed_6off,
		},
		{
			unpack_17_8bit_unsigned_7off,
			unpack_17_8bit_signed_7off,
		},
	},
	{
		{
			unpack_18_8bit_unsigned_0off,
			unpack_18_8bit_signed_0off,
		},
		{
			unpack_18_8bit_unsigned_1off,
			unpack_18_8bit_signed_1off,
		},
		{
			unpack_18_8bit_unsigned_2off,
			unpack_18_8bit_signed_2off,
		},
		{
			unpack_18_8bit_unsigned_3off,
			unpack_18_8bit_signed_3off,
		},
		{
			unpack_18_8bit_unsigned_4off,
			unpack_18_8bit_signed_4off,
		},
		{
			unpack_18_8bit_unsigned_5off,
			unpack_18_8bit_signed_5off,
		},
		{
			unpack_18_8bit_unsigned_6off,
			unpack_18_8bit_signed_6off,
		},
		{
			unpack_18_8bit_unsigned_7off,
			unpack_18_8bit_signed_7off,
		},
	},
	{
		{
			unpack_19_8bit_unsigned_0off,
			unpack_19_8bit_signed_0off,
		},
		{
			unpack_19_8bit_unsigned_1off,
			unpack_19_8bit_signed_1off,
		},
		{
			unpack_19_8bit_unsigned_2off,
			unpack_19_8bit_signed_2off,
		},
		{
			unpack_19_8bit_unsigned_3off,
			unpack_19_8bit_signed_3off,
		},
		{
			unpack_19_8bit_unsigned_4off,
			unpack_19_8bit_signed_4off,
		},
		{
			unpack_19_8bit_unsigned_5off,
			unpack_19_8bit_signed_5off,
		},
		{
			unpack_19_8bit_unsigned_6off,
			unpack_19_8bit_signed_6off,
		},
		{
			unpack_19_8bit_unsigned_7off,
			unpack_19_8bit_signed_7off,
		},
	},
	{
		{
			unpack_20_8bit_unsigned_0off,
			unpack_20_8bit_signed_0off,
		},
		{
			unpack_20_8bit_unsigned_1off,
			unpack_20_8bit_signed_1off,
		},
		{
			unpack_20_8bit_unsigned_2off,
			unpack_20_8bit_signed_2off,
		},
		{
			unpack_20_8bit_unsigned_3off,
			unpack_20_8bit_signed_3off,
		},
		{
			unpack_20_8bit_unsigned_4off,
			unpack_20_8bit_signed_4off,
		},
		{
			unpack_20_8bit_unsigned_5off,
			unpack_20_8bit_signed_5off,
		},
		{
			unpack_20_8bit_unsigned_6off,
			unpack_20_8bit_signed_6off,
		},
		{
			unpack_20_8bit_unsigned_7off,
			unpack_20_8bit_signed_7off,
		},
	},
	{
		{
			unpack_21_8bit_unsigned_0off,
			unpack_21_8bit_signed_0off,
		},
		{
			unpack_21_8bit_unsigned_1off,
			unpack_21_8bit_signed_1off,
		},
		{
			unpack_21_8bit_unsigned_2off,
			unpack_21_8bit_signed_2off,
		},
		{
			unpack_21_8bit_unsigned_3off,
			unpack_21_8bit_signed_3off,
		},
		{
			unpack_21_8bit_unsigned_4off,
			unpack_21_8bit_signed_4off,
		},
		{
			unpack_21_8bit_unsigned_5off,
			unpack_21_8bit_signed_5off,
		},
		{
			unpack_21_8bit_unsigned_6off,
			unpack_21_8bit_signed_6off,
		},
		{
			unpack_21_8bit_unsigned_7off,
			unpack_21_8bit_signed_7off,
		},
	},
	{
		{
			unpack_22_8bit_unsigned_0off,
			unpack_22_8bit_signed_0off,
		},
		{
			unpack_22_8bit_unsigned_1off,
			unpack_22_8bit_signed_1off,
		},
		{
			unpack_22_8bit_unsigned_2off,
			unpack_22_8bit_signed_2off,
		},
		{
			unpack_22_8bit_unsigned_3off,
			unpack_22_8bit_signed_3off,
		},
		{
			unpack_22_8bit_unsigned_4off,
			unpack_22_8bit_signed_4off,
		},
		{
			unpack_22_8bit_unsigned_5off,
			unpack_22_8bit_signed_5off,
		},
		{
			unpack_22_8bit_unsigned_6off,
			unpack_22_8bit_signed_6off,
		},
		{
			unpack_22_8bit_unsigned_7off,
			unpack_22_8bit_signed_7off,
		},
	},
	{
		{
			unpack_23_8bit_unsigned_0off,
			unpack_23_8bit_signed_0off,
		},
		{
			unpack_23_8bit_unsigned_1off,
			unpack_23_8bit_signed_1off,
		},
		{
			unpack_23_8bit_unsigned_2off,
			unpack_23_8bit_signed_2off,
		},
		{
			unpack_23_8bit_unsigned_3off,
			unpack_23_8bit_signed_3off,
		},
		{
			unpack_23_8bit_unsigned_4off,
			unpack_23_8bit_signed_4off,
		},
		{
			unpack_23_8bit_unsigned_5off,
			unpack_23_8bit_signed_5off,
		},
		{
			unpack_23_8bit_unsigned_6off,
			unpack_23_8bit_signed_6off,
		},
		{
			unpack_23_8bit_unsigned_7off,
			unpack_23_8bit_signed_7off,
		},
	},
	{
		{
			unpack_24_8bit_unsigned_0off,
			unpack_24_8bit_signed_0off,
		},
		{
			unpack_24_8bit_unsigned_1off,
			unpack_24_8bit_signed_1off,
		},
		{
			unpack_24_8bit_unsigned_2off,
			unpack_24_8bit_signed_2off,
		},
		{
			unpack_24_8bit_unsigned_3off,
			unpack_24_8bit_signed_3off,
		},
		{
			unpack_24_8bit_unsigned_4off,
			unpack_24_8bit_signed_4off,
		},
		{
			unpack_24_8bit_unsigned_5off,
			unpack_24_8bit_signed_5off,
		},
		{
			unpack_24_8bit_unsigned_6off,
			unpack_24_8bit_signed_6off,
		},
		{
			unpack_24_8bit_unsigned_7off,
			unpack_24_8bit_signed_7off,
		},
	},
	{
		{
			unpack_25_8bit_unsigned_0off,
			unpack_25_8bit_signed_0off,
		},
		{
			unpack_25_8bit_unsigned_1off,
			unpack_25_8bit_signed_1off,
		},
		{
			unpack_25_8bit_unsigned_2off,
			unpack_25_8bit_signed_2off,
		},
		{
			unpack_25_8bit_unsigned_3off,
			unpack_25_8bit_signed_3off,
		},
		{
			unpack_25_8bit_unsigned_4off,
			unpack_25_8bit_signed_4off,
		},
		{
			unpack_25_8bit_unsigned_5off,
			unpack_25_8bit_signed_5off,
		},
		{
			unpack_25_8bit_unsigned_6off,
			unpack_25_8bit_signed_6off,
		},
		{
			unpack_25_8bit_unsigned_7off,
			unpack_25_8bit_signed_7off,
		},
	},
	{
		{
			unpack_26_8bit_unsigned_0off,
			unpack_26_8bit_signed_0off,
		},
		{
			unpack_26_8bit_unsigned_1off,
			unpack_26_8bit_signed_1off,
		},
		{
			unpack_26_8bit_unsigned_2off,
			unpack_26_8bit_signed_2off,
		},
		{
			unpack_26_8bit_unsigned_3off,
			unpack_26_8bit_signed_3off,
		},
		{
			unpack_26_8bit_unsigned_4off,
			unpack_26_8bit_signed_4off,
		},
		{
			unpack_26_8bit_unsigned_5off,
			unpack_26_8bit_signed_5off,
		},
		{
			unpack_26_8bit_unsigned_6off,
			unpack_26_8bit_signed_6off,
		},
		{
			unpack_26_8bit_unsigned_7off,
			unpack_26_8bit_signed_7off,
		},
	},
	{
		{
			unpack_27_8bit_unsigned_0off,
			unpack_27_8bit_signed_0off,
		},
		{
			unpack_27_8bit_unsigned_1off,
			unpack_27_8bit_signed_1off,
		},
		{
			unpack_27_8bit_unsigned_2off,
			unpack_27_8bit_signed_2off,
		},
		{
			unpack_27_8bit_unsigned_3off,
			unpack_27_8bit_signed_3off,
		},
		{
			unpack_27_8bit_unsigned_4off,
			unpack_27_8bit_signed_4off,
		},
		{
			unpack_27_8bit_unsigned_5off,
			unpack_27_8bit_signed_5off,
		},
		{
			unpack_27_8bit_unsigned_6off,
			unpack_27_8bit_signed_6off,
		},
		{
			unpack_27_8bit_unsigned_7off,
			unpack_27_8bit_signed_7off,
		},
	},
	{
		{
			unpack_28_8bit_unsigned_0off,
			unpack_28_8bit_signed_0off,
		},
		{
			unpack_28_8bit_unsigned_1off,
			unpack_28_8bit_signed_1off,
		},
		{
			unpack_28_8bit_unsigned_2off,
			unpack_28_8bit_signed_2off,
		},
		{
			unpack_28_8bit_unsigned_3off,
			unpack_28_8bit_signed_3off,
		},
		{
			unpack_28_8bit_unsigned_4off,
			unpack_28_8bit_signed_4off,
		},
		{
			unpack_28_8bit_unsigned_5off,
			unpack_28_8bit_signed_5off,
		},
		{
			unpack_28_8bit_unsigned_6off,
			unpack_28_8bit_signed_6off,
		},
		{
			unpack_28_8bit_unsigned_7off,
			unpack_28_8bit_signed_7off,
		},
	},
	{
		{
			unpack_29_8bit_unsigned_0off,
			unpack_29_8bit_signed_0off,
		},
		{
			unpack_29_8bit_unsigned_1off,
			unpack_29_8bit_signed_1off,
		},
		{
			unpack_29_8bit_unsigned_2off,
			unpack_29_8bit_signed_2off,
		},
		{
			unpack_29_8bit_unsigned_3off,
			unpack_29_8bit_signed_3off,
		},
		{
			unpack_29_8bit_unsigned_4off,
			unpack_29_8bit_signed_4off,
		},
		{
			unpack_29_8bit_unsigned_5off,
			unpack_29_8bit_signed_5off,
		},
		{
			unpack_29_8bit_unsigned_6off,
			unpack_29_8bit_signed_6off,
		},
		{
			unpack_29_8bit_unsigned_7off,
			unpack_29_8bit_signed_7off,
		},
	},
	{
		{
			unpack_30_8bit_unsigned_0off,
			unpack_30_8bit_signed_0off,
		},
		{
			unpack_30_8bit_unsigned_1off,
			unpack_30_8bit_signed_1off,
		},
		{
			unpack_30_8bit_unsigned_2off,
			unpack_30_8bit_signed_2off,
		},
		{
			unpack_30_8bit_unsigned_3off,
			unpack_30_8bit_signed_3off,
		},
		{
			unpack_30_8bit_unsigned_4off,
			unpack_30_8bit_signed_4off,
		},
		{
			unpack_30_8bit_unsigned_5off,
			unpack_30_8bit_signed_5off,
		},
		{
			unpack_30_8bit_unsigned_6off,
			unpack_30_8bit_signed_6off,
		},
		{
			unpack_30_8bit_unsigned_7off,
			unpack_30_8bit_signed_7off,
		},
	},
	{
		{
			unpack_31_8bit_unsigned_0off,
			unpack_31_8bit_signed_0off,
		},
		{
			unpack_31_8bit_unsigned_1off,
			unpack_31_8bit_signed_1off,
		},
		{
			unpack_31_8bit_unsigned_2off,
			unpack_31_8bit_signed_2off,
		},
		{
			unpack_31_8bit_unsigned_3off,
			unpack_31_8bit_signed_3off,
		},
		{
			unpack_31_8bit_unsigned_4off,
			unpack_31_8bit_signed_4off,
		},
		{
			unpack_31_8bit_unsigned_5off,
			unpack_31_8bit_signed_5off,
		},
		{
			unpack_31_8bit_unsigned_6off,
			unpack_31_8bit_signed_6off,
		},
		{
			unpack_31_8bit_unsigned_7off,
			unpack_31_8bit_signed_7off,
		},
	},
	{
		{
			unpack_32_8bit_unsigned_0off,
			unpack_32_8bit_signed_0off,
		},
		{
			unpack_32_8bit_unsigned_1off,
			unpack_32_8bit_signed_1off,
		},
		{
			unpack_32_8bit_unsigned_2off,
			unpack_32_8bit_signed_2off,
		},
		{
			unpack_32_8bit_unsigned_3off,
			unpack_32_8bit_signed_3off,
		},
		{
			unpack_32_8bit_unsigned_4off,
			unpack_32_8bit_signed_4off,
		},
		{
			unpack_32_8bit_unsigned_5off,
			unpack_32_8bit_signed_5off,
		},
		{
			unpack_32_8bit_unsigned_6off,
			unpack_32_8bit_signed_6off,
		},
		{
			unpack_32_8bit_unsigned_7off,
			unpack_32_8bit_signed_7off,
		},
	},
	{
		{
			unpack_33_8bit_unsigned_0off,
			unpack_33_8bit_signed_0off,
		},
		{
			unpack_33_8bit_unsigned_1off,
			unpack_33_8bit_signed_1off,
		},
		{
			unpack_33_8bit_unsigned_2off,
			unpack_33_8bit_signed_2off,
		},
		{
			unpack_33_8bit_unsigned_3off,
			unpack_33_8bit_signed_3off,
		},
		{
			unpack_33_8bit_unsigned_4off,
			unpack_33_8bit_signed_4off,
		},
		{
			unpack_33_8bit_unsigned_5off,
			unpack_33_8bit_signed_5off,
		},
		{
			unpack_33_8bit_unsigned_6off,
			unpack_33_8bit_signed_6off,
		},
		{
			unpack_33_8bit_unsigned_7off,
			unpack_33_8bit_signed_7off,
		},
	},
	{
		{
			unpack_34_8bit_unsigned_0off,
			unpack_34_8bit_signed_0off,
		},
		{
			unpack_34_8bit_unsigned_1off,
			unpack_34_8bit_signed_1off,
		},
		{
			unpack_34_8bit_unsigned_2off,
			unpack_34_8bit_signed_2off,
		},
		{
			unpack_34_8bit_unsigned_3off,
			unpack_34_8bit_signed_3off,
		},
		{
			unpack_34_8bit_unsigned_4off,
			unpack_34_8bit_signed_4off,
		},
		{
			unpack_34_8bit_unsigned_5off,
			unpack_34_8bit_signed_5off,
		},
		{
			unpack_34_8bit_unsigned_6off,
			unpack_34_8bit_signed_6off,
		},
		{
			unpack_34_8bit_unsigned_7off,
			unpack_34_8bit_signed_7off,
		},
	},
	{
		{
			unpack_35_8bit_unsigned_0off,
			unpack_35_8bit_signed_0off,
		},
		{
			unpack_35_8bit_unsigned_1off,
			unpack_35_8bit_signed_1off,
		},
		{
			unpack_35_8bit_unsigned_2off,
			unpack_35_8bit_signed_2off,
		},
		{
			unpack_35_8bit_unsigned_3off,
			unpack_35_8bit_signed_3off,
		},
		{
			unpack_35_8bit_unsigned_4off,
			unpack_35_8bit_signed_4off,
		},
		{
			unpack_35_8bit_unsigned_5off,
			unpack_35_8bit_signed_5off,
		},
		{
			unpack_35_8bit_unsigned_6off,
			unpack_35_8bit_signed_6off,
		},
		{
			unpack_35_8bit_unsigned_7off,
			unpack_35_8bit_signed_7off,
		},
	},
	{
		{
			unpack_36_8bit_unsigned_0off,
			unpack_36_8bit_signed_0off,
		},
		{
			unpack_36_8bit_unsigned_1off,
			unpack_36_8bit_signed_1off,
		},
		{
			unpack_36_8bit_unsigned_2off,
			unpack_36_8bit_signed_2off,
		},
		{
			unpack_36_8bit_unsigned_3off,
			unpack_36_8bit_signed_3off,
		},
		{
			unpack_36_8bit_unsigned_4off,
			unpack_36_8bit_signed_4off,
		},
		{
			unpack_36_8bit_unsigned_5off,
			unpack_36_8bit_signed_5off,
		},
		{
			unpack_36_8bit_unsigned_6off,
			unpack_36_8bit_signed_6off,
		},
		{
			unpack_36_8bit_unsigned_7off,
			unpack_36_8bit_signed_7off,
		},
	},
	{
		{
			unpack_37_8bit_unsigned_0off,
			unpack_37_8bit_signed_0off,
		},
		{
			unpack_37_8bit_unsigned_1off,
			unpack_37_8bit_signed_1off,
		},
		{
			unpack_37_8bit_unsigned_2off,
			unpack_37_8bit_signed_2off,
		},
		{
			unpack_37_8bit_unsigned_3off,
			unpack_37_8bit_signed_3off,
		},
		{
			unpack_37_8bit_unsigned_4off,
			unpack_37_8bit_signed_4off,
		},
		{
			unpack_37_8bit_unsigned_5off,
			unpack_37_8bit_signed_5off,
		},
		{
			unpack_37_8bit_unsigned_6off,
			unpack_37_8bit_signed_6off,
		},
		{
			unpack_37_8bit_unsigned_7off,
			unpack_37_8bit_signed_7off,
		},
	},
	{
		{
			unpack_38_8bit_unsigned_0off,
			unpack_38_8bit_signed_0off,
		},
		{
			unpack_38_8bit_unsigned_1off,
			unpack_38_8bit_signed_1off,
		},
		{
			unpack_38_8bit_unsigned_2off,
			unpack_38_8bit_signed_2off,
		},
		{
			unpack_38_8bit_unsigned_3off,
			unpack_38_8bit_signed_3off,
		},
		{
			unpack_38_8bit_unsigned_4off,
			unpack_38_8bit_signed_4off,
		},
		{
			unpack_38_8bit_unsigned_5off,
			unpack_38_8bit_signed_5off,
		},
		{
			unpack_38_8bit_unsigned_6off,
			unpack_38_8bit_signed_6off,
		},
		{
			unpack_38_8bit_unsigned_7off,
			unpack_38_8bit_signed_7off,
		},
	},
	{
		{
			unpack_39_8bit_unsigned_0off,
			unpack_39_8bit_signed_0off,
		},
		{
			unpack_39_8bit_unsigned_1off,
			unpack_39_8bit_signed_1off,
		},
		{
			unpack_39_8bit_unsigned_2off,
			unpack_39_8bit_signed_2off,
		},
		{
			unpack_39_8bit_unsigned_3off,
			unpack_39_8bit_signed_3off,
		},
		{
			unpack_39_8bit_unsigned_4off,
			unpack_39_8bit_signed_4off,
		},
		{
			unpack_39_8bit_unsigned_5off,
			unpack_39_8bit_signed_5off,
		},
		{
			unpack_39_8bit_unsigned_6off,
			unpack_39_8bit_signed_6off,
		},
		{
			unpack_39_8bit_unsigned_7off,
			unpack_39_8bit_signed_7off,
		},
	},
	{
		{
			unpack_40_8bit_unsigned_0off,
			unpack_40_8bit_signed_0off,
		},
		{
			unpack_40_8bit_unsigned_1off,
			unpack_40_8bit_signed_1off,
		},
		{
			unpack_40_8bit_unsigned_2off,
			unpack_40_8bit_signed_2off,
		},
		{
			unpack_40_8bit_unsigned_3off,
			unpack_40_8bit_signed_3off,
		},
		{
			unpack_40_8bit_unsigned_4off,
			unpack_40_8bit_signed_4off,
		},
		{
			unpack_40_8bit_unsigned_5off,
			unpack_40_8bit_signed_5off,
		},
		{
			unpack_40_8bit_unsigned_6off,
			unpack_40_8bit_signed_6off,
		},
		{
			unpack_40_8bit_unsigned_7off,
			unpack_40_8bit_signed_7off,
		},
	},
	{
		{
			unpack_41_8bit_unsigned_0off,
			unpack_41_8bit_signed_0off,
		},
		{
			unpack_41_8bit_unsigned_1off,
			unpack_41_8bit_signed_1off,
		},
		{
			unpack_41_8bit_unsigned_2off,
			unpack_41_8bit_signed_2off,
		},
		{
			unpack_41_8bit_unsigned_3off,
			unpack_41_8bit_signed_3off,
		},
		{
			unpack_41_8bit_unsigned_4off,
			unpack_41_8bit_signed_4off,
		},
		{
			unpack_41_8bit_unsigned_5off,
			unpack_41_8bit_signed_5off,
		},
		{
			unpack_41_8bit_unsigned_6off,
			unpack_41_8bit_signed_6off,
		},
		{
			unpack_41_8bit_unsigned_7off,
			unpack_41_8bit_signed_7off,
		},
	},
	{
		{
			unpack_42_8bit_unsigned_0off,
			unpack_42_8bit_signed_0off,
		},
		{
			unpack_42_8bit_unsigned_1off,
			unpack_42_8bit_signed_1off,
		},
		{
			unpack_42_8bit_unsigned_2off,
			unpack_42_8bit_signed_2off,
		},
		{
			unpack_42_8bit_unsigned_3off,
			unpack_42_8bit_signed_3off,
		},
		{
			unpack_42_8bit_unsigned_4off,
			unpack_42_8bit_signed_4off,
		},
		{
			unpack_42_8bit_unsigned_5off,
			unpack_42_8bit_signed_5off,
		},
		{
			unpack_42_8bit_unsigned_6off,
			unpack_42_8bit_signed_6off,
		},
		{
			unpack_42_8bit_unsigned_7off,
			unpack_42_8bit_signed_7off,
		},
	},
	{
		{
			unpack_43_8bit_unsigned_0off,
			unpack_43_8bit_signed_0off,
		},
		{
			unpack_43_8bit_unsigned_1off,
			unpack_43_8bit_signed_1off,
		},
		{
			unpack_43_8bit_unsigned_2off,
			unpack_43_8bit_signed_2off,
		},
		{
			unpack_43_8bit_unsigned_3off,
			unpack_43_8bit_signed_3off,
		},
		{
			unpack_43_8bit_unsigned_4off,
			unpack_43_8bit_signed_4off,
		},
		{
			unpack_43_8bit_unsigned_5off,
			unpack_43_8bit_signed_5off,
		},
		{
			unpack_43_8bit_unsigned_6off,
			unpack_43_8bit_signed_6off,
		},
		{
			unpack_43_8bit_unsigned_7off,
			unpack_43_8bit_signed_7off,
		},
	},
	{
		{
			unpack_44_8bit_unsigned_0off,
			unpack_44_8bit_signed_0off,
		},
		{
			unpack_44_8bit_unsigned_1off,
			unpack_44_8bit_signed_1off,
		},
		{
			unpack_44_8bit_unsigned_2off,
			unpack_44_8bit_signed_2off,
		},
		{
			unpack_44_8bit_unsigned_3off,
			unpack_44_8bit_signed_3off,
		},
		{
			unpack_44_8bit_unsigned_4off,
			unpack_44_8bit_signed_4off,
		},
		{
			unpack_44_8bit_unsigned_5off,
			unpack_44_8bit_signed_5off,
		},
		{
			unpack_44_8bit_unsigned_6off,
			unpack_44_8bit_signed_6off,
		},
		{
			unpack_44_8bit_unsigned_7off,
			unpack_44_8bit_signed_7off,
		},
	},
	{
		{
			unpack_45_8bit_unsigned_0off,
			unpack_45_8bit_signed_0off,
		},
		{
			unpack_45_8bit_unsigned_1off,
			unpack_45_8bit_signed_1off,
		},
		{
			unpack_45_8bit_unsigned_2off,
			unpack_45_8bit_signed_2off,
		},
		{
			unpack_45_8bit_unsigned_3off,
			unpack_45_8bit_signed_3off,
		},
		{
			unpack_45_8bit_unsigned_4off,
			unpack_45_8bit_signed_4off,
		},
		{
			unpack_45_8bit_unsigned_5off,
			unpack_45_8bit_signed_5off,
		},
		{
			unpack_45_8bit_unsigned_6off,
			unpack_45_8bit_signed_6off,
		},
		{
			unpack_45_8bit_unsigned_7off,
			unpack_45_8bit_signed_7off,
		},
	},
	{
		{
			unpack_46_8bit_unsigned_0off,
			unpack_46_8bit_signed_0off,
		},
		{
			unpack_46_8bit_unsigned_1off,
			unpack_46_8bit_signed_1off,
		},
		{
			unpack_46_8bit_unsigned_2off,
			unpack_46_8bit_signed_2off,
		},
		{
			unpack_46_8bit_unsigned_3off,
			unpack_46_8bit_signed_3off,
		},
		{
			unpack_46_8bit_unsigned_4off,
			unpack_46_8bit_signed_4off,
		},
		{
			unpack_46_8bit_unsigned_5off,
			unpack_46_8bit_signed_5off,
		},
		{
			unpack_46_8bit_unsigned_6off,
			unpack_46_8bit_signed_6off,
		},
		{
			unpack_46_8bit_unsigned_7off,
			unpack_46_8bit_signed_7off,
		},
	},
	{
		{
			unpack_47_8bit_unsigned_0off,
			unpack_47_8bit_signed_0off,
		},
		{
			unpack_47_8bit_unsigned_1off,
			unpack_47_8bit_signed_1off,
		},
		{
			unpack_47_8bit_unsigned_2off,
			unpack_47_8bit_signed_2off,
		},
		{
			unpack_47_8bit_unsigned_3off,
			unpack_47_8bit_signed_3off,
		},
		{
			unpack_47_8bit_unsigned_4off,
			unpack_47_8bit_signed_4off,
		},
		{
			unpack_47_8bit_unsigned_5off,
			unpack_47_8bit_signed_5off,
		},
		{
			unpack_47_8bit_unsigned_6off,
			unpack_47_8bit_signed_6off,
		},
		{
			unpack_47_8bit_unsigned_7off,
			unpack_47_8bit_signed_7off,
		},
	},
	{
		{
			unpack_48_8bit_unsigned_0off,
			unpack_48_8bit_signed_0off,
		},
		{
			unpack_48_8bit_unsigned_1off,
			unpack_48_8bit_signed_1off,
		},
		{
			unpack_48_8bit_unsigned_2off,
			unpack_48_8bit_signed_2off,
		},
		{
			unpack_48_8bit_unsigned_3off,
			unpack_48_8bit_signed_3off,
		},
		{
			unpack_48_8bit_unsigned_4off,
			unpack_48_8bit_signed_4off,
		},
		{
			unpack_48_8bit_unsigned_5off,
			unpack_48_8bit_signed_5off,
		},
		{
			unpack_48_8bit_unsigned_6off,
			unpack_48_8bit_signed_6off,
		},
		{
			unpack_48_8bit_unsigned_7off,
			unpack_48_8bit_signed_7off,
		},
	},
	{
		{
			unpack_49_8bit_unsigned_0off,
			unpack_49_8bit_signed_0off,
		},
		{
			unpack_49_8bit_unsigned_1off,
			unpack_49_8bit_signed_1off,
		},
		{
			unpack_49_8bit_unsigned_2off,
			unpack_49_8bit_signed_2off,
		},
		{
			unpack_49_8bit_unsigned_3off,
			unpack_49_8bit_signed_3off,
		},
		{
			unpack_49_8bit_unsigned_4off,
			unpack_49_8bit_signed_4off,
		},
		{
			unpack_49_8bit_unsigned_5off,
			unpack_49_8bit_signed_5off,
		},
		{
			unpack_49_8bit_unsigned_6off,
			unpack_49_8bit_signed_6off,
		},
		{
			unpack_49_8bit_unsigned_7off,
			unpack_49_8bit_signed_7off,
		},
	},
	{
		{
			unpack_50_8bit_unsigned_0off,
			unpack_50_8bit_signed_0off,
		},
		{
			unpack_50_8bit_unsigned_1off,
			unpack_50_8bit_signed_1off,
		},
		{
			unpack_50_8bit_unsigned_2off,
			unpack_50_8bit_signed_2off,
		},
		{
			unpack_50_8bit_unsigned_3off,
			unpack_50_8bit_signed_3off,
		},
		{
			unpack_50_8bit_unsigned_4off,
			unpack_50_8bit_signed_4off,
		},
		{
			unpack_50_8bit_unsigned_5off,
			unpack_50_8bit_signed_5off,
		},
		{
			unpack_50_8bit_unsigned_6off,
			unpack_50_8bit_signed_6off,
		},
		{
			unpack_50_8bit_unsigned_7off,
			unpack_50_8bit_signed_7off,
		},
	},
	{
		{
			unpack_51_8bit_unsigned_0off,
			unpack_51_8bit_signed_0off,
		},
		{
			unpack_51_8bit_unsigned_1off,
			unpack_51_8bit_signed_1off,
		},
		{
			unpack_51_8bit_unsigned_2off,
			unpack_51_8bit_signed_2off,
		},
		{
			unpack_51_8bit_unsigned_3off,
			unpack_51_8bit_signed_3off,
		},
		{
			unpack_51_8bit_unsigned_4off,
			unpack_51_8bit_signed_4off,
		},
		{
			unpack_51_8bit_unsigned_5off,
			unpack_51_8bit_signed_5off,
		},
		{
			unpack_51_8bit_unsigned_6off,
			unpack_51_8bit_signed_6off,
		},
		{
			unpack_51_8bit_unsigned_7off,
			unpack_51_8bit_signed_7off,
		},
	},
	{
		{
			unpack_52_8bit_unsigned_0off,
			unpack_52_8bit_signed_0off,
		},
		{
			unpack_52_8bit_unsigned_1off,
			unpack_52_8bit_signed_1off,
		},
		{
			unpack_52_8bit_unsigned_2off,
			unpack_52_8bit_signed_2off,
		},
		{
			unpack_52_8bit_unsigned_3off,
			unpack_52_8bit_signed_3off,
		},
		{
			unpack_52_8bit_unsigned_4off,
			unpack_52_8bit_signed_4off,
		},
		{
			unpack_52_8bit_unsigned_5off,
			unpack_52_8bit_signed_5off,
		},
		{
			unpack_52_8bit_unsigned_6off,
			unpack_52_8bit_signed_6off,
		},
		{
			unpack_52_8bit_unsigned_7off,
			unpack_52_8bit_signed_7off,
		},
	},
	{
		{
			unpack_53_8bit_unsigned_0off,
			unpack_53_8bit_signed_0off,
		},
		{
			unpack_53_8bit_unsigned_1off,
			unpack_53_8bit_signed_1off,
		},
		{
			unpack_53_8bit_unsigned_2off,
			unpack_53_8bit_signed_2off,
		},
		{
			unpack_53_8bit_unsigned_3off,
			unpack_53_8bit_signed_3off,
		},
		{
			unpack_53_8bit_unsigned_4off,
			unpack_53_8bit_signed_4off,
		},
		{
			unpack_53_8bit_unsigned_5off,
			unpack_53_8bit_signed_5off,
		},
		{
			unpack_53_8bit_unsigned_6off,
			unpack_53_8bit_signed_6off,
		},
		{
			unpack_53_8bit_unsigned_7off,
			unpack_53_8bit_signed_7off,
		},
	},
	{
		{
			unpack_54_8bit_unsigned_0off,
			unpack_54_8bit_signed_0off,
		},
		{
			unpack_54_8bit_unsigned_1off,
			unpack_54_8bit_signed_1off,
		},
		{
			unpack_54_8bit_unsigned_2off,
			unpack_54_8bit_signed_2off,
		},
		{
			unpack_54_8bit_unsigned_3off,
			unpack_54_8bit_signed_3off,
		},
		{
			unpack_54_8bit_unsigned_4off,
			unpack_54_8bit_signed_4off,
		},
		{
			unpack_54_8bit_unsigned_5off,
			unpack_54_8bit_signed_5off,
		},
		{
			unpack_54_8bit_unsigned_6off,
			unpack_54_8bit_signed_6off,
		},
		{
			unpack_54_8bit_unsigned_7off,
			unpack_54_8bit_signed_7off,
		},
	},
	{
		{
			unpack_55_8bit_unsigned_0off,
			unpack_55_8bit_signed_0off,
		},
		{
			unpack_55_8bit_unsigned_1off,
			unpack_55_8bit_signed_1off,
		},
		{
			unpack_55_8bit_unsigned_2off,
			unpack_55_8bit_signed_2off,
		},
		{
			unpack_55_8bit_unsigned_3off,
			unpack_55_8bit_signed_3off,
		},
		{
			unpack_55_8bit_unsigned_4off,
			unpack_55_8bit_signed_4off,
		},
		{
			unpack_55_8bit_unsigned_5off,
			unpack_55_8bit_signed_5off,
		},
		{
			unpack_55_8bit_unsigned_6off,
			unpack_55_8bit_signed_6off,
		},
		{
			unpack_55_8bit_unsigned_7off,
			unpack_55_8bit_signed_7off,
		},
	},
	{
		{
			unpack_56_8bit_unsigned_0off,
			unpack_56_8bit_signed_0off,
		},
		{
			unpack_56_8bit_unsigned_1off,
			unpack_56_8bit_signed_1off,
		},
		{
			unpack_56_8bit_unsigned_2off,
			unpack_56_8bit_signed_2off,
		},
		{
			unpack_56_8bit_unsigned_3off,
			unpack_56_8bit_signed_3off,
		},
		{
			unpack_56_8bit_unsigned_4off,
			unpack_56_8bit_signed_4off,
		},
		{
			unpack_56_8bit_unsigned_5off,
			unpack_56_8bit_signed_5off,
		},
		{
			unpack_56_8bit_unsigned_6off,
			unpack_56_8bit_signed_6off,
		},
		{
			unpack_56_8bit_unsigned_7off,
			unpack_56_8bit_signed_7off,
		},
	},
	{
		{
			unpack_57_8bit_unsigned_0off,
			unpack_57_8bit_signed_0off,
		},
		{
			unpack_57_8bit_unsigned_1off,
			unpack_57_8bit_signed_1off,
		},
		{
			unpack_57_8bit_unsigned_2off,
			unpack_57_8bit_signed_2off,
		},
		{
			unpack_57_8bit_unsigned_3off,
			unpack_57_8bit_signed_3off,
		},
		{
			unpack_57_8bit_unsigned_4off,
			unpack_57_8bit_signed_4off,
		},
		{
			unpack_57_8bit_unsigned_5off,
			unpack_57_8bit_signed_5off,
		},
		{
			unpack_57_8bit_unsigned_6off,
			unpack_57_8bit_signed_6off,
		},
		{
			unpack_57_8bit_unsigned_7off,
			unpack_57_8bit_signed_7off,
		},
	},
	{
		{
			unpack_58_8bit_unsigned_0off,
			unpack_58_8bit_signed_0off,
		},
		{
			unpack_58_8bit_unsigned_1off,
			unpack_58_8bit_signed_1off,
		},
		{
			unpack_58_8bit_unsigned_2off,
			unpack_58_8bit_signed_2off,
		},
		{
			unpack_58_8bit_unsigned_3off,
			unpack_58_8bit_signed_3off,
		},
		{
			unpack_58_8bit_unsigned_4off,
			unpack_58_8bit_signed_4off,
		},
		{
			unpack_58_8bit_unsigned_5off,
			unpack_58_8bit_signed_5off,
		},
		{
			unpack_58_8bit_unsigned_6off,
			unpack_58_8bit_signed_6off,
		},
		{
			unpack_58_8bit_unsigned_7off,
			unpack_58_8bit_signed_7off,
		},
	},
	{
		{
			unpack_59_8bit_unsigned_0off,
			unpack_59_8bit_signed_0off,
		},
		{
			unpack_59_8bit_unsigned_1off,
			unpack_59_8bit_signed_1off,
		},
		{
			unpack_59_8bit_unsigned_2off,
			unpack_59_8bit_signed_2off,
		},
		{
			unpack_59_8bit_unsigned_3off,
			unpack_59_8bit_signed_3off,
		},
		{
			unpack_59_8bit_unsigned_4off,
			unpack_59_8bit_signed_4off,
		},
		{
			unpack_59_8bit_unsigned_5off,
			unpack_59_8bit_signed_5off,
		},
		{
			unpack_59_8bit_unsigned_6off,
			unpack_59_8bit_signed_6off,
		},
		{
			unpack_59_8bit_unsigned_7off,
			unpack_59_8bit_signed_7off,
		},
	},
	{
		{
			unpack_60_8bit_unsigned_0off,
			unpack_60_8bit_signed_0off,
		},
		{
			unpack_60_8bit_unsigned_1off,
			unpack_60_8bit_signed_1off,
		},
		{
			unpack_60_8bit_unsigned_2off,
			unpack_60_8bit_signed_2off,
		},
		{
			unpack_60_8bit_unsigned_3off,
			unpack_60_8bit_signed_3off,
		},
		{
			unpack_60_8bit_unsigned_4off,
			unpack_60_8bit_signed_4off,
		},
		{
			unpack_60_8bit_unsigned_5off,
			unpack_60_8bit_signed_5off,
		},
		{
			unpack_60_8bit_unsigned_6off,
			unpack_60_8bit_signed_6off,
		},
		{
			unpack_60_8bit_unsigned_7off,
			unpack_60_8bit_signed_7off,
		},
	},
	{
		{
			unpack_61_8bit_unsigned_0off,
			unpack_61_8bit_signed_0off,
		},
		{
			unpack_61_8bit_unsigned_1off,
			unpack_61_8bit_signed_1off,
		},
		{
			unpack_61_8bit_unsigned_2off,
			unpack_61_8bit_signed_2off,
		},
		{
			unpack_61_8bit_unsigned_3off,
			unpack_61_8bit_signed_3off,
		},
		{
			unpack_61_8bit_unsigned_4off,
			unpack_61_8bit_signed_4off,
		},
		{
			unpack_61_8bit_unsigned_5off,
			unpack_61_8bit_signed_5off,
		},
		{
			unpack_61_8bit_unsigned_6off,
			unpack_61_8bit_signed_6off,
		},
		{
			unpack_61_8bit_unsigned_7off,
			unpack_61_8bit_signed_7off,
		},
	},
	{
		{
			unpack_62_8bit_unsigned_0off,
			unpack_62_8bit_signed_0off,
		},
		{
			unpack_62_8bit_unsigned_1off,
			unpack_62_8bit_signed_1off,
		},
		{
			unpack_62_8bit_unsigned_2off,
			unpack_62_8bit_signed_2off,
		},
		{
			unpack_62_8bit_unsigned_3off,
			unpack_62_8bit_signed_3off,
		},
		{
			unpack_62_8bit_unsigned_4off,
			unpack_62_8bit_signed_4off,
		},
		{
			unpack_62_8bit_unsigned_5off,
			unpack_62_8bit_signed_5off,
		},
		{
			unpack_62_8bit_unsigned_6off,
			unpack_62_8bit_signed_6off,
		},
		{
			unpack_62_8bit_unsigned_7off,
			unpack_62_8bit_signed_7off,
		},
	},
	{
		{
			unpack_63_8bit_unsigned_0off,
			unpack_63_8bit_signed_0off,
		},
		{
			unpack_63_8bit_unsigned_1off,
			unpack_63_8bit_signed_1off,
		},
		{
			unpack_63_8bit_unsigned_2off,
			unpack_63_8bit_signed_2off,
		},
		{
			unpack_63_8bit_unsigned_3off,
			unpack_63_8bit_signed_3off,
		},
		{
			unpack_63_8bit_unsigned_4off,
			unpack_63_8bit_signed_4off,
		},
		{
			unpack_63_8bit_unsigned_5off,
			unpack_63_8bit_signed_5off,
		},
		{
			unpack_63_8bit_unsigned_6off,
			unpack_63_8bit_signed_6off,
		},
		{
			unpack_63_8bit_unsigned_7off,
			unpack_63_8bit_signed_7off,
		},
	},
	{
		{
			unpack_64_8bit_unsigned_0off,
			unpack_64_8bit_signed_0off,
		},
		{
			unpack_64_8bit_unsigned_1off,
			unpack_64_8bit_signed_1off,
		},
		{
			unpack_64_8bit_unsigned_2off,
			unpack_64_8bit_signed_2off,
		},
		{
			unpack_64_8bit_unsigned_3off,
			unpack_64_8bit_signed_3off,
		},
		{
			unpack_64_8bit_unsigned_4off,
			unpack_64_8bit_signed_4off,
		},
		{
			unpack_64_8bit_unsigned_5off,
			unpack_64_8bit_signed_5off,
		},
		{
			unpack_64_8bit_unsigned_6off,
			unpack_64_8bit_signed_6off,
		},
		{
			unpack_64_8bit_unsigned_7off,
			unpack_64_8bit_signed_7off,
		},
	},
};
