// AUTOGENERATED FILE. DO NOT MODIFY.

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

#include "unpack25.h"



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

	int32_t value;

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

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

	uint32_t value;

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

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

	int32_t value;

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

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

	uint32_t value;

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

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

	int32_t value;

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

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

	uint32_t value;

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

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

	int32_t value;

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

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

	uint32_t value;

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

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

	int32_t value;

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

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

	uint32_t value;

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

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

	int32_t value;

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

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

	uint32_t value;

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

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

	int32_t value;

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

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

	uint32_t value;

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

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

	int32_t value;

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

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

	uint32_t value;

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

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

	int32_t value;

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

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

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

	uint32_t value;

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

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

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

	int32_t value;

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

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

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

	uint32_t value;

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

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

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

	int32_t value;

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

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

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

	uint32_t value;

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

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

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

	int32_t value;

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

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

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

	uint32_t value;

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

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

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

	int32_t value;

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

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

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

	uint32_t value;

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

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

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

	int32_t value;

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

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

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

	uint32_t value;

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

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

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

	int32_t value;

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

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

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

	uint32_t value;

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

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

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

	int32_t value;

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

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

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

	uint32_t value;

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

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

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

	int32_t value;

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

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

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

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

	uint32_t value;

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

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

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

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

	int32_t value;

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

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

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

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

	uint32_t value;

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

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

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

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

	int32_t value;

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

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

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

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

	uint32_t value;

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

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

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

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

	int32_t value;

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

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

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

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

	uint32_t value;

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

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

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

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

	int32_t value;

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

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

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

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

	uint32_t value;

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

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

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

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

	int32_t value;

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

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

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

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

	uint32_t value;

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

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

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

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

	int32_t value;

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

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

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

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

	uint32_t value;

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

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

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

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

	int32_t value;

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

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

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

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

	uint32_t value;

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

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

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

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

	int32_t value;

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

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

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

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

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

	uint32_t value;

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

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

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

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

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

	int32_t value;

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

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

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

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

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

	uint32_t value;

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

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

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

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

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

	int32_t value;

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

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

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

	// read output[3]: from bit 77 to 101
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)input[10] << 21) |
			((uint32_t)input[11] << 13) |
			((uint32_t)(input[12] & 0xfc) << 5);
	output[3] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

	// read output[3]: from bit 77 to 101
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)input[10] << 21) |
			((uint32_t)input[11] << 13) |
			((uint32_t)(input[12] & 0xfc) << 5);
	output[3] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

	// read output[3]: from bit 78 to 102
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)input[10] << 22) |
			((uint32_t)input[11] << 14) |
			((uint32_t)(input[12] & 0xfe) << 6);
	output[3] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

	// read output[3]: from bit 78 to 102
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)input[10] << 22) |
			((uint32_t)input[11] << 14) |
			((uint32_t)(input[12] & 0xfe) << 6);
	output[3] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

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

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

	uint32_t value;

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

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

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

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

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

	int32_t value;

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

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

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

	// read output[3]: from bit 80 to 104
	value = ((uint32_t)input[10] << 24) |
			((uint32_t)input[11] << 16) |
			((uint32_t)input[12] << 8) |
			((uint32_t)(input[13] & 0x80));
	output[3] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

	// read output[3]: from bit 80 to 104
	value = ((uint32_t)input[10] << 24) |
			((uint32_t)input[11] << 16) |
			((uint32_t)input[12] << 8) |
			((uint32_t)(input[13] & 0x80));
	output[3] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

	// read output[3]: from bit 81 to 105
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)input[11] << 17) |
			((uint32_t)input[12] << 9) |
			((uint32_t)(input[13] & 0xc0) << 1);
	output[3] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

	// read output[3]: from bit 81 to 105
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)input[11] << 17) |
			((uint32_t)input[12] << 9) |
			((uint32_t)(input[13] & 0xc0) << 1);
	output[3] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

	// read output[3]: from bit 82 to 106
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)input[11] << 18) |
			((uint32_t)input[12] << 10) |
			((uint32_t)(input[13] & 0xe0) << 2);
	output[3] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

	// read output[3]: from bit 82 to 106
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)input[11] << 18) |
			((uint32_t)input[12] << 10) |
			((uint32_t)(input[13] & 0xe0) << 2);
	output[3] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

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

	// read output[4]: from bit 100 to 124
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)input[13] << 20) |
			((uint32_t)input[14] << 12) |
			((uint32_t)(input[15] & 0xf8) << 4);
	output[4] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

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

	// read output[4]: from bit 100 to 124
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)input[13] << 20) |
			((uint32_t)input[14] << 12) |
			((uint32_t)(input[15] & 0xf8) << 4);
	output[4] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

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

	// read output[4]: from bit 101 to 125
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)input[13] << 21) |
			((uint32_t)input[14] << 13) |
			((uint32_t)(input[15] & 0xfc) << 5);
	output[4] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

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

	// read output[4]: from bit 101 to 125
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)input[13] << 21) |
			((uint32_t)input[14] << 13) |
			((uint32_t)(input[15] & 0xfc) << 5);
	output[4] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

	// read output[3]: from bit 77 to 101
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)input[10] << 21) |
			((uint32_t)input[11] << 13) |
			((uint32_t)(input[12] & 0xfc) << 5);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 102 to 126
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)input[13] << 22) |
			((uint32_t)input[14] << 14) |
			((uint32_t)(input[15] & 0xfe) << 6);
	output[4] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

	// read output[3]: from bit 77 to 101
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)input[10] << 21) |
			((uint32_t)input[11] << 13) |
			((uint32_t)(input[12] & 0xfc) << 5);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 102 to 126
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)input[13] << 22) |
			((uint32_t)input[14] << 14) |
			((uint32_t)(input[15] & 0xfe) << 6);
	output[4] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

	// read output[3]: from bit 78 to 102
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)input[10] << 22) |
			((uint32_t)input[11] << 14) |
			((uint32_t)(input[12] & 0xfe) << 6);
	output[3] = (double)(value >> 7);

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

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

	uint32_t value;

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

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

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

	// read output[3]: from bit 78 to 102
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)input[10] << 22) |
			((uint32_t)input[11] << 14) |
			((uint32_t)(input[12] & 0xfe) << 6);
	output[3] = (double)(value >> 7);

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

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

	int32_t value;

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

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

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

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

	// read output[4]: from bit 104 to 128
	value = ((uint32_t)input[13] << 24) |
			((uint32_t)input[14] << 16) |
			((uint32_t)input[15] << 8) |
			((uint32_t)(input[16] & 0x80));
	output[4] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

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

	// read output[4]: from bit 104 to 128
	value = ((uint32_t)input[13] << 24) |
			((uint32_t)input[14] << 16) |
			((uint32_t)input[15] << 8) |
			((uint32_t)(input[16] & 0x80));
	output[4] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

	// read output[3]: from bit 80 to 104
	value = ((uint32_t)input[10] << 24) |
			((uint32_t)input[11] << 16) |
			((uint32_t)input[12] << 8) |
			((uint32_t)(input[13] & 0x80));
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 105 to 129
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)input[14] << 17) |
			((uint32_t)input[15] << 9) |
			((uint32_t)(input[16] & 0xc0) << 1);
	output[4] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

	// read output[3]: from bit 80 to 104
	value = ((uint32_t)input[10] << 24) |
			((uint32_t)input[11] << 16) |
			((uint32_t)input[12] << 8) |
			((uint32_t)(input[13] & 0x80));
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 105 to 129
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)input[14] << 17) |
			((uint32_t)input[15] << 9) |
			((uint32_t)(input[16] & 0xc0) << 1);
	output[4] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

	// read output[3]: from bit 81 to 105
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)input[11] << 17) |
			((uint32_t)input[12] << 9) |
			((uint32_t)(input[13] & 0xc0) << 1);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 106 to 130
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)input[14] << 18) |
			((uint32_t)input[15] << 10) |
			((uint32_t)(input[16] & 0xe0) << 2);
	output[4] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

	// read output[3]: from bit 81 to 105
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)input[11] << 17) |
			((uint32_t)input[12] << 9) |
			((uint32_t)(input[13] & 0xc0) << 1);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 106 to 130
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)input[14] << 18) |
			((uint32_t)input[15] << 10) |
			((uint32_t)(input[16] & 0xe0) << 2);
	output[4] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

	// read output[3]: from bit 82 to 106
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)input[11] << 18) |
			((uint32_t)input[12] << 10) |
			((uint32_t)(input[13] & 0xe0) << 2);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 107 to 131
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)input[14] << 19) |
			((uint32_t)input[15] << 11) |
			((uint32_t)(input[16] & 0xf0) << 3);
	output[4] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

	// read output[3]: from bit 82 to 106
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)input[11] << 18) |
			((uint32_t)input[12] << 10) |
			((uint32_t)(input[13] & 0xe0) << 2);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 107 to 131
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)input[14] << 19) |
			((uint32_t)input[15] << 11) |
			((uint32_t)(input[16] & 0xf0) << 3);
	output[4] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

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

	// read output[4]: from bit 100 to 124
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)input[13] << 20) |
			((uint32_t)input[14] << 12) |
			((uint32_t)(input[15] & 0xf8) << 4);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 125 to 149
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)input[16] << 21) |
			((uint32_t)input[17] << 13) |
			((uint32_t)(input[18] & 0xfc) << 5);
	output[5] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

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

	// read output[4]: from bit 100 to 124
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)input[13] << 20) |
			((uint32_t)input[14] << 12) |
			((uint32_t)(input[15] & 0xf8) << 4);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 125 to 149
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)input[16] << 21) |
			((uint32_t)input[17] << 13) |
			((uint32_t)(input[18] & 0xfc) << 5);
	output[5] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

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

	// read output[4]: from bit 101 to 125
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)input[13] << 21) |
			((uint32_t)input[14] << 13) |
			((uint32_t)(input[15] & 0xfc) << 5);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 126 to 150
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)input[16] << 22) |
			((uint32_t)input[17] << 14) |
			((uint32_t)(input[18] & 0xfe) << 6);
	output[5] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

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

	// read output[4]: from bit 101 to 125
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)input[13] << 21) |
			((uint32_t)input[14] << 13) |
			((uint32_t)(input[15] & 0xfc) << 5);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 126 to 150
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)input[16] << 22) |
			((uint32_t)input[17] << 14) |
			((uint32_t)(input[18] & 0xfe) << 6);
	output[5] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

	// read output[3]: from bit 77 to 101
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)input[10] << 21) |
			((uint32_t)input[11] << 13) |
			((uint32_t)(input[12] & 0xfc) << 5);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 102 to 126
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)input[13] << 22) |
			((uint32_t)input[14] << 14) |
			((uint32_t)(input[15] & 0xfe) << 6);
	output[4] = (double)(value >> 7);

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

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

	uint32_t value;

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

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

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

	// read output[3]: from bit 77 to 101
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)input[10] << 21) |
			((uint32_t)input[11] << 13) |
			((uint32_t)(input[12] & 0xfc) << 5);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 102 to 126
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)input[13] << 22) |
			((uint32_t)input[14] << 14) |
			((uint32_t)(input[15] & 0xfe) << 6);
	output[4] = (double)(value >> 7);

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

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

	int32_t value;

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

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

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

	// read output[3]: from bit 78 to 102
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)input[10] << 22) |
			((uint32_t)input[11] << 14) |
			((uint32_t)(input[12] & 0xfe) << 6);
	output[3] = (double)(value >> 7);

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

	// read output[5]: from bit 128 to 152
	value = ((uint32_t)input[16] << 24) |
			((uint32_t)input[17] << 16) |
			((uint32_t)input[18] << 8) |
			((uint32_t)(input[19] & 0x80));
	output[5] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

	// read output[3]: from bit 78 to 102
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)input[10] << 22) |
			((uint32_t)input[11] << 14) |
			((uint32_t)(input[12] & 0xfe) << 6);
	output[3] = (double)(value >> 7);

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

	// read output[5]: from bit 128 to 152
	value = ((uint32_t)input[16] << 24) |
			((uint32_t)input[17] << 16) |
			((uint32_t)input[18] << 8) |
			((uint32_t)(input[19] & 0x80));
	output[5] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

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

	// read output[4]: from bit 104 to 128
	value = ((uint32_t)input[13] << 24) |
			((uint32_t)input[14] << 16) |
			((uint32_t)input[15] << 8) |
			((uint32_t)(input[16] & 0x80));
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 129 to 153
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)input[17] << 17) |
			((uint32_t)input[18] << 9) |
			((uint32_t)(input[19] & 0xc0) << 1);
	output[5] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

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

	// read output[4]: from bit 104 to 128
	value = ((uint32_t)input[13] << 24) |
			((uint32_t)input[14] << 16) |
			((uint32_t)input[15] << 8) |
			((uint32_t)(input[16] & 0x80));
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 129 to 153
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)input[17] << 17) |
			((uint32_t)input[18] << 9) |
			((uint32_t)(input[19] & 0xc0) << 1);
	output[5] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

	// read output[3]: from bit 80 to 104
	value = ((uint32_t)input[10] << 24) |
			((uint32_t)input[11] << 16) |
			((uint32_t)input[12] << 8) |
			((uint32_t)(input[13] & 0x80));
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 105 to 129
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)input[14] << 17) |
			((uint32_t)input[15] << 9) |
			((uint32_t)(input[16] & 0xc0) << 1);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 130 to 154
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)input[17] << 18) |
			((uint32_t)input[18] << 10) |
			((uint32_t)(input[19] & 0xe0) << 2);
	output[5] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

	// read output[3]: from bit 80 to 104
	value = ((uint32_t)input[10] << 24) |
			((uint32_t)input[11] << 16) |
			((uint32_t)input[12] << 8) |
			((uint32_t)(input[13] & 0x80));
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 105 to 129
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)input[14] << 17) |
			((uint32_t)input[15] << 9) |
			((uint32_t)(input[16] & 0xc0) << 1);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 130 to 154
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)input[17] << 18) |
			((uint32_t)input[18] << 10) |
			((uint32_t)(input[19] & 0xe0) << 2);
	output[5] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

	// read output[3]: from bit 81 to 105
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)input[11] << 17) |
			((uint32_t)input[12] << 9) |
			((uint32_t)(input[13] & 0xc0) << 1);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 106 to 130
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)input[14] << 18) |
			((uint32_t)input[15] << 10) |
			((uint32_t)(input[16] & 0xe0) << 2);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 131 to 155
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)input[17] << 19) |
			((uint32_t)input[18] << 11) |
			((uint32_t)(input[19] & 0xf0) << 3);
	output[5] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

	// read output[3]: from bit 81 to 105
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)input[11] << 17) |
			((uint32_t)input[12] << 9) |
			((uint32_t)(input[13] & 0xc0) << 1);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 106 to 130
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)input[14] << 18) |
			((uint32_t)input[15] << 10) |
			((uint32_t)(input[16] & 0xe0) << 2);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 131 to 155
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)input[17] << 19) |
			((uint32_t)input[18] << 11) |
			((uint32_t)(input[19] & 0xf0) << 3);
	output[5] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

	// read output[3]: from bit 82 to 106
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)input[11] << 18) |
			((uint32_t)input[12] << 10) |
			((uint32_t)(input[13] & 0xe0) << 2);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 107 to 131
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)input[14] << 19) |
			((uint32_t)input[15] << 11) |
			((uint32_t)(input[16] & 0xf0) << 3);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 132 to 156
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)input[17] << 20) |
			((uint32_t)input[18] << 12) |
			((uint32_t)(input[19] & 0xf8) << 4);
	output[5] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

	// read output[3]: from bit 82 to 106
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)input[11] << 18) |
			((uint32_t)input[12] << 10) |
			((uint32_t)(input[13] & 0xe0) << 2);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 107 to 131
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)input[14] << 19) |
			((uint32_t)input[15] << 11) |
			((uint32_t)(input[16] & 0xf0) << 3);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 132 to 156
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)input[17] << 20) |
			((uint32_t)input[18] << 12) |
			((uint32_t)(input[19] & 0xf8) << 4);
	output[5] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

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

	// read output[4]: from bit 100 to 124
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)input[13] << 20) |
			((uint32_t)input[14] << 12) |
			((uint32_t)(input[15] & 0xf8) << 4);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 125 to 149
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)input[16] << 21) |
			((uint32_t)input[17] << 13) |
			((uint32_t)(input[18] & 0xfc) << 5);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 150 to 174
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)input[19] << 22) |
			((uint32_t)input[20] << 14) |
			((uint32_t)(input[21] & 0xfe) << 6);
	output[6] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

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

	// read output[4]: from bit 100 to 124
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)input[13] << 20) |
			((uint32_t)input[14] << 12) |
			((uint32_t)(input[15] & 0xf8) << 4);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 125 to 149
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)input[16] << 21) |
			((uint32_t)input[17] << 13) |
			((uint32_t)(input[18] & 0xfc) << 5);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 150 to 174
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)input[19] << 22) |
			((uint32_t)input[20] << 14) |
			((uint32_t)(input[21] & 0xfe) << 6);
	output[6] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

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

	// read output[4]: from bit 101 to 125
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)input[13] << 21) |
			((uint32_t)input[14] << 13) |
			((uint32_t)(input[15] & 0xfc) << 5);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 126 to 150
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)input[16] << 22) |
			((uint32_t)input[17] << 14) |
			((uint32_t)(input[18] & 0xfe) << 6);
	output[5] = (double)(value >> 7);

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

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

	uint32_t value;

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

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

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

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

	// read output[4]: from bit 101 to 125
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)input[13] << 21) |
			((uint32_t)input[14] << 13) |
			((uint32_t)(input[15] & 0xfc) << 5);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 126 to 150
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)input[16] << 22) |
			((uint32_t)input[17] << 14) |
			((uint32_t)(input[18] & 0xfe) << 6);
	output[5] = (double)(value >> 7);

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

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

	int32_t value;

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

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

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

	// read output[3]: from bit 77 to 101
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)input[10] << 21) |
			((uint32_t)input[11] << 13) |
			((uint32_t)(input[12] & 0xfc) << 5);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 102 to 126
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)input[13] << 22) |
			((uint32_t)input[14] << 14) |
			((uint32_t)(input[15] & 0xfe) << 6);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 127 to 151
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)input[16] << 23) |
			((uint32_t)input[17] << 15) |
			((uint32_t)input[18] << 7);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 152 to 176
	value = ((uint32_t)input[19] << 24) |
			((uint32_t)input[20] << 16) |
			((uint32_t)input[21] << 8) |
			((uint32_t)(input[22] & 0x80));
	output[6] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

	// read output[3]: from bit 77 to 101
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)input[10] << 21) |
			((uint32_t)input[11] << 13) |
			((uint32_t)(input[12] & 0xfc) << 5);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 102 to 126
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)input[13] << 22) |
			((uint32_t)input[14] << 14) |
			((uint32_t)(input[15] & 0xfe) << 6);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 127 to 151
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)input[16] << 23) |
			((uint32_t)input[17] << 15) |
			((uint32_t)input[18] << 7);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 152 to 176
	value = ((uint32_t)input[19] << 24) |
			((uint32_t)input[20] << 16) |
			((uint32_t)input[21] << 8) |
			((uint32_t)(input[22] & 0x80));
	output[6] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

	// read output[3]: from bit 78 to 102
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)input[10] << 22) |
			((uint32_t)input[11] << 14) |
			((uint32_t)(input[12] & 0xfe) << 6);
	output[3] = (double)(value >> 7);

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

	// read output[5]: from bit 128 to 152
	value = ((uint32_t)input[16] << 24) |
			((uint32_t)input[17] << 16) |
			((uint32_t)input[18] << 8) |
			((uint32_t)(input[19] & 0x80));
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 153 to 177
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)input[20] << 17) |
			((uint32_t)input[21] << 9) |
			((uint32_t)(input[22] & 0xc0) << 1);
	output[6] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

	// read output[3]: from bit 78 to 102
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)input[10] << 22) |
			((uint32_t)input[11] << 14) |
			((uint32_t)(input[12] & 0xfe) << 6);
	output[3] = (double)(value >> 7);

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

	// read output[5]: from bit 128 to 152
	value = ((uint32_t)input[16] << 24) |
			((uint32_t)input[17] << 16) |
			((uint32_t)input[18] << 8) |
			((uint32_t)(input[19] & 0x80));
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 153 to 177
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)input[20] << 17) |
			((uint32_t)input[21] << 9) |
			((uint32_t)(input[22] & 0xc0) << 1);
	output[6] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

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

	// read output[4]: from bit 104 to 128
	value = ((uint32_t)input[13] << 24) |
			((uint32_t)input[14] << 16) |
			((uint32_t)input[15] << 8) |
			((uint32_t)(input[16] & 0x80));
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 129 to 153
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)input[17] << 17) |
			((uint32_t)input[18] << 9) |
			((uint32_t)(input[19] & 0xc0) << 1);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 154 to 178
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)input[20] << 18) |
			((uint32_t)input[21] << 10) |
			((uint32_t)(input[22] & 0xe0) << 2);
	output[6] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

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

	// read output[4]: from bit 104 to 128
	value = ((uint32_t)input[13] << 24) |
			((uint32_t)input[14] << 16) |
			((uint32_t)input[15] << 8) |
			((uint32_t)(input[16] & 0x80));
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 129 to 153
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)input[17] << 17) |
			((uint32_t)input[18] << 9) |
			((uint32_t)(input[19] & 0xc0) << 1);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 154 to 178
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)input[20] << 18) |
			((uint32_t)input[21] << 10) |
			((uint32_t)(input[22] & 0xe0) << 2);
	output[6] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

	// read output[3]: from bit 80 to 104
	value = ((uint32_t)input[10] << 24) |
			((uint32_t)input[11] << 16) |
			((uint32_t)input[12] << 8) |
			((uint32_t)(input[13] & 0x80));
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 105 to 129
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)input[14] << 17) |
			((uint32_t)input[15] << 9) |
			((uint32_t)(input[16] & 0xc0) << 1);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 130 to 154
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)input[17] << 18) |
			((uint32_t)input[18] << 10) |
			((uint32_t)(input[19] & 0xe0) << 2);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 155 to 179
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)input[20] << 19) |
			((uint32_t)input[21] << 11) |
			((uint32_t)(input[22] & 0xf0) << 3);
	output[6] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

	// read output[3]: from bit 80 to 104
	value = ((uint32_t)input[10] << 24) |
			((uint32_t)input[11] << 16) |
			((uint32_t)input[12] << 8) |
			((uint32_t)(input[13] & 0x80));
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 105 to 129
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)input[14] << 17) |
			((uint32_t)input[15] << 9) |
			((uint32_t)(input[16] & 0xc0) << 1);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 130 to 154
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)input[17] << 18) |
			((uint32_t)input[18] << 10) |
			((uint32_t)(input[19] & 0xe0) << 2);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 155 to 179
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)input[20] << 19) |
			((uint32_t)input[21] << 11) |
			((uint32_t)(input[22] & 0xf0) << 3);
	output[6] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

	// read output[3]: from bit 81 to 105
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)input[11] << 17) |
			((uint32_t)input[12] << 9) |
			((uint32_t)(input[13] & 0xc0) << 1);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 106 to 130
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)input[14] << 18) |
			((uint32_t)input[15] << 10) |
			((uint32_t)(input[16] & 0xe0) << 2);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 131 to 155
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)input[17] << 19) |
			((uint32_t)input[18] << 11) |
			((uint32_t)(input[19] & 0xf0) << 3);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 156 to 180
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)input[20] << 20) |
			((uint32_t)input[21] << 12) |
			((uint32_t)(input[22] & 0xf8) << 4);
	output[6] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

	// read output[3]: from bit 81 to 105
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)input[11] << 17) |
			((uint32_t)input[12] << 9) |
			((uint32_t)(input[13] & 0xc0) << 1);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 106 to 130
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)input[14] << 18) |
			((uint32_t)input[15] << 10) |
			((uint32_t)(input[16] & 0xe0) << 2);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 131 to 155
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)input[17] << 19) |
			((uint32_t)input[18] << 11) |
			((uint32_t)(input[19] & 0xf0) << 3);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 156 to 180
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)input[20] << 20) |
			((uint32_t)input[21] << 12) |
			((uint32_t)(input[22] & 0xf8) << 4);
	output[6] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

	// read output[3]: from bit 82 to 106
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)input[11] << 18) |
			((uint32_t)input[12] << 10) |
			((uint32_t)(input[13] & 0xe0) << 2);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 107 to 131
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)input[14] << 19) |
			((uint32_t)input[15] << 11) |
			((uint32_t)(input[16] & 0xf0) << 3);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 132 to 156
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)input[17] << 20) |
			((uint32_t)input[18] << 12) |
			((uint32_t)(input[19] & 0xf8) << 4);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 157 to 181
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)input[20] << 21) |
			((uint32_t)input[21] << 13) |
			((uint32_t)(input[22] & 0xfc) << 5);
	output[6] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

	// read output[3]: from bit 82 to 106
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)input[11] << 18) |
			((uint32_t)input[12] << 10) |
			((uint32_t)(input[13] & 0xe0) << 2);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 107 to 131
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)input[14] << 19) |
			((uint32_t)input[15] << 11) |
			((uint32_t)(input[16] & 0xf0) << 3);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 132 to 156
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)input[17] << 20) |
			((uint32_t)input[18] << 12) |
			((uint32_t)(input[19] & 0xf8) << 4);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 157 to 181
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)input[20] << 21) |
			((uint32_t)input[21] << 13) |
			((uint32_t)(input[22] & 0xfc) << 5);
	output[6] = (double)(value >> 7);
}

static void unpack_8_25bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 8 values into output
	// Values are 25-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 24
	value = ((uint32_t)input[0] << 24) |
			((uint32_t)input[1] << 16) |
			((uint32_t)input[2] << 8) |
			((uint32_t)(input[3] & 0x80));
	output[0] = (double)(value >> 7);

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

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

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

	// read output[4]: from bit 100 to 124
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)input[13] << 20) |
			((uint32_t)input[14] << 12) |
			((uint32_t)(input[15] & 0xf8) << 4);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 125 to 149
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)input[16] << 21) |
			((uint32_t)input[17] << 13) |
			((uint32_t)(input[18] & 0xfc) << 5);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 150 to 174
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)input[19] << 22) |
			((uint32_t)input[20] << 14) |
			((uint32_t)(input[21] & 0xfe) << 6);
	output[6] = (double)(value >> 7);

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

static void unpack_8_25bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 8 values into output
	// Values are 25-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 24
	value = ((uint32_t)input[0] << 24) |
			((uint32_t)input[1] << 16) |
			((uint32_t)input[2] << 8) |
			((uint32_t)(input[3] & 0x80));
	output[0] = (double)(value >> 7);

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

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

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

	// read output[4]: from bit 100 to 124
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)input[13] << 20) |
			((uint32_t)input[14] << 12) |
			((uint32_t)(input[15] & 0xf8) << 4);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 125 to 149
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)input[16] << 21) |
			((uint32_t)input[17] << 13) |
			((uint32_t)(input[18] & 0xfc) << 5);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 150 to 174
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)input[19] << 22) |
			((uint32_t)input[20] << 14) |
			((uint32_t)(input[21] & 0xfe) << 6);
	output[6] = (double)(value >> 7);

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

static void unpack_8_25bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 8 values into output
	// Values are 25-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 25
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)input[1] << 17) |
			((uint32_t)input[2] << 9) |
			((uint32_t)(input[3] & 0xc0) << 1);
	output[0] = (double)(value >> 7);

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

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

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

	// read output[4]: from bit 101 to 125
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)input[13] << 21) |
			((uint32_t)input[14] << 13) |
			((uint32_t)(input[15] & 0xfc) << 5);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 126 to 150
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)input[16] << 22) |
			((uint32_t)input[17] << 14) |
			((uint32_t)(input[18] & 0xfe) << 6);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 151 to 175
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)input[19] << 23) |
			((uint32_t)input[20] << 15) |
			((uint32_t)input[21] << 7);
	output[6] = (double)(value >> 7);

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

static void unpack_8_25bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 8 values into output
	// Values are 25-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 25
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)input[1] << 17) |
			((uint32_t)input[2] << 9) |
			((uint32_t)(input[3] & 0xc0) << 1);
	output[0] = (double)(value >> 7);

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

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

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

	// read output[4]: from bit 101 to 125
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)input[13] << 21) |
			((uint32_t)input[14] << 13) |
			((uint32_t)(input[15] & 0xfc) << 5);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 126 to 150
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)input[16] << 22) |
			((uint32_t)input[17] << 14) |
			((uint32_t)(input[18] & 0xfe) << 6);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 151 to 175
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)input[19] << 23) |
			((uint32_t)input[20] << 15) |
			((uint32_t)input[21] << 7);
	output[6] = (double)(value >> 7);

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

static void unpack_8_25bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 8 values into output
	// Values are 25-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 26
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)input[1] << 18) |
			((uint32_t)input[2] << 10) |
			((uint32_t)(input[3] & 0xe0) << 2);
	output[0] = (double)(value >> 7);

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

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

	// read output[3]: from bit 77 to 101
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)input[10] << 21) |
			((uint32_t)input[11] << 13) |
			((uint32_t)(input[12] & 0xfc) << 5);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 102 to 126
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)input[13] << 22) |
			((uint32_t)input[14] << 14) |
			((uint32_t)(input[15] & 0xfe) << 6);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 127 to 151
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)input[16] << 23) |
			((uint32_t)input[17] << 15) |
			((uint32_t)input[18] << 7);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 152 to 176
	value = ((uint32_t)input[19] << 24) |
			((uint32_t)input[20] << 16) |
			((uint32_t)input[21] << 8) |
			((uint32_t)(input[22] & 0x80));
	output[6] = (double)(value >> 7);

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

static void unpack_8_25bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 8 values into output
	// Values are 25-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 26
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)input[1] << 18) |
			((uint32_t)input[2] << 10) |
			((uint32_t)(input[3] & 0xe0) << 2);
	output[0] = (double)(value >> 7);

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

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

	// read output[3]: from bit 77 to 101
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)input[10] << 21) |
			((uint32_t)input[11] << 13) |
			((uint32_t)(input[12] & 0xfc) << 5);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 102 to 126
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)input[13] << 22) |
			((uint32_t)input[14] << 14) |
			((uint32_t)(input[15] & 0xfe) << 6);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 127 to 151
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)input[16] << 23) |
			((uint32_t)input[17] << 15) |
			((uint32_t)input[18] << 7);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 152 to 176
	value = ((uint32_t)input[19] << 24) |
			((uint32_t)input[20] << 16) |
			((uint32_t)input[21] << 8) |
			((uint32_t)(input[22] & 0x80));
	output[6] = (double)(value >> 7);

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

static void unpack_8_25bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 8 values into output
	// Values are 25-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 27
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)input[1] << 19) |
			((uint32_t)input[2] << 11) |
			((uint32_t)(input[3] & 0xf0) << 3);
	output[0] = (double)(value >> 7);

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

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

	// read output[3]: from bit 78 to 102
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)input[10] << 22) |
			((uint32_t)input[11] << 14) |
			((uint32_t)(input[12] & 0xfe) << 6);
	output[3] = (double)(value >> 7);

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

	// read output[5]: from bit 128 to 152
	value = ((uint32_t)input[16] << 24) |
			((uint32_t)input[17] << 16) |
			((uint32_t)input[18] << 8) |
			((uint32_t)(input[19] & 0x80));
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 153 to 177
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)input[20] << 17) |
			((uint32_t)input[21] << 9) |
			((uint32_t)(input[22] & 0xc0) << 1);
	output[6] = (double)(value >> 7);

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

static void unpack_8_25bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 8 values into output
	// Values are 25-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 27
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)input[1] << 19) |
			((uint32_t)input[2] << 11) |
			((uint32_t)(input[3] & 0xf0) << 3);
	output[0] = (double)(value >> 7);

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

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

	// read output[3]: from bit 78 to 102
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)input[10] << 22) |
			((uint32_t)input[11] << 14) |
			((uint32_t)(input[12] & 0xfe) << 6);
	output[3] = (double)(value >> 7);

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

	// read output[5]: from bit 128 to 152
	value = ((uint32_t)input[16] << 24) |
			((uint32_t)input[17] << 16) |
			((uint32_t)input[18] << 8) |
			((uint32_t)(input[19] & 0x80));
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 153 to 177
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)input[20] << 17) |
			((uint32_t)input[21] << 9) |
			((uint32_t)(input[22] & 0xc0) << 1);
	output[6] = (double)(value >> 7);

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

static void unpack_8_25bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 8 values into output
	// Values are 25-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 28
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)input[1] << 20) |
			((uint32_t)input[2] << 12) |
			((uint32_t)(input[3] & 0xf8) << 4);
	output[0] = (double)(value >> 7);

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

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

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

	// read output[4]: from bit 104 to 128
	value = ((uint32_t)input[13] << 24) |
			((uint32_t)input[14] << 16) |
			((uint32_t)input[15] << 8) |
			((uint32_t)(input[16] & 0x80));
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 129 to 153
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)input[17] << 17) |
			((uint32_t)input[18] << 9) |
			((uint32_t)(input[19] & 0xc0) << 1);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 154 to 178
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)input[20] << 18) |
			((uint32_t)input[21] << 10) |
			((uint32_t)(input[22] & 0xe0) << 2);
	output[6] = (double)(value >> 7);

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

static void unpack_8_25bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 8 values into output
	// Values are 25-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 28
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)input[1] << 20) |
			((uint32_t)input[2] << 12) |
			((uint32_t)(input[3] & 0xf8) << 4);
	output[0] = (double)(value >> 7);

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

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

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

	// read output[4]: from bit 104 to 128
	value = ((uint32_t)input[13] << 24) |
			((uint32_t)input[14] << 16) |
			((uint32_t)input[15] << 8) |
			((uint32_t)(input[16] & 0x80));
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 129 to 153
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)input[17] << 17) |
			((uint32_t)input[18] << 9) |
			((uint32_t)(input[19] & 0xc0) << 1);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 154 to 178
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)input[20] << 18) |
			((uint32_t)input[21] << 10) |
			((uint32_t)(input[22] & 0xe0) << 2);
	output[6] = (double)(value >> 7);

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

static void unpack_8_25bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 8 values into output
	// Values are 25-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 29
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)input[1] << 21) |
			((uint32_t)input[2] << 13) |
			((uint32_t)(input[3] & 0xfc) << 5);
	output[0] = (double)(value >> 7);

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

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

	// read output[3]: from bit 80 to 104
	value = ((uint32_t)input[10] << 24) |
			((uint32_t)input[11] << 16) |
			((uint32_t)input[12] << 8) |
			((uint32_t)(input[13] & 0x80));
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 105 to 129
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)input[14] << 17) |
			((uint32_t)input[15] << 9) |
			((uint32_t)(input[16] & 0xc0) << 1);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 130 to 154
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)input[17] << 18) |
			((uint32_t)input[18] << 10) |
			((uint32_t)(input[19] & 0xe0) << 2);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 155 to 179
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)input[20] << 19) |
			((uint32_t)input[21] << 11) |
			((uint32_t)(input[22] & 0xf0) << 3);
	output[6] = (double)(value >> 7);

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

static void unpack_8_25bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 8 values into output
	// Values are 25-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 29
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)input[1] << 21) |
			((uint32_t)input[2] << 13) |
			((uint32_t)(input[3] & 0xfc) << 5);
	output[0] = (double)(value >> 7);

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

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

	// read output[3]: from bit 80 to 104
	value = ((uint32_t)input[10] << 24) |
			((uint32_t)input[11] << 16) |
			((uint32_t)input[12] << 8) |
			((uint32_t)(input[13] & 0x80));
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 105 to 129
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)input[14] << 17) |
			((uint32_t)input[15] << 9) |
			((uint32_t)(input[16] & 0xc0) << 1);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 130 to 154
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)input[17] << 18) |
			((uint32_t)input[18] << 10) |
			((uint32_t)(input[19] & 0xe0) << 2);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 155 to 179
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)input[20] << 19) |
			((uint32_t)input[21] << 11) |
			((uint32_t)(input[22] & 0xf0) << 3);
	output[6] = (double)(value >> 7);

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

static void unpack_8_25bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 8 values into output
	// Values are 25-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 30
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)input[1] << 22) |
			((uint32_t)input[2] << 14) |
			((uint32_t)(input[3] & 0xfe) << 6);
	output[0] = (double)(value >> 7);

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

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

	// read output[3]: from bit 81 to 105
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)input[11] << 17) |
			((uint32_t)input[12] << 9) |
			((uint32_t)(input[13] & 0xc0) << 1);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 106 to 130
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)input[14] << 18) |
			((uint32_t)input[15] << 10) |
			((uint32_t)(input[16] & 0xe0) << 2);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 131 to 155
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)input[17] << 19) |
			((uint32_t)input[18] << 11) |
			((uint32_t)(input[19] & 0xf0) << 3);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 156 to 180
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)input[20] << 20) |
			((uint32_t)input[21] << 12) |
			((uint32_t)(input[22] & 0xf8) << 4);
	output[6] = (double)(value >> 7);

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

static void unpack_8_25bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 8 values into output
	// Values are 25-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 30
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)input[1] << 22) |
			((uint32_t)input[2] << 14) |
			((uint32_t)(input[3] & 0xfe) << 6);
	output[0] = (double)(value >> 7);

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

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

	// read output[3]: from bit 81 to 105
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)input[11] << 17) |
			((uint32_t)input[12] << 9) |
			((uint32_t)(input[13] & 0xc0) << 1);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 106 to 130
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)input[14] << 18) |
			((uint32_t)input[15] << 10) |
			((uint32_t)(input[16] & 0xe0) << 2);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 131 to 155
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)input[17] << 19) |
			((uint32_t)input[18] << 11) |
			((uint32_t)(input[19] & 0xf0) << 3);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 156 to 180
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)input[20] << 20) |
			((uint32_t)input[21] << 12) |
			((uint32_t)(input[22] & 0xf8) << 4);
	output[6] = (double)(value >> 7);

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

static void unpack_8_25bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 8 values into output
	// Values are 25-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 31
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)input[1] << 23) |
			((uint32_t)input[2] << 15) |
			((uint32_t)input[3] << 7);
	output[0] = (double)(value >> 7);

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

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

	// read output[3]: from bit 82 to 106
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)input[11] << 18) |
			((uint32_t)input[12] << 10) |
			((uint32_t)(input[13] & 0xe0) << 2);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 107 to 131
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)input[14] << 19) |
			((uint32_t)input[15] << 11) |
			((uint32_t)(input[16] & 0xf0) << 3);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 132 to 156
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)input[17] << 20) |
			((uint32_t)input[18] << 12) |
			((uint32_t)(input[19] & 0xf8) << 4);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 157 to 181
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)input[20] << 21) |
			((uint32_t)input[21] << 13) |
			((uint32_t)(input[22] & 0xfc) << 5);
	output[6] = (double)(value >> 7);

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

static void unpack_8_25bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 8 values into output
	// Values are 25-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 31
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)input[1] << 23) |
			((uint32_t)input[2] << 15) |
			((uint32_t)input[3] << 7);
	output[0] = (double)(value >> 7);

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

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

	// read output[3]: from bit 82 to 106
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)input[11] << 18) |
			((uint32_t)input[12] << 10) |
			((uint32_t)(input[13] & 0xe0) << 2);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 107 to 131
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)input[14] << 19) |
			((uint32_t)input[15] << 11) |
			((uint32_t)(input[16] & 0xf0) << 3);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 132 to 156
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)input[17] << 20) |
			((uint32_t)input[18] << 12) |
			((uint32_t)(input[19] & 0xf8) << 4);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 157 to 181
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)input[20] << 21) |
			((uint32_t)input[21] << 13) |
			((uint32_t)(input[22] & 0xfc) << 5);
	output[6] = (double)(value >> 7);

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

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

	int32_t value;

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

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

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

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

	// read output[4]: from bit 100 to 124
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)input[13] << 20) |
			((uint32_t)input[14] << 12) |
			((uint32_t)(input[15] & 0xf8) << 4);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 125 to 149
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)input[16] << 21) |
			((uint32_t)input[17] << 13) |
			((uint32_t)(input[18] & 0xfc) << 5);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 150 to 174
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)input[19] << 22) |
			((uint32_t)input[20] << 14) |
			((uint32_t)(input[21] & 0xfe) << 6);
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 200 to 224
	value = ((uint32_t)input[25] << 24) |
			((uint32_t)input[26] << 16) |
			((uint32_t)input[27] << 8) |
			((uint32_t)(input[28] & 0x80));
	output[8] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

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

	// read output[4]: from bit 100 to 124
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)input[13] << 20) |
			((uint32_t)input[14] << 12) |
			((uint32_t)(input[15] & 0xf8) << 4);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 125 to 149
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)input[16] << 21) |
			((uint32_t)input[17] << 13) |
			((uint32_t)(input[18] & 0xfc) << 5);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 150 to 174
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)input[19] << 22) |
			((uint32_t)input[20] << 14) |
			((uint32_t)(input[21] & 0xfe) << 6);
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 200 to 224
	value = ((uint32_t)input[25] << 24) |
			((uint32_t)input[26] << 16) |
			((uint32_t)input[27] << 8) |
			((uint32_t)(input[28] & 0x80));
	output[8] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

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

	// read output[4]: from bit 101 to 125
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)input[13] << 21) |
			((uint32_t)input[14] << 13) |
			((uint32_t)(input[15] & 0xfc) << 5);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 126 to 150
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)input[16] << 22) |
			((uint32_t)input[17] << 14) |
			((uint32_t)(input[18] & 0xfe) << 6);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 151 to 175
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)input[19] << 23) |
			((uint32_t)input[20] << 15) |
			((uint32_t)input[21] << 7);
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 201 to 225
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)input[26] << 17) |
			((uint32_t)input[27] << 9) |
			((uint32_t)(input[28] & 0xc0) << 1);
	output[8] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

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

	// read output[4]: from bit 101 to 125
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)input[13] << 21) |
			((uint32_t)input[14] << 13) |
			((uint32_t)(input[15] & 0xfc) << 5);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 126 to 150
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)input[16] << 22) |
			((uint32_t)input[17] << 14) |
			((uint32_t)(input[18] & 0xfe) << 6);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 151 to 175
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)input[19] << 23) |
			((uint32_t)input[20] << 15) |
			((uint32_t)input[21] << 7);
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 201 to 225
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)input[26] << 17) |
			((uint32_t)input[27] << 9) |
			((uint32_t)(input[28] & 0xc0) << 1);
	output[8] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

	// read output[3]: from bit 77 to 101
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)input[10] << 21) |
			((uint32_t)input[11] << 13) |
			((uint32_t)(input[12] & 0xfc) << 5);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 102 to 126
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)input[13] << 22) |
			((uint32_t)input[14] << 14) |
			((uint32_t)(input[15] & 0xfe) << 6);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 127 to 151
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)input[16] << 23) |
			((uint32_t)input[17] << 15) |
			((uint32_t)input[18] << 7);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 152 to 176
	value = ((uint32_t)input[19] << 24) |
			((uint32_t)input[20] << 16) |
			((uint32_t)input[21] << 8) |
			((uint32_t)(input[22] & 0x80));
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 202 to 226
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)input[26] << 18) |
			((uint32_t)input[27] << 10) |
			((uint32_t)(input[28] & 0xe0) << 2);
	output[8] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

	// read output[3]: from bit 77 to 101
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)input[10] << 21) |
			((uint32_t)input[11] << 13) |
			((uint32_t)(input[12] & 0xfc) << 5);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 102 to 126
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)input[13] << 22) |
			((uint32_t)input[14] << 14) |
			((uint32_t)(input[15] & 0xfe) << 6);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 127 to 151
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)input[16] << 23) |
			((uint32_t)input[17] << 15) |
			((uint32_t)input[18] << 7);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 152 to 176
	value = ((uint32_t)input[19] << 24) |
			((uint32_t)input[20] << 16) |
			((uint32_t)input[21] << 8) |
			((uint32_t)(input[22] & 0x80));
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 202 to 226
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)input[26] << 18) |
			((uint32_t)input[27] << 10) |
			((uint32_t)(input[28] & 0xe0) << 2);
	output[8] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

	// read output[3]: from bit 78 to 102
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)input[10] << 22) |
			((uint32_t)input[11] << 14) |
			((uint32_t)(input[12] & 0xfe) << 6);
	output[3] = (double)(value >> 7);

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

	// read output[5]: from bit 128 to 152
	value = ((uint32_t)input[16] << 24) |
			((uint32_t)input[17] << 16) |
			((uint32_t)input[18] << 8) |
			((uint32_t)(input[19] & 0x80));
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 153 to 177
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)input[20] << 17) |
			((uint32_t)input[21] << 9) |
			((uint32_t)(input[22] & 0xc0) << 1);
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 203 to 227
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)input[26] << 19) |
			((uint32_t)input[27] << 11) |
			((uint32_t)(input[28] & 0xf0) << 3);
	output[8] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

	// read output[3]: from bit 78 to 102
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)input[10] << 22) |
			((uint32_t)input[11] << 14) |
			((uint32_t)(input[12] & 0xfe) << 6);
	output[3] = (double)(value >> 7);

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

	// read output[5]: from bit 128 to 152
	value = ((uint32_t)input[16] << 24) |
			((uint32_t)input[17] << 16) |
			((uint32_t)input[18] << 8) |
			((uint32_t)(input[19] & 0x80));
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 153 to 177
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)input[20] << 17) |
			((uint32_t)input[21] << 9) |
			((uint32_t)(input[22] & 0xc0) << 1);
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 203 to 227
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)input[26] << 19) |
			((uint32_t)input[27] << 11) |
			((uint32_t)(input[28] & 0xf0) << 3);
	output[8] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

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

	// read output[4]: from bit 104 to 128
	value = ((uint32_t)input[13] << 24) |
			((uint32_t)input[14] << 16) |
			((uint32_t)input[15] << 8) |
			((uint32_t)(input[16] & 0x80));
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 129 to 153
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)input[17] << 17) |
			((uint32_t)input[18] << 9) |
			((uint32_t)(input[19] & 0xc0) << 1);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 154 to 178
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)input[20] << 18) |
			((uint32_t)input[21] << 10) |
			((uint32_t)(input[22] & 0xe0) << 2);
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 204 to 228
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)input[26] << 20) |
			((uint32_t)input[27] << 12) |
			((uint32_t)(input[28] & 0xf8) << 4);
	output[8] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

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

	// read output[4]: from bit 104 to 128
	value = ((uint32_t)input[13] << 24) |
			((uint32_t)input[14] << 16) |
			((uint32_t)input[15] << 8) |
			((uint32_t)(input[16] & 0x80));
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 129 to 153
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)input[17] << 17) |
			((uint32_t)input[18] << 9) |
			((uint32_t)(input[19] & 0xc0) << 1);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 154 to 178
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)input[20] << 18) |
			((uint32_t)input[21] << 10) |
			((uint32_t)(input[22] & 0xe0) << 2);
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 204 to 228
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)input[26] << 20) |
			((uint32_t)input[27] << 12) |
			((uint32_t)(input[28] & 0xf8) << 4);
	output[8] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

	// read output[3]: from bit 80 to 104
	value = ((uint32_t)input[10] << 24) |
			((uint32_t)input[11] << 16) |
			((uint32_t)input[12] << 8) |
			((uint32_t)(input[13] & 0x80));
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 105 to 129
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)input[14] << 17) |
			((uint32_t)input[15] << 9) |
			((uint32_t)(input[16] & 0xc0) << 1);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 130 to 154
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)input[17] << 18) |
			((uint32_t)input[18] << 10) |
			((uint32_t)(input[19] & 0xe0) << 2);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 155 to 179
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)input[20] << 19) |
			((uint32_t)input[21] << 11) |
			((uint32_t)(input[22] & 0xf0) << 3);
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 205 to 229
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)input[26] << 21) |
			((uint32_t)input[27] << 13) |
			((uint32_t)(input[28] & 0xfc) << 5);
	output[8] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

	// read output[3]: from bit 80 to 104
	value = ((uint32_t)input[10] << 24) |
			((uint32_t)input[11] << 16) |
			((uint32_t)input[12] << 8) |
			((uint32_t)(input[13] & 0x80));
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 105 to 129
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)input[14] << 17) |
			((uint32_t)input[15] << 9) |
			((uint32_t)(input[16] & 0xc0) << 1);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 130 to 154
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)input[17] << 18) |
			((uint32_t)input[18] << 10) |
			((uint32_t)(input[19] & 0xe0) << 2);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 155 to 179
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)input[20] << 19) |
			((uint32_t)input[21] << 11) |
			((uint32_t)(input[22] & 0xf0) << 3);
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 205 to 229
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)input[26] << 21) |
			((uint32_t)input[27] << 13) |
			((uint32_t)(input[28] & 0xfc) << 5);
	output[8] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

	// read output[3]: from bit 81 to 105
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)input[11] << 17) |
			((uint32_t)input[12] << 9) |
			((uint32_t)(input[13] & 0xc0) << 1);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 106 to 130
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)input[14] << 18) |
			((uint32_t)input[15] << 10) |
			((uint32_t)(input[16] & 0xe0) << 2);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 131 to 155
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)input[17] << 19) |
			((uint32_t)input[18] << 11) |
			((uint32_t)(input[19] & 0xf0) << 3);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 156 to 180
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)input[20] << 20) |
			((uint32_t)input[21] << 12) |
			((uint32_t)(input[22] & 0xf8) << 4);
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 206 to 230
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)input[26] << 22) |
			((uint32_t)input[27] << 14) |
			((uint32_t)(input[28] & 0xfe) << 6);
	output[8] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

	// read output[3]: from bit 81 to 105
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)input[11] << 17) |
			((uint32_t)input[12] << 9) |
			((uint32_t)(input[13] & 0xc0) << 1);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 106 to 130
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)input[14] << 18) |
			((uint32_t)input[15] << 10) |
			((uint32_t)(input[16] & 0xe0) << 2);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 131 to 155
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)input[17] << 19) |
			((uint32_t)input[18] << 11) |
			((uint32_t)(input[19] & 0xf0) << 3);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 156 to 180
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)input[20] << 20) |
			((uint32_t)input[21] << 12) |
			((uint32_t)(input[22] & 0xf8) << 4);
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 206 to 230
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)input[26] << 22) |
			((uint32_t)input[27] << 14) |
			((uint32_t)(input[28] & 0xfe) << 6);
	output[8] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

	// read output[3]: from bit 82 to 106
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)input[11] << 18) |
			((uint32_t)input[12] << 10) |
			((uint32_t)(input[13] & 0xe0) << 2);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 107 to 131
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)input[14] << 19) |
			((uint32_t)input[15] << 11) |
			((uint32_t)(input[16] & 0xf0) << 3);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 132 to 156
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)input[17] << 20) |
			((uint32_t)input[18] << 12) |
			((uint32_t)(input[19] & 0xf8) << 4);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 157 to 181
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)input[20] << 21) |
			((uint32_t)input[21] << 13) |
			((uint32_t)(input[22] & 0xfc) << 5);
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 207 to 231
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)input[28] << 7);
	output[8] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

	// read output[3]: from bit 82 to 106
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)input[11] << 18) |
			((uint32_t)input[12] << 10) |
			((uint32_t)(input[13] & 0xe0) << 2);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 107 to 131
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)input[14] << 19) |
			((uint32_t)input[15] << 11) |
			((uint32_t)(input[16] & 0xf0) << 3);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 132 to 156
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)input[17] << 20) |
			((uint32_t)input[18] << 12) |
			((uint32_t)(input[19] & 0xf8) << 4);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 157 to 181
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)input[20] << 21) |
			((uint32_t)input[21] << 13) |
			((uint32_t)(input[22] & 0xfc) << 5);
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 207 to 231
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)input[28] << 7);
	output[8] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

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

	// read output[4]: from bit 100 to 124
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)input[13] << 20) |
			((uint32_t)input[14] << 12) |
			((uint32_t)(input[15] & 0xf8) << 4);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 125 to 149
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)input[16] << 21) |
			((uint32_t)input[17] << 13) |
			((uint32_t)(input[18] & 0xfc) << 5);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 150 to 174
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)input[19] << 22) |
			((uint32_t)input[20] << 14) |
			((uint32_t)(input[21] & 0xfe) << 6);
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 200 to 224
	value = ((uint32_t)input[25] << 24) |
			((uint32_t)input[26] << 16) |
			((uint32_t)input[27] << 8) |
			((uint32_t)(input[28] & 0x80));
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 225 to 249
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)input[29] << 17) |
			((uint32_t)input[30] << 9) |
			((uint32_t)(input[31] & 0xc0) << 1);
	output[9] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

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

	// read output[4]: from bit 100 to 124
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)input[13] << 20) |
			((uint32_t)input[14] << 12) |
			((uint32_t)(input[15] & 0xf8) << 4);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 125 to 149
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)input[16] << 21) |
			((uint32_t)input[17] << 13) |
			((uint32_t)(input[18] & 0xfc) << 5);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 150 to 174
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)input[19] << 22) |
			((uint32_t)input[20] << 14) |
			((uint32_t)(input[21] & 0xfe) << 6);
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 200 to 224
	value = ((uint32_t)input[25] << 24) |
			((uint32_t)input[26] << 16) |
			((uint32_t)input[27] << 8) |
			((uint32_t)(input[28] & 0x80));
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 225 to 249
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)input[29] << 17) |
			((uint32_t)input[30] << 9) |
			((uint32_t)(input[31] & 0xc0) << 1);
	output[9] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

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

	// read output[4]: from bit 101 to 125
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)input[13] << 21) |
			((uint32_t)input[14] << 13) |
			((uint32_t)(input[15] & 0xfc) << 5);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 126 to 150
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)input[16] << 22) |
			((uint32_t)input[17] << 14) |
			((uint32_t)(input[18] & 0xfe) << 6);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 151 to 175
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)input[19] << 23) |
			((uint32_t)input[20] << 15) |
			((uint32_t)input[21] << 7);
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 201 to 225
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)input[26] << 17) |
			((uint32_t)input[27] << 9) |
			((uint32_t)(input[28] & 0xc0) << 1);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 226 to 250
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)input[29] << 18) |
			((uint32_t)input[30] << 10) |
			((uint32_t)(input[31] & 0xe0) << 2);
	output[9] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

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

	// read output[4]: from bit 101 to 125
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)input[13] << 21) |
			((uint32_t)input[14] << 13) |
			((uint32_t)(input[15] & 0xfc) << 5);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 126 to 150
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)input[16] << 22) |
			((uint32_t)input[17] << 14) |
			((uint32_t)(input[18] & 0xfe) << 6);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 151 to 175
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)input[19] << 23) |
			((uint32_t)input[20] << 15) |
			((uint32_t)input[21] << 7);
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 201 to 225
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)input[26] << 17) |
			((uint32_t)input[27] << 9) |
			((uint32_t)(input[28] & 0xc0) << 1);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 226 to 250
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)input[29] << 18) |
			((uint32_t)input[30] << 10) |
			((uint32_t)(input[31] & 0xe0) << 2);
	output[9] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

	// read output[3]: from bit 77 to 101
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)input[10] << 21) |
			((uint32_t)input[11] << 13) |
			((uint32_t)(input[12] & 0xfc) << 5);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 102 to 126
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)input[13] << 22) |
			((uint32_t)input[14] << 14) |
			((uint32_t)(input[15] & 0xfe) << 6);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 127 to 151
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)input[16] << 23) |
			((uint32_t)input[17] << 15) |
			((uint32_t)input[18] << 7);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 152 to 176
	value = ((uint32_t)input[19] << 24) |
			((uint32_t)input[20] << 16) |
			((uint32_t)input[21] << 8) |
			((uint32_t)(input[22] & 0x80));
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 202 to 226
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)input[26] << 18) |
			((uint32_t)input[27] << 10) |
			((uint32_t)(input[28] & 0xe0) << 2);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 227 to 251
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)input[29] << 19) |
			((uint32_t)input[30] << 11) |
			((uint32_t)(input[31] & 0xf0) << 3);
	output[9] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

	// read output[3]: from bit 77 to 101
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)input[10] << 21) |
			((uint32_t)input[11] << 13) |
			((uint32_t)(input[12] & 0xfc) << 5);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 102 to 126
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)input[13] << 22) |
			((uint32_t)input[14] << 14) |
			((uint32_t)(input[15] & 0xfe) << 6);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 127 to 151
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)input[16] << 23) |
			((uint32_t)input[17] << 15) |
			((uint32_t)input[18] << 7);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 152 to 176
	value = ((uint32_t)input[19] << 24) |
			((uint32_t)input[20] << 16) |
			((uint32_t)input[21] << 8) |
			((uint32_t)(input[22] & 0x80));
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 202 to 226
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)input[26] << 18) |
			((uint32_t)input[27] << 10) |
			((uint32_t)(input[28] & 0xe0) << 2);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 227 to 251
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)input[29] << 19) |
			((uint32_t)input[30] << 11) |
			((uint32_t)(input[31] & 0xf0) << 3);
	output[9] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

	// read output[3]: from bit 78 to 102
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)input[10] << 22) |
			((uint32_t)input[11] << 14) |
			((uint32_t)(input[12] & 0xfe) << 6);
	output[3] = (double)(value >> 7);

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

	// read output[5]: from bit 128 to 152
	value = ((uint32_t)input[16] << 24) |
			((uint32_t)input[17] << 16) |
			((uint32_t)input[18] << 8) |
			((uint32_t)(input[19] & 0x80));
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 153 to 177
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)input[20] << 17) |
			((uint32_t)input[21] << 9) |
			((uint32_t)(input[22] & 0xc0) << 1);
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 203 to 227
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)input[26] << 19) |
			((uint32_t)input[27] << 11) |
			((uint32_t)(input[28] & 0xf0) << 3);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 228 to 252
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)input[29] << 20) |
			((uint32_t)input[30] << 12) |
			((uint32_t)(input[31] & 0xf8) << 4);
	output[9] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

	// read output[3]: from bit 78 to 102
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)input[10] << 22) |
			((uint32_t)input[11] << 14) |
			((uint32_t)(input[12] & 0xfe) << 6);
	output[3] = (double)(value >> 7);

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

	// read output[5]: from bit 128 to 152
	value = ((uint32_t)input[16] << 24) |
			((uint32_t)input[17] << 16) |
			((uint32_t)input[18] << 8) |
			((uint32_t)(input[19] & 0x80));
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 153 to 177
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)input[20] << 17) |
			((uint32_t)input[21] << 9) |
			((uint32_t)(input[22] & 0xc0) << 1);
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 203 to 227
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)input[26] << 19) |
			((uint32_t)input[27] << 11) |
			((uint32_t)(input[28] & 0xf0) << 3);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 228 to 252
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)input[29] << 20) |
			((uint32_t)input[30] << 12) |
			((uint32_t)(input[31] & 0xf8) << 4);
	output[9] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

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

	// read output[4]: from bit 104 to 128
	value = ((uint32_t)input[13] << 24) |
			((uint32_t)input[14] << 16) |
			((uint32_t)input[15] << 8) |
			((uint32_t)(input[16] & 0x80));
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 129 to 153
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)input[17] << 17) |
			((uint32_t)input[18] << 9) |
			((uint32_t)(input[19] & 0xc0) << 1);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 154 to 178
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)input[20] << 18) |
			((uint32_t)input[21] << 10) |
			((uint32_t)(input[22] & 0xe0) << 2);
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 204 to 228
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)input[26] << 20) |
			((uint32_t)input[27] << 12) |
			((uint32_t)(input[28] & 0xf8) << 4);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 229 to 253
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)input[29] << 21) |
			((uint32_t)input[30] << 13) |
			((uint32_t)(input[31] & 0xfc) << 5);
	output[9] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

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

	// read output[4]: from bit 104 to 128
	value = ((uint32_t)input[13] << 24) |
			((uint32_t)input[14] << 16) |
			((uint32_t)input[15] << 8) |
			((uint32_t)(input[16] & 0x80));
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 129 to 153
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)input[17] << 17) |
			((uint32_t)input[18] << 9) |
			((uint32_t)(input[19] & 0xc0) << 1);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 154 to 178
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)input[20] << 18) |
			((uint32_t)input[21] << 10) |
			((uint32_t)(input[22] & 0xe0) << 2);
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 204 to 228
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)input[26] << 20) |
			((uint32_t)input[27] << 12) |
			((uint32_t)(input[28] & 0xf8) << 4);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 229 to 253
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)input[29] << 21) |
			((uint32_t)input[30] << 13) |
			((uint32_t)(input[31] & 0xfc) << 5);
	output[9] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

	// read output[3]: from bit 80 to 104
	value = ((uint32_t)input[10] << 24) |
			((uint32_t)input[11] << 16) |
			((uint32_t)input[12] << 8) |
			((uint32_t)(input[13] & 0x80));
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 105 to 129
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)input[14] << 17) |
			((uint32_t)input[15] << 9) |
			((uint32_t)(input[16] & 0xc0) << 1);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 130 to 154
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)input[17] << 18) |
			((uint32_t)input[18] << 10) |
			((uint32_t)(input[19] & 0xe0) << 2);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 155 to 179
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)input[20] << 19) |
			((uint32_t)input[21] << 11) |
			((uint32_t)(input[22] & 0xf0) << 3);
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 205 to 229
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)input[26] << 21) |
			((uint32_t)input[27] << 13) |
			((uint32_t)(input[28] & 0xfc) << 5);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 230 to 254
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)input[29] << 22) |
			((uint32_t)input[30] << 14) |
			((uint32_t)(input[31] & 0xfe) << 6);
	output[9] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

	// read output[3]: from bit 80 to 104
	value = ((uint32_t)input[10] << 24) |
			((uint32_t)input[11] << 16) |
			((uint32_t)input[12] << 8) |
			((uint32_t)(input[13] & 0x80));
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 105 to 129
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)input[14] << 17) |
			((uint32_t)input[15] << 9) |
			((uint32_t)(input[16] & 0xc0) << 1);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 130 to 154
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)input[17] << 18) |
			((uint32_t)input[18] << 10) |
			((uint32_t)(input[19] & 0xe0) << 2);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 155 to 179
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)input[20] << 19) |
			((uint32_t)input[21] << 11) |
			((uint32_t)(input[22] & 0xf0) << 3);
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 205 to 229
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)input[26] << 21) |
			((uint32_t)input[27] << 13) |
			((uint32_t)(input[28] & 0xfc) << 5);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 230 to 254
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)input[29] << 22) |
			((uint32_t)input[30] << 14) |
			((uint32_t)(input[31] & 0xfe) << 6);
	output[9] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

	// read output[3]: from bit 81 to 105
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)input[11] << 17) |
			((uint32_t)input[12] << 9) |
			((uint32_t)(input[13] & 0xc0) << 1);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 106 to 130
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)input[14] << 18) |
			((uint32_t)input[15] << 10) |
			((uint32_t)(input[16] & 0xe0) << 2);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 131 to 155
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)input[17] << 19) |
			((uint32_t)input[18] << 11) |
			((uint32_t)(input[19] & 0xf0) << 3);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 156 to 180
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)input[20] << 20) |
			((uint32_t)input[21] << 12) |
			((uint32_t)(input[22] & 0xf8) << 4);
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 206 to 230
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)input[26] << 22) |
			((uint32_t)input[27] << 14) |
			((uint32_t)(input[28] & 0xfe) << 6);
	output[8] = (double)(value >> 7);

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

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

	uint32_t value;

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

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

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

	// read output[3]: from bit 81 to 105
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)input[11] << 17) |
			((uint32_t)input[12] << 9) |
			((uint32_t)(input[13] & 0xc0) << 1);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 106 to 130
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)input[14] << 18) |
			((uint32_t)input[15] << 10) |
			((uint32_t)(input[16] & 0xe0) << 2);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 131 to 155
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)input[17] << 19) |
			((uint32_t)input[18] << 11) |
			((uint32_t)(input[19] & 0xf0) << 3);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 156 to 180
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)input[20] << 20) |
			((uint32_t)input[21] << 12) |
			((uint32_t)(input[22] & 0xf8) << 4);
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 206 to 230
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)input[26] << 22) |
			((uint32_t)input[27] << 14) |
			((uint32_t)(input[28] & 0xfe) << 6);
	output[8] = (double)(value >> 7);

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

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

	int32_t value;

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

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

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

	// read output[3]: from bit 82 to 106
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)input[11] << 18) |
			((uint32_t)input[12] << 10) |
			((uint32_t)(input[13] & 0xe0) << 2);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 107 to 131
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)input[14] << 19) |
			((uint32_t)input[15] << 11) |
			((uint32_t)(input[16] & 0xf0) << 3);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 132 to 156
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)input[17] << 20) |
			((uint32_t)input[18] << 12) |
			((uint32_t)(input[19] & 0xf8) << 4);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 157 to 181
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)input[20] << 21) |
			((uint32_t)input[21] << 13) |
			((uint32_t)(input[22] & 0xfc) << 5);
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 207 to 231
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)input[28] << 7);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 232 to 256
	value = ((uint32_t)input[29] << 24) |
			((uint32_t)input[30] << 16) |
			((uint32_t)input[31] << 8) |
			((uint32_t)(input[32] & 0x80));
	output[9] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

	// read output[3]: from bit 82 to 106
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)input[11] << 18) |
			((uint32_t)input[12] << 10) |
			((uint32_t)(input[13] & 0xe0) << 2);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 107 to 131
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)input[14] << 19) |
			((uint32_t)input[15] << 11) |
			((uint32_t)(input[16] & 0xf0) << 3);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 132 to 156
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)input[17] << 20) |
			((uint32_t)input[18] << 12) |
			((uint32_t)(input[19] & 0xf8) << 4);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 157 to 181
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)input[20] << 21) |
			((uint32_t)input[21] << 13) |
			((uint32_t)(input[22] & 0xfc) << 5);
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 207 to 231
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)input[28] << 7);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 232 to 256
	value = ((uint32_t)input[29] << 24) |
			((uint32_t)input[30] << 16) |
			((uint32_t)input[31] << 8) |
			((uint32_t)(input[32] & 0x80));
	output[9] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

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

	// read output[4]: from bit 100 to 124
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)input[13] << 20) |
			((uint32_t)input[14] << 12) |
			((uint32_t)(input[15] & 0xf8) << 4);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 125 to 149
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)input[16] << 21) |
			((uint32_t)input[17] << 13) |
			((uint32_t)(input[18] & 0xfc) << 5);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 150 to 174
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)input[19] << 22) |
			((uint32_t)input[20] << 14) |
			((uint32_t)(input[21] & 0xfe) << 6);
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 200 to 224
	value = ((uint32_t)input[25] << 24) |
			((uint32_t)input[26] << 16) |
			((uint32_t)input[27] << 8) |
			((uint32_t)(input[28] & 0x80));
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 225 to 249
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)input[29] << 17) |
			((uint32_t)input[30] << 9) |
			((uint32_t)(input[31] & 0xc0) << 1);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 250 to 274
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)input[32] << 18) |
			((uint32_t)input[33] << 10) |
			((uint32_t)(input[34] & 0xe0) << 2);
	output[10] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

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

	// read output[4]: from bit 100 to 124
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)input[13] << 20) |
			((uint32_t)input[14] << 12) |
			((uint32_t)(input[15] & 0xf8) << 4);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 125 to 149
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)input[16] << 21) |
			((uint32_t)input[17] << 13) |
			((uint32_t)(input[18] & 0xfc) << 5);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 150 to 174
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)input[19] << 22) |
			((uint32_t)input[20] << 14) |
			((uint32_t)(input[21] & 0xfe) << 6);
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 200 to 224
	value = ((uint32_t)input[25] << 24) |
			((uint32_t)input[26] << 16) |
			((uint32_t)input[27] << 8) |
			((uint32_t)(input[28] & 0x80));
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 225 to 249
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)input[29] << 17) |
			((uint32_t)input[30] << 9) |
			((uint32_t)(input[31] & 0xc0) << 1);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 250 to 274
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)input[32] << 18) |
			((uint32_t)input[33] << 10) |
			((uint32_t)(input[34] & 0xe0) << 2);
	output[10] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

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

	// read output[4]: from bit 101 to 125
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)input[13] << 21) |
			((uint32_t)input[14] << 13) |
			((uint32_t)(input[15] & 0xfc) << 5);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 126 to 150
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)input[16] << 22) |
			((uint32_t)input[17] << 14) |
			((uint32_t)(input[18] & 0xfe) << 6);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 151 to 175
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)input[19] << 23) |
			((uint32_t)input[20] << 15) |
			((uint32_t)input[21] << 7);
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 201 to 225
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)input[26] << 17) |
			((uint32_t)input[27] << 9) |
			((uint32_t)(input[28] & 0xc0) << 1);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 226 to 250
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)input[29] << 18) |
			((uint32_t)input[30] << 10) |
			((uint32_t)(input[31] & 0xe0) << 2);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 251 to 275
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)input[32] << 19) |
			((uint32_t)input[33] << 11) |
			((uint32_t)(input[34] & 0xf0) << 3);
	output[10] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

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

	// read output[4]: from bit 101 to 125
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)input[13] << 21) |
			((uint32_t)input[14] << 13) |
			((uint32_t)(input[15] & 0xfc) << 5);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 126 to 150
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)input[16] << 22) |
			((uint32_t)input[17] << 14) |
			((uint32_t)(input[18] & 0xfe) << 6);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 151 to 175
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)input[19] << 23) |
			((uint32_t)input[20] << 15) |
			((uint32_t)input[21] << 7);
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 201 to 225
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)input[26] << 17) |
			((uint32_t)input[27] << 9) |
			((uint32_t)(input[28] & 0xc0) << 1);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 226 to 250
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)input[29] << 18) |
			((uint32_t)input[30] << 10) |
			((uint32_t)(input[31] & 0xe0) << 2);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 251 to 275
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)input[32] << 19) |
			((uint32_t)input[33] << 11) |
			((uint32_t)(input[34] & 0xf0) << 3);
	output[10] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

	// read output[3]: from bit 77 to 101
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)input[10] << 21) |
			((uint32_t)input[11] << 13) |
			((uint32_t)(input[12] & 0xfc) << 5);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 102 to 126
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)input[13] << 22) |
			((uint32_t)input[14] << 14) |
			((uint32_t)(input[15] & 0xfe) << 6);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 127 to 151
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)input[16] << 23) |
			((uint32_t)input[17] << 15) |
			((uint32_t)input[18] << 7);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 152 to 176
	value = ((uint32_t)input[19] << 24) |
			((uint32_t)input[20] << 16) |
			((uint32_t)input[21] << 8) |
			((uint32_t)(input[22] & 0x80));
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 202 to 226
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)input[26] << 18) |
			((uint32_t)input[27] << 10) |
			((uint32_t)(input[28] & 0xe0) << 2);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 227 to 251
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)input[29] << 19) |
			((uint32_t)input[30] << 11) |
			((uint32_t)(input[31] & 0xf0) << 3);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 252 to 276
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)input[32] << 20) |
			((uint32_t)input[33] << 12) |
			((uint32_t)(input[34] & 0xf8) << 4);
	output[10] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

	// read output[3]: from bit 77 to 101
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)input[10] << 21) |
			((uint32_t)input[11] << 13) |
			((uint32_t)(input[12] & 0xfc) << 5);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 102 to 126
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)input[13] << 22) |
			((uint32_t)input[14] << 14) |
			((uint32_t)(input[15] & 0xfe) << 6);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 127 to 151
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)input[16] << 23) |
			((uint32_t)input[17] << 15) |
			((uint32_t)input[18] << 7);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 152 to 176
	value = ((uint32_t)input[19] << 24) |
			((uint32_t)input[20] << 16) |
			((uint32_t)input[21] << 8) |
			((uint32_t)(input[22] & 0x80));
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 202 to 226
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)input[26] << 18) |
			((uint32_t)input[27] << 10) |
			((uint32_t)(input[28] & 0xe0) << 2);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 227 to 251
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)input[29] << 19) |
			((uint32_t)input[30] << 11) |
			((uint32_t)(input[31] & 0xf0) << 3);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 252 to 276
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)input[32] << 20) |
			((uint32_t)input[33] << 12) |
			((uint32_t)(input[34] & 0xf8) << 4);
	output[10] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

	// read output[3]: from bit 78 to 102
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)input[10] << 22) |
			((uint32_t)input[11] << 14) |
			((uint32_t)(input[12] & 0xfe) << 6);
	output[3] = (double)(value >> 7);

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

	// read output[5]: from bit 128 to 152
	value = ((uint32_t)input[16] << 24) |
			((uint32_t)input[17] << 16) |
			((uint32_t)input[18] << 8) |
			((uint32_t)(input[19] & 0x80));
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 153 to 177
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)input[20] << 17) |
			((uint32_t)input[21] << 9) |
			((uint32_t)(input[22] & 0xc0) << 1);
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 203 to 227
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)input[26] << 19) |
			((uint32_t)input[27] << 11) |
			((uint32_t)(input[28] & 0xf0) << 3);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 228 to 252
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)input[29] << 20) |
			((uint32_t)input[30] << 12) |
			((uint32_t)(input[31] & 0xf8) << 4);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 253 to 277
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)input[32] << 21) |
			((uint32_t)input[33] << 13) |
			((uint32_t)(input[34] & 0xfc) << 5);
	output[10] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

	// read output[3]: from bit 78 to 102
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)input[10] << 22) |
			((uint32_t)input[11] << 14) |
			((uint32_t)(input[12] & 0xfe) << 6);
	output[3] = (double)(value >> 7);

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

	// read output[5]: from bit 128 to 152
	value = ((uint32_t)input[16] << 24) |
			((uint32_t)input[17] << 16) |
			((uint32_t)input[18] << 8) |
			((uint32_t)(input[19] & 0x80));
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 153 to 177
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)input[20] << 17) |
			((uint32_t)input[21] << 9) |
			((uint32_t)(input[22] & 0xc0) << 1);
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 203 to 227
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)input[26] << 19) |
			((uint32_t)input[27] << 11) |
			((uint32_t)(input[28] & 0xf0) << 3);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 228 to 252
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)input[29] << 20) |
			((uint32_t)input[30] << 12) |
			((uint32_t)(input[31] & 0xf8) << 4);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 253 to 277
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)input[32] << 21) |
			((uint32_t)input[33] << 13) |
			((uint32_t)(input[34] & 0xfc) << 5);
	output[10] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

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

	// read output[4]: from bit 104 to 128
	value = ((uint32_t)input[13] << 24) |
			((uint32_t)input[14] << 16) |
			((uint32_t)input[15] << 8) |
			((uint32_t)(input[16] & 0x80));
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 129 to 153
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)input[17] << 17) |
			((uint32_t)input[18] << 9) |
			((uint32_t)(input[19] & 0xc0) << 1);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 154 to 178
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)input[20] << 18) |
			((uint32_t)input[21] << 10) |
			((uint32_t)(input[22] & 0xe0) << 2);
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 204 to 228
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)input[26] << 20) |
			((uint32_t)input[27] << 12) |
			((uint32_t)(input[28] & 0xf8) << 4);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 229 to 253
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)input[29] << 21) |
			((uint32_t)input[30] << 13) |
			((uint32_t)(input[31] & 0xfc) << 5);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 254 to 278
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)input[32] << 22) |
			((uint32_t)input[33] << 14) |
			((uint32_t)(input[34] & 0xfe) << 6);
	output[10] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

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

	// read output[4]: from bit 104 to 128
	value = ((uint32_t)input[13] << 24) |
			((uint32_t)input[14] << 16) |
			((uint32_t)input[15] << 8) |
			((uint32_t)(input[16] & 0x80));
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 129 to 153
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)input[17] << 17) |
			((uint32_t)input[18] << 9) |
			((uint32_t)(input[19] & 0xc0) << 1);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 154 to 178
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)input[20] << 18) |
			((uint32_t)input[21] << 10) |
			((uint32_t)(input[22] & 0xe0) << 2);
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 204 to 228
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)input[26] << 20) |
			((uint32_t)input[27] << 12) |
			((uint32_t)(input[28] & 0xf8) << 4);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 229 to 253
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)input[29] << 21) |
			((uint32_t)input[30] << 13) |
			((uint32_t)(input[31] & 0xfc) << 5);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 254 to 278
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)input[32] << 22) |
			((uint32_t)input[33] << 14) |
			((uint32_t)(input[34] & 0xfe) << 6);
	output[10] = (double)(value >> 7);
}

static void unpack_11_25bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 11 values into output
	// Values are 25-bit signed
	// Skip 5 bits, read 275 bits of data.
	// Input must be at least 35 bytes long

	int32_t value;

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

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

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

	// read output[3]: from bit 80 to 104
	value = ((uint32_t)input[10] << 24) |
			((uint32_t)input[11] << 16) |
			((uint32_t)input[12] << 8) |
			((uint32_t)(input[13] & 0x80));
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 105 to 129
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)input[14] << 17) |
			((uint32_t)input[15] << 9) |
			((uint32_t)(input[16] & 0xc0) << 1);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 130 to 154
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)input[17] << 18) |
			((uint32_t)input[18] << 10) |
			((uint32_t)(input[19] & 0xe0) << 2);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 155 to 179
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)input[20] << 19) |
			((uint32_t)input[21] << 11) |
			((uint32_t)(input[22] & 0xf0) << 3);
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 205 to 229
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)input[26] << 21) |
			((uint32_t)input[27] << 13) |
			((uint32_t)(input[28] & 0xfc) << 5);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 230 to 254
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)input[29] << 22) |
			((uint32_t)input[30] << 14) |
			((uint32_t)(input[31] & 0xfe) << 6);
	output[9] = (double)(value >> 7);

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

static void unpack_11_25bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 11 values into output
	// Values are 25-bit unsigned
	// Skip 5 bits, read 275 bits of data.
	// Input must be at least 35 bytes long

	uint32_t value;

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

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

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

	// read output[3]: from bit 80 to 104
	value = ((uint32_t)input[10] << 24) |
			((uint32_t)input[11] << 16) |
			((uint32_t)input[12] << 8) |
			((uint32_t)(input[13] & 0x80));
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 105 to 129
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)input[14] << 17) |
			((uint32_t)input[15] << 9) |
			((uint32_t)(input[16] & 0xc0) << 1);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 130 to 154
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)input[17] << 18) |
			((uint32_t)input[18] << 10) |
			((uint32_t)(input[19] & 0xe0) << 2);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 155 to 179
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)input[20] << 19) |
			((uint32_t)input[21] << 11) |
			((uint32_t)(input[22] & 0xf0) << 3);
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 205 to 229
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)input[26] << 21) |
			((uint32_t)input[27] << 13) |
			((uint32_t)(input[28] & 0xfc) << 5);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 230 to 254
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)input[29] << 22) |
			((uint32_t)input[30] << 14) |
			((uint32_t)(input[31] & 0xfe) << 6);
	output[9] = (double)(value >> 7);

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

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

	int32_t value;

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

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

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

	// read output[3]: from bit 81 to 105
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)input[11] << 17) |
			((uint32_t)input[12] << 9) |
			((uint32_t)(input[13] & 0xc0) << 1);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 106 to 130
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)input[14] << 18) |
			((uint32_t)input[15] << 10) |
			((uint32_t)(input[16] & 0xe0) << 2);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 131 to 155
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)input[17] << 19) |
			((uint32_t)input[18] << 11) |
			((uint32_t)(input[19] & 0xf0) << 3);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 156 to 180
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)input[20] << 20) |
			((uint32_t)input[21] << 12) |
			((uint32_t)(input[22] & 0xf8) << 4);
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 206 to 230
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)input[26] << 22) |
			((uint32_t)input[27] << 14) |
			((uint32_t)(input[28] & 0xfe) << 6);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 231 to 255
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)input[29] << 23) |
			((uint32_t)input[30] << 15) |
			((uint32_t)input[31] << 7);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 256 to 280
	value = ((uint32_t)input[32] << 24) |
			((uint32_t)input[33] << 16) |
			((uint32_t)input[34] << 8) |
			((uint32_t)(input[35] & 0x80));
	output[10] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

	// read output[3]: from bit 81 to 105
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)input[11] << 17) |
			((uint32_t)input[12] << 9) |
			((uint32_t)(input[13] & 0xc0) << 1);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 106 to 130
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)input[14] << 18) |
			((uint32_t)input[15] << 10) |
			((uint32_t)(input[16] & 0xe0) << 2);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 131 to 155
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)input[17] << 19) |
			((uint32_t)input[18] << 11) |
			((uint32_t)(input[19] & 0xf0) << 3);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 156 to 180
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)input[20] << 20) |
			((uint32_t)input[21] << 12) |
			((uint32_t)(input[22] & 0xf8) << 4);
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 206 to 230
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)input[26] << 22) |
			((uint32_t)input[27] << 14) |
			((uint32_t)(input[28] & 0xfe) << 6);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 231 to 255
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)input[29] << 23) |
			((uint32_t)input[30] << 15) |
			((uint32_t)input[31] << 7);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 256 to 280
	value = ((uint32_t)input[32] << 24) |
			((uint32_t)input[33] << 16) |
			((uint32_t)input[34] << 8) |
			((uint32_t)(input[35] & 0x80));
	output[10] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

	// read output[3]: from bit 82 to 106
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)input[11] << 18) |
			((uint32_t)input[12] << 10) |
			((uint32_t)(input[13] & 0xe0) << 2);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 107 to 131
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)input[14] << 19) |
			((uint32_t)input[15] << 11) |
			((uint32_t)(input[16] & 0xf0) << 3);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 132 to 156
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)input[17] << 20) |
			((uint32_t)input[18] << 12) |
			((uint32_t)(input[19] & 0xf8) << 4);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 157 to 181
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)input[20] << 21) |
			((uint32_t)input[21] << 13) |
			((uint32_t)(input[22] & 0xfc) << 5);
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 207 to 231
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)input[28] << 7);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 232 to 256
	value = ((uint32_t)input[29] << 24) |
			((uint32_t)input[30] << 16) |
			((uint32_t)input[31] << 8) |
			((uint32_t)(input[32] & 0x80));
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 257 to 281
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)input[33] << 17) |
			((uint32_t)input[34] << 9) |
			((uint32_t)(input[35] & 0xc0) << 1);
	output[10] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

	// read output[3]: from bit 82 to 106
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)input[11] << 18) |
			((uint32_t)input[12] << 10) |
			((uint32_t)(input[13] & 0xe0) << 2);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 107 to 131
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)input[14] << 19) |
			((uint32_t)input[15] << 11) |
			((uint32_t)(input[16] & 0xf0) << 3);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 132 to 156
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)input[17] << 20) |
			((uint32_t)input[18] << 12) |
			((uint32_t)(input[19] & 0xf8) << 4);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 157 to 181
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)input[20] << 21) |
			((uint32_t)input[21] << 13) |
			((uint32_t)(input[22] & 0xfc) << 5);
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 207 to 231
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)input[28] << 7);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 232 to 256
	value = ((uint32_t)input[29] << 24) |
			((uint32_t)input[30] << 16) |
			((uint32_t)input[31] << 8) |
			((uint32_t)(input[32] & 0x80));
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 257 to 281
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)input[33] << 17) |
			((uint32_t)input[34] << 9) |
			((uint32_t)(input[35] & 0xc0) << 1);
	output[10] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

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

	// read output[4]: from bit 100 to 124
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)input[13] << 20) |
			((uint32_t)input[14] << 12) |
			((uint32_t)(input[15] & 0xf8) << 4);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 125 to 149
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)input[16] << 21) |
			((uint32_t)input[17] << 13) |
			((uint32_t)(input[18] & 0xfc) << 5);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 150 to 174
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)input[19] << 22) |
			((uint32_t)input[20] << 14) |
			((uint32_t)(input[21] & 0xfe) << 6);
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 200 to 224
	value = ((uint32_t)input[25] << 24) |
			((uint32_t)input[26] << 16) |
			((uint32_t)input[27] << 8) |
			((uint32_t)(input[28] & 0x80));
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 225 to 249
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)input[29] << 17) |
			((uint32_t)input[30] << 9) |
			((uint32_t)(input[31] & 0xc0) << 1);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 250 to 274
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)input[32] << 18) |
			((uint32_t)input[33] << 10) |
			((uint32_t)(input[34] & 0xe0) << 2);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 275 to 299
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)input[35] << 19) |
			((uint32_t)input[36] << 11) |
			((uint32_t)(input[37] & 0xf0) << 3);
	output[11] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

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

	// read output[4]: from bit 100 to 124
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)input[13] << 20) |
			((uint32_t)input[14] << 12) |
			((uint32_t)(input[15] & 0xf8) << 4);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 125 to 149
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)input[16] << 21) |
			((uint32_t)input[17] << 13) |
			((uint32_t)(input[18] & 0xfc) << 5);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 150 to 174
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)input[19] << 22) |
			((uint32_t)input[20] << 14) |
			((uint32_t)(input[21] & 0xfe) << 6);
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 200 to 224
	value = ((uint32_t)input[25] << 24) |
			((uint32_t)input[26] << 16) |
			((uint32_t)input[27] << 8) |
			((uint32_t)(input[28] & 0x80));
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 225 to 249
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)input[29] << 17) |
			((uint32_t)input[30] << 9) |
			((uint32_t)(input[31] & 0xc0) << 1);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 250 to 274
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)input[32] << 18) |
			((uint32_t)input[33] << 10) |
			((uint32_t)(input[34] & 0xe0) << 2);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 275 to 299
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)input[35] << 19) |
			((uint32_t)input[36] << 11) |
			((uint32_t)(input[37] & 0xf0) << 3);
	output[11] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

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

	// read output[4]: from bit 101 to 125
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)input[13] << 21) |
			((uint32_t)input[14] << 13) |
			((uint32_t)(input[15] & 0xfc) << 5);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 126 to 150
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)input[16] << 22) |
			((uint32_t)input[17] << 14) |
			((uint32_t)(input[18] & 0xfe) << 6);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 151 to 175
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)input[19] << 23) |
			((uint32_t)input[20] << 15) |
			((uint32_t)input[21] << 7);
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 201 to 225
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)input[26] << 17) |
			((uint32_t)input[27] << 9) |
			((uint32_t)(input[28] & 0xc0) << 1);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 226 to 250
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)input[29] << 18) |
			((uint32_t)input[30] << 10) |
			((uint32_t)(input[31] & 0xe0) << 2);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 251 to 275
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)input[32] << 19) |
			((uint32_t)input[33] << 11) |
			((uint32_t)(input[34] & 0xf0) << 3);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 276 to 300
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)input[35] << 20) |
			((uint32_t)input[36] << 12) |
			((uint32_t)(input[37] & 0xf8) << 4);
	output[11] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

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

	// read output[4]: from bit 101 to 125
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)input[13] << 21) |
			((uint32_t)input[14] << 13) |
			((uint32_t)(input[15] & 0xfc) << 5);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 126 to 150
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)input[16] << 22) |
			((uint32_t)input[17] << 14) |
			((uint32_t)(input[18] & 0xfe) << 6);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 151 to 175
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)input[19] << 23) |
			((uint32_t)input[20] << 15) |
			((uint32_t)input[21] << 7);
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 201 to 225
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)input[26] << 17) |
			((uint32_t)input[27] << 9) |
			((uint32_t)(input[28] & 0xc0) << 1);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 226 to 250
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)input[29] << 18) |
			((uint32_t)input[30] << 10) |
			((uint32_t)(input[31] & 0xe0) << 2);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 251 to 275
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)input[32] << 19) |
			((uint32_t)input[33] << 11) |
			((uint32_t)(input[34] & 0xf0) << 3);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 276 to 300
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)input[35] << 20) |
			((uint32_t)input[36] << 12) |
			((uint32_t)(input[37] & 0xf8) << 4);
	output[11] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

	// read output[3]: from bit 77 to 101
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)input[10] << 21) |
			((uint32_t)input[11] << 13) |
			((uint32_t)(input[12] & 0xfc) << 5);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 102 to 126
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)input[13] << 22) |
			((uint32_t)input[14] << 14) |
			((uint32_t)(input[15] & 0xfe) << 6);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 127 to 151
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)input[16] << 23) |
			((uint32_t)input[17] << 15) |
			((uint32_t)input[18] << 7);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 152 to 176
	value = ((uint32_t)input[19] << 24) |
			((uint32_t)input[20] << 16) |
			((uint32_t)input[21] << 8) |
			((uint32_t)(input[22] & 0x80));
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 202 to 226
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)input[26] << 18) |
			((uint32_t)input[27] << 10) |
			((uint32_t)(input[28] & 0xe0) << 2);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 227 to 251
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)input[29] << 19) |
			((uint32_t)input[30] << 11) |
			((uint32_t)(input[31] & 0xf0) << 3);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 252 to 276
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)input[32] << 20) |
			((uint32_t)input[33] << 12) |
			((uint32_t)(input[34] & 0xf8) << 4);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 277 to 301
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)input[35] << 21) |
			((uint32_t)input[36] << 13) |
			((uint32_t)(input[37] & 0xfc) << 5);
	output[11] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

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

	// read output[3]: from bit 77 to 101
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)input[10] << 21) |
			((uint32_t)input[11] << 13) |
			((uint32_t)(input[12] & 0xfc) << 5);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 102 to 126
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)input[13] << 22) |
			((uint32_t)input[14] << 14) |
			((uint32_t)(input[15] & 0xfe) << 6);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 127 to 151
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)input[16] << 23) |
			((uint32_t)input[17] << 15) |
			((uint32_t)input[18] << 7);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 152 to 176
	value = ((uint32_t)input[19] << 24) |
			((uint32_t)input[20] << 16) |
			((uint32_t)input[21] << 8) |
			((uint32_t)(input[22] & 0x80));
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 202 to 226
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)input[26] << 18) |
			((uint32_t)input[27] << 10) |
			((uint32_t)(input[28] & 0xe0) << 2);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 227 to 251
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)input[29] << 19) |
			((uint32_t)input[30] << 11) |
			((uint32_t)(input[31] & 0xf0) << 3);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 252 to 276
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)input[32] << 20) |
			((uint32_t)input[33] << 12) |
			((uint32_t)(input[34] & 0xf8) << 4);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 277 to 301
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)input[35] << 21) |
			((uint32_t)input[36] << 13) |
			((uint32_t)(input[37] & 0xfc) << 5);
	output[11] = (double)(value >> 7);
}

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

	int32_t value;

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

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

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

	// read output[3]: from bit 78 to 102
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)input[10] << 22) |
			((uint32_t)input[11] << 14) |
			((uint32_t)(input[12] & 0xfe) << 6);
	output[3] = (double)(value >> 7);

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

	// read output[5]: from bit 128 to 152
	value = ((uint32_t)input[16] << 24) |
			((uint32_t)input[17] << 16) |
			((uint32_t)input[18] << 8) |
			((uint32_t)(input[19] & 0x80));
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 153 to 177
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)input[20] << 17) |
			((uint32_t)input[21] << 9) |
			((uint32_t)(input[22] & 0xc0) << 1);
	output[6] = (double)(value >> 7);

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

	// read output[8]: from bit 203 to 227
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)input[26] << 19) |
			((uint32_t)input[27] << 11) |
			((uint32_t)(input[28] & 0xf0) << 3);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 228 to 252
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)input[29] << 20) |
			((uint32_t)input[30] << 12) |
			((uint32_t)(input[31] & 0xf8) << 4);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 253 to 277
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)input[32] << 21) |
			((uint32_t)input[33] << 13) |
			((uint32_t)(input[34] & 0xfc) << 5);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 278 to 302
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)input[35] << 22) |
			((uint32_t)input[36] << 14) |
			((uint32_t)(input[37] & 0xfe) << 6);
	output[11] = (double)(value >> 7);
}

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

	uint32_t value;

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

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

	// read output[2]: from bit 53 to 77
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xfc) << 5);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 78 to 102
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)input[10] << 22) |
			((uint32_t)input[11] << 14) |
			((uint32_t)(input[12] & 0xfe) << 6);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 103 to 127
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)input[13] << 23) |
			((uint32_t)input[14] << 15) |
			((uint32_t)input[15] << 7);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 128 to 152
	value = ((uint32_t)input[16] << 24) |
			((uint32_t)input[17] << 16) |
			((uint32_t)input[18] << 8) |
			((uint32_t)(input[19] & 0x80));
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 153 to 177
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)input[20] << 17) |
			((uint32_t)input[21] << 9) |
			((uint32_t)(input[22] & 0xc0) << 1);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 178 to 202
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)input[23] << 18) |
			((uint32_t)input[24] << 10) |
			((uint32_t)(input[25] & 0xe0) << 2);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 203 to 227
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)input[26] << 19) |
			((uint32_t)input[27] << 11) |
			((uint32_t)(input[28] & 0xf0) << 3);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 228 to 252
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)input[29] << 20) |
			((uint32_t)input[30] << 12) |
			((uint32_t)(input[31] & 0xf8) << 4);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 253 to 277
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)input[32] << 21) |
			((uint32_t)input[33] << 13) |
			((uint32_t)(input[34] & 0xfc) << 5);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 278 to 302
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)input[35] << 22) |
			((uint32_t)input[36] << 14) |
			((uint32_t)(input[37] & 0xfe) << 6);
	output[11] = (double)(value >> 7);
}

static void unpack_12_25bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 12 values into output
	// Values are 25-bit signed
	// Skip 4 bits, read 300 bits of data.
	// Input must be at least 38 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 28
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)input[1] << 20) |
			((uint32_t)input[2] << 12) |
			((uint32_t)(input[3] & 0xf8) << 4);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 29 to 53
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xfc) << 5);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 54 to 78
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)input[7] << 22) |
			((uint32_t)input[8] << 14) |
			((uint32_t)(input[9] & 0xfe) << 6);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 79 to 103
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)input[10] << 23) |
			((uint32_t)input[11] << 15) |
			((uint32_t)input[12] << 7);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 104 to 128
	value = ((uint32_t)input[13] << 24) |
			((uint32_t)input[14] << 16) |
			((uint32_t)input[15] << 8) |
			((uint32_t)(input[16] & 0x80));
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 129 to 153
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)input[17] << 17) |
			((uint32_t)input[18] << 9) |
			((uint32_t)(input[19] & 0xc0) << 1);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 154 to 178
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)input[20] << 18) |
			((uint32_t)input[21] << 10) |
			((uint32_t)(input[22] & 0xe0) << 2);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 179 to 203
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)input[23] << 19) |
			((uint32_t)input[24] << 11) |
			((uint32_t)(input[25] & 0xf0) << 3);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 204 to 228
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)input[26] << 20) |
			((uint32_t)input[27] << 12) |
			((uint32_t)(input[28] & 0xf8) << 4);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 229 to 253
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)input[29] << 21) |
			((uint32_t)input[30] << 13) |
			((uint32_t)(input[31] & 0xfc) << 5);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 254 to 278
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)input[32] << 22) |
			((uint32_t)input[33] << 14) |
			((uint32_t)(input[34] & 0xfe) << 6);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 279 to 303
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)input[35] << 23) |
			((uint32_t)input[36] << 15) |
			((uint32_t)input[37] << 7);
	output[11] = (double)(value >> 7);
}

static void unpack_12_25bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 12 values into output
	// Values are 25-bit unsigned
	// Skip 4 bits, read 300 bits of data.
	// Input must be at least 38 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 28
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)input[1] << 20) |
			((uint32_t)input[2] << 12) |
			((uint32_t)(input[3] & 0xf8) << 4);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 29 to 53
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xfc) << 5);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 54 to 78
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)input[7] << 22) |
			((uint32_t)input[8] << 14) |
			((uint32_t)(input[9] & 0xfe) << 6);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 79 to 103
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)input[10] << 23) |
			((uint32_t)input[11] << 15) |
			((uint32_t)input[12] << 7);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 104 to 128
	value = ((uint32_t)input[13] << 24) |
			((uint32_t)input[14] << 16) |
			((uint32_t)input[15] << 8) |
			((uint32_t)(input[16] & 0x80));
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 129 to 153
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)input[17] << 17) |
			((uint32_t)input[18] << 9) |
			((uint32_t)(input[19] & 0xc0) << 1);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 154 to 178
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)input[20] << 18) |
			((uint32_t)input[21] << 10) |
			((uint32_t)(input[22] & 0xe0) << 2);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 179 to 203
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)input[23] << 19) |
			((uint32_t)input[24] << 11) |
			((uint32_t)(input[25] & 0xf0) << 3);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 204 to 228
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)input[26] << 20) |
			((uint32_t)input[27] << 12) |
			((uint32_t)(input[28] & 0xf8) << 4);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 229 to 253
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)input[29] << 21) |
			((uint32_t)input[30] << 13) |
			((uint32_t)(input[31] & 0xfc) << 5);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 254 to 278
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)input[32] << 22) |
			((uint32_t)input[33] << 14) |
			((uint32_t)(input[34] & 0xfe) << 6);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 279 to 303
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)input[35] << 23) |
			((uint32_t)input[36] << 15) |
			((uint32_t)input[37] << 7);
	output[11] = (double)(value >> 7);
}

static void unpack_12_25bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 12 values into output
	// Values are 25-bit signed
	// Skip 5 bits, read 300 bits of data.
	// Input must be at least 39 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 29
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)input[1] << 21) |
			((uint32_t)input[2] << 13) |
			((uint32_t)(input[3] & 0xfc) << 5);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 30 to 54
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xfe) << 6);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 55 to 79
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)input[7] << 23) |
			((uint32_t)input[8] << 15) |
			((uint32_t)input[9] << 7);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 80 to 104
	value = ((uint32_t)input[10] << 24) |
			((uint32_t)input[11] << 16) |
			((uint32_t)input[12] << 8) |
			((uint32_t)(input[13] & 0x80));
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 105 to 129
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)input[14] << 17) |
			((uint32_t)input[15] << 9) |
			((uint32_t)(input[16] & 0xc0) << 1);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 130 to 154
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)input[17] << 18) |
			((uint32_t)input[18] << 10) |
			((uint32_t)(input[19] & 0xe0) << 2);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 155 to 179
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)input[20] << 19) |
			((uint32_t)input[21] << 11) |
			((uint32_t)(input[22] & 0xf0) << 3);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 180 to 204
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)input[23] << 20) |
			((uint32_t)input[24] << 12) |
			((uint32_t)(input[25] & 0xf8) << 4);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 205 to 229
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)input[26] << 21) |
			((uint32_t)input[27] << 13) |
			((uint32_t)(input[28] & 0xfc) << 5);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 230 to 254
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)input[29] << 22) |
			((uint32_t)input[30] << 14) |
			((uint32_t)(input[31] & 0xfe) << 6);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 255 to 279
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)input[32] << 23) |
			((uint32_t)input[33] << 15) |
			((uint32_t)input[34] << 7);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 280 to 304
	value = ((uint32_t)input[35] << 24) |
			((uint32_t)input[36] << 16) |
			((uint32_t)input[37] << 8) |
			((uint32_t)(input[38] & 0x80));
	output[11] = (double)(value >> 7);
}

static void unpack_12_25bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 12 values into output
	// Values are 25-bit unsigned
	// Skip 5 bits, read 300 bits of data.
	// Input must be at least 39 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 29
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)input[1] << 21) |
			((uint32_t)input[2] << 13) |
			((uint32_t)(input[3] & 0xfc) << 5);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 30 to 54
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xfe) << 6);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 55 to 79
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)input[7] << 23) |
			((uint32_t)input[8] << 15) |
			((uint32_t)input[9] << 7);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 80 to 104
	value = ((uint32_t)input[10] << 24) |
			((uint32_t)input[11] << 16) |
			((uint32_t)input[12] << 8) |
			((uint32_t)(input[13] & 0x80));
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 105 to 129
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)input[14] << 17) |
			((uint32_t)input[15] << 9) |
			((uint32_t)(input[16] & 0xc0) << 1);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 130 to 154
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)input[17] << 18) |
			((uint32_t)input[18] << 10) |
			((uint32_t)(input[19] & 0xe0) << 2);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 155 to 179
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)input[20] << 19) |
			((uint32_t)input[21] << 11) |
			((uint32_t)(input[22] & 0xf0) << 3);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 180 to 204
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)input[23] << 20) |
			((uint32_t)input[24] << 12) |
			((uint32_t)(input[25] & 0xf8) << 4);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 205 to 229
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)input[26] << 21) |
			((uint32_t)input[27] << 13) |
			((uint32_t)(input[28] & 0xfc) << 5);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 230 to 254
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)input[29] << 22) |
			((uint32_t)input[30] << 14) |
			((uint32_t)(input[31] & 0xfe) << 6);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 255 to 279
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)input[32] << 23) |
			((uint32_t)input[33] << 15) |
			((uint32_t)input[34] << 7);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 280 to 304
	value = ((uint32_t)input[35] << 24) |
			((uint32_t)input[36] << 16) |
			((uint32_t)input[37] << 8) |
			((uint32_t)(input[38] & 0x80));
	output[11] = (double)(value >> 7);
}

static void unpack_12_25bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 12 values into output
	// Values are 25-bit signed
	// Skip 6 bits, read 300 bits of data.
	// Input must be at least 39 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 30
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)input[1] << 22) |
			((uint32_t)input[2] << 14) |
			((uint32_t)(input[3] & 0xfe) << 6);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 31 to 55
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)input[4] << 23) |
			((uint32_t)input[5] << 15) |
			((uint32_t)input[6] << 7);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 56 to 80
	value = ((uint32_t)input[7] << 24) |
			((uint32_t)input[8] << 16) |
			((uint32_t)input[9] << 8) |
			((uint32_t)(input[10] & 0x80));
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 81 to 105
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)input[11] << 17) |
			((uint32_t)input[12] << 9) |
			((uint32_t)(input[13] & 0xc0) << 1);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 106 to 130
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)input[14] << 18) |
			((uint32_t)input[15] << 10) |
			((uint32_t)(input[16] & 0xe0) << 2);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 131 to 155
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)input[17] << 19) |
			((uint32_t)input[18] << 11) |
			((uint32_t)(input[19] & 0xf0) << 3);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 156 to 180
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)input[20] << 20) |
			((uint32_t)input[21] << 12) |
			((uint32_t)(input[22] & 0xf8) << 4);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 181 to 205
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)input[23] << 21) |
			((uint32_t)input[24] << 13) |
			((uint32_t)(input[25] & 0xfc) << 5);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 206 to 230
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)input[26] << 22) |
			((uint32_t)input[27] << 14) |
			((uint32_t)(input[28] & 0xfe) << 6);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 231 to 255
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)input[29] << 23) |
			((uint32_t)input[30] << 15) |
			((uint32_t)input[31] << 7);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 256 to 280
	value = ((uint32_t)input[32] << 24) |
			((uint32_t)input[33] << 16) |
			((uint32_t)input[34] << 8) |
			((uint32_t)(input[35] & 0x80));
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 281 to 305
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)input[36] << 17) |
			((uint32_t)input[37] << 9) |
			((uint32_t)(input[38] & 0xc0) << 1);
	output[11] = (double)(value >> 7);
}

static void unpack_12_25bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 12 values into output
	// Values are 25-bit unsigned
	// Skip 6 bits, read 300 bits of data.
	// Input must be at least 39 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 30
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)input[1] << 22) |
			((uint32_t)input[2] << 14) |
			((uint32_t)(input[3] & 0xfe) << 6);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 31 to 55
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)input[4] << 23) |
			((uint32_t)input[5] << 15) |
			((uint32_t)input[6] << 7);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 56 to 80
	value = ((uint32_t)input[7] << 24) |
			((uint32_t)input[8] << 16) |
			((uint32_t)input[9] << 8) |
			((uint32_t)(input[10] & 0x80));
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 81 to 105
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)input[11] << 17) |
			((uint32_t)input[12] << 9) |
			((uint32_t)(input[13] & 0xc0) << 1);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 106 to 130
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)input[14] << 18) |
			((uint32_t)input[15] << 10) |
			((uint32_t)(input[16] & 0xe0) << 2);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 131 to 155
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)input[17] << 19) |
			((uint32_t)input[18] << 11) |
			((uint32_t)(input[19] & 0xf0) << 3);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 156 to 180
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)input[20] << 20) |
			((uint32_t)input[21] << 12) |
			((uint32_t)(input[22] & 0xf8) << 4);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 181 to 205
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)input[23] << 21) |
			((uint32_t)input[24] << 13) |
			((uint32_t)(input[25] & 0xfc) << 5);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 206 to 230
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)input[26] << 22) |
			((uint32_t)input[27] << 14) |
			((uint32_t)(input[28] & 0xfe) << 6);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 231 to 255
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)input[29] << 23) |
			((uint32_t)input[30] << 15) |
			((uint32_t)input[31] << 7);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 256 to 280
	value = ((uint32_t)input[32] << 24) |
			((uint32_t)input[33] << 16) |
			((uint32_t)input[34] << 8) |
			((uint32_t)(input[35] & 0x80));
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 281 to 305
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)input[36] << 17) |
			((uint32_t)input[37] << 9) |
			((uint32_t)(input[38] & 0xc0) << 1);
	output[11] = (double)(value >> 7);
}

static void unpack_12_25bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 12 values into output
	// Values are 25-bit signed
	// Skip 7 bits, read 300 bits of data.
	// Input must be at least 39 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 31
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)input[1] << 23) |
			((uint32_t)input[2] << 15) |
			((uint32_t)input[3] << 7);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 32 to 56
	value = ((uint32_t)input[4] << 24) |
			((uint32_t)input[5] << 16) |
			((uint32_t)input[6] << 8) |
			((uint32_t)(input[7] & 0x80));
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 57 to 81
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)input[8] << 17) |
			((uint32_t)input[9] << 9) |
			((uint32_t)(input[10] & 0xc0) << 1);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 82 to 106
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)input[11] << 18) |
			((uint32_t)input[12] << 10) |
			((uint32_t)(input[13] & 0xe0) << 2);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 107 to 131
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)input[14] << 19) |
			((uint32_t)input[15] << 11) |
			((uint32_t)(input[16] & 0xf0) << 3);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 132 to 156
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)input[17] << 20) |
			((uint32_t)input[18] << 12) |
			((uint32_t)(input[19] & 0xf8) << 4);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 157 to 181
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)input[20] << 21) |
			((uint32_t)input[21] << 13) |
			((uint32_t)(input[22] & 0xfc) << 5);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 182 to 206
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)input[23] << 22) |
			((uint32_t)input[24] << 14) |
			((uint32_t)(input[25] & 0xfe) << 6);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 207 to 231
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)input[28] << 7);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 232 to 256
	value = ((uint32_t)input[29] << 24) |
			((uint32_t)input[30] << 16) |
			((uint32_t)input[31] << 8) |
			((uint32_t)(input[32] & 0x80));
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 257 to 281
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)input[33] << 17) |
			((uint32_t)input[34] << 9) |
			((uint32_t)(input[35] & 0xc0) << 1);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 282 to 306
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)input[36] << 18) |
			((uint32_t)input[37] << 10) |
			((uint32_t)(input[38] & 0xe0) << 2);
	output[11] = (double)(value >> 7);
}

static void unpack_12_25bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 12 values into output
	// Values are 25-bit unsigned
	// Skip 7 bits, read 300 bits of data.
	// Input must be at least 39 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 31
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)input[1] << 23) |
			((uint32_t)input[2] << 15) |
			((uint32_t)input[3] << 7);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 32 to 56
	value = ((uint32_t)input[4] << 24) |
			((uint32_t)input[5] << 16) |
			((uint32_t)input[6] << 8) |
			((uint32_t)(input[7] & 0x80));
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 57 to 81
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)input[8] << 17) |
			((uint32_t)input[9] << 9) |
			((uint32_t)(input[10] & 0xc0) << 1);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 82 to 106
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)input[11] << 18) |
			((uint32_t)input[12] << 10) |
			((uint32_t)(input[13] & 0xe0) << 2);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 107 to 131
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)input[14] << 19) |
			((uint32_t)input[15] << 11) |
			((uint32_t)(input[16] & 0xf0) << 3);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 132 to 156
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)input[17] << 20) |
			((uint32_t)input[18] << 12) |
			((uint32_t)(input[19] & 0xf8) << 4);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 157 to 181
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)input[20] << 21) |
			((uint32_t)input[21] << 13) |
			((uint32_t)(input[22] & 0xfc) << 5);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 182 to 206
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)input[23] << 22) |
			((uint32_t)input[24] << 14) |
			((uint32_t)(input[25] & 0xfe) << 6);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 207 to 231
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)input[28] << 7);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 232 to 256
	value = ((uint32_t)input[29] << 24) |
			((uint32_t)input[30] << 16) |
			((uint32_t)input[31] << 8) |
			((uint32_t)(input[32] & 0x80));
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 257 to 281
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)input[33] << 17) |
			((uint32_t)input[34] << 9) |
			((uint32_t)(input[35] & 0xc0) << 1);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 282 to 306
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)input[36] << 18) |
			((uint32_t)input[37] << 10) |
			((uint32_t)(input[38] & 0xe0) << 2);
	output[11] = (double)(value >> 7);
}

static void unpack_13_25bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 25-bit signed
	// Skip 0 bits, read 325 bits of data.
	// Input must be at least 41 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 24
	value = ((uint32_t)input[0] << 24) |
			((uint32_t)input[1] << 16) |
			((uint32_t)input[2] << 8) |
			((uint32_t)(input[3] & 0x80));
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 25 to 49
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)input[4] << 17) |
			((uint32_t)input[5] << 9) |
			((uint32_t)(input[6] & 0xc0) << 1);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 50 to 74
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0xe0) << 2);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 75 to 99
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xf0) << 3);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 100 to 124
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)input[13] << 20) |
			((uint32_t)input[14] << 12) |
			((uint32_t)(input[15] & 0xf8) << 4);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 125 to 149
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)input[16] << 21) |
			((uint32_t)input[17] << 13) |
			((uint32_t)(input[18] & 0xfc) << 5);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 150 to 174
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)input[19] << 22) |
			((uint32_t)input[20] << 14) |
			((uint32_t)(input[21] & 0xfe) << 6);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 175 to 199
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)input[22] << 23) |
			((uint32_t)input[23] << 15) |
			((uint32_t)input[24] << 7);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 200 to 224
	value = ((uint32_t)input[25] << 24) |
			((uint32_t)input[26] << 16) |
			((uint32_t)input[27] << 8) |
			((uint32_t)(input[28] & 0x80));
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 225 to 249
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)input[29] << 17) |
			((uint32_t)input[30] << 9) |
			((uint32_t)(input[31] & 0xc0) << 1);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 250 to 274
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)input[32] << 18) |
			((uint32_t)input[33] << 10) |
			((uint32_t)(input[34] & 0xe0) << 2);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 275 to 299
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)input[35] << 19) |
			((uint32_t)input[36] << 11) |
			((uint32_t)(input[37] & 0xf0) << 3);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 300 to 324
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)input[38] << 20) |
			((uint32_t)input[39] << 12) |
			((uint32_t)(input[40] & 0xf8) << 4);
	output[12] = (double)(value >> 7);
}

static void unpack_13_25bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 25-bit unsigned
	// Skip 0 bits, read 325 bits of data.
	// Input must be at least 41 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 24
	value = ((uint32_t)input[0] << 24) |
			((uint32_t)input[1] << 16) |
			((uint32_t)input[2] << 8) |
			((uint32_t)(input[3] & 0x80));
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 25 to 49
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)input[4] << 17) |
			((uint32_t)input[5] << 9) |
			((uint32_t)(input[6] & 0xc0) << 1);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 50 to 74
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0xe0) << 2);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 75 to 99
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xf0) << 3);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 100 to 124
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)input[13] << 20) |
			((uint32_t)input[14] << 12) |
			((uint32_t)(input[15] & 0xf8) << 4);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 125 to 149
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)input[16] << 21) |
			((uint32_t)input[17] << 13) |
			((uint32_t)(input[18] & 0xfc) << 5);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 150 to 174
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)input[19] << 22) |
			((uint32_t)input[20] << 14) |
			((uint32_t)(input[21] & 0xfe) << 6);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 175 to 199
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)input[22] << 23) |
			((uint32_t)input[23] << 15) |
			((uint32_t)input[24] << 7);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 200 to 224
	value = ((uint32_t)input[25] << 24) |
			((uint32_t)input[26] << 16) |
			((uint32_t)input[27] << 8) |
			((uint32_t)(input[28] & 0x80));
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 225 to 249
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)input[29] << 17) |
			((uint32_t)input[30] << 9) |
			((uint32_t)(input[31] & 0xc0) << 1);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 250 to 274
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)input[32] << 18) |
			((uint32_t)input[33] << 10) |
			((uint32_t)(input[34] & 0xe0) << 2);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 275 to 299
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)input[35] << 19) |
			((uint32_t)input[36] << 11) |
			((uint32_t)(input[37] & 0xf0) << 3);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 300 to 324
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)input[38] << 20) |
			((uint32_t)input[39] << 12) |
			((uint32_t)(input[40] & 0xf8) << 4);
	output[12] = (double)(value >> 7);
}

static void unpack_13_25bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 25-bit signed
	// Skip 1 bits, read 325 bits of data.
	// Input must be at least 41 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 25
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)input[1] << 17) |
			((uint32_t)input[2] << 9) |
			((uint32_t)(input[3] & 0xc0) << 1);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 26 to 50
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0xe0) << 2);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 51 to 75
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xf0) << 3);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 76 to 100
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xf8) << 4);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 101 to 125
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)input[13] << 21) |
			((uint32_t)input[14] << 13) |
			((uint32_t)(input[15] & 0xfc) << 5);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 126 to 150
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)input[16] << 22) |
			((uint32_t)input[17] << 14) |
			((uint32_t)(input[18] & 0xfe) << 6);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 151 to 175
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)input[19] << 23) |
			((uint32_t)input[20] << 15) |
			((uint32_t)input[21] << 7);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 176 to 200
	value = ((uint32_t)input[22] << 24) |
			((uint32_t)input[23] << 16) |
			((uint32_t)input[24] << 8) |
			((uint32_t)(input[25] & 0x80));
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 201 to 225
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)input[26] << 17) |
			((uint32_t)input[27] << 9) |
			((uint32_t)(input[28] & 0xc0) << 1);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 226 to 250
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)input[29] << 18) |
			((uint32_t)input[30] << 10) |
			((uint32_t)(input[31] & 0xe0) << 2);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 251 to 275
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)input[32] << 19) |
			((uint32_t)input[33] << 11) |
			((uint32_t)(input[34] & 0xf0) << 3);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 276 to 300
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)input[35] << 20) |
			((uint32_t)input[36] << 12) |
			((uint32_t)(input[37] & 0xf8) << 4);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 301 to 325
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)input[38] << 21) |
			((uint32_t)input[39] << 13) |
			((uint32_t)(input[40] & 0xfc) << 5);
	output[12] = (double)(value >> 7);
}

static void unpack_13_25bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 25-bit unsigned
	// Skip 1 bits, read 325 bits of data.
	// Input must be at least 41 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 25
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)input[1] << 17) |
			((uint32_t)input[2] << 9) |
			((uint32_t)(input[3] & 0xc0) << 1);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 26 to 50
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0xe0) << 2);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 51 to 75
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xf0) << 3);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 76 to 100
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xf8) << 4);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 101 to 125
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)input[13] << 21) |
			((uint32_t)input[14] << 13) |
			((uint32_t)(input[15] & 0xfc) << 5);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 126 to 150
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)input[16] << 22) |
			((uint32_t)input[17] << 14) |
			((uint32_t)(input[18] & 0xfe) << 6);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 151 to 175
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)input[19] << 23) |
			((uint32_t)input[20] << 15) |
			((uint32_t)input[21] << 7);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 176 to 200
	value = ((uint32_t)input[22] << 24) |
			((uint32_t)input[23] << 16) |
			((uint32_t)input[24] << 8) |
			((uint32_t)(input[25] & 0x80));
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 201 to 225
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)input[26] << 17) |
			((uint32_t)input[27] << 9) |
			((uint32_t)(input[28] & 0xc0) << 1);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 226 to 250
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)input[29] << 18) |
			((uint32_t)input[30] << 10) |
			((uint32_t)(input[31] & 0xe0) << 2);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 251 to 275
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)input[32] << 19) |
			((uint32_t)input[33] << 11) |
			((uint32_t)(input[34] & 0xf0) << 3);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 276 to 300
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)input[35] << 20) |
			((uint32_t)input[36] << 12) |
			((uint32_t)(input[37] & 0xf8) << 4);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 301 to 325
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)input[38] << 21) |
			((uint32_t)input[39] << 13) |
			((uint32_t)(input[40] & 0xfc) << 5);
	output[12] = (double)(value >> 7);
}

static void unpack_13_25bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 25-bit signed
	// Skip 2 bits, read 325 bits of data.
	// Input must be at least 41 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 26
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)input[1] << 18) |
			((uint32_t)input[2] << 10) |
			((uint32_t)(input[3] & 0xe0) << 2);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 27 to 51
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xf0) << 3);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 52 to 76
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xf8) << 4);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 77 to 101
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)input[10] << 21) |
			((uint32_t)input[11] << 13) |
			((uint32_t)(input[12] & 0xfc) << 5);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 102 to 126
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)input[13] << 22) |
			((uint32_t)input[14] << 14) |
			((uint32_t)(input[15] & 0xfe) << 6);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 127 to 151
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)input[16] << 23) |
			((uint32_t)input[17] << 15) |
			((uint32_t)input[18] << 7);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 152 to 176
	value = ((uint32_t)input[19] << 24) |
			((uint32_t)input[20] << 16) |
			((uint32_t)input[21] << 8) |
			((uint32_t)(input[22] & 0x80));
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 177 to 201
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)input[23] << 17) |
			((uint32_t)input[24] << 9) |
			((uint32_t)(input[25] & 0xc0) << 1);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 202 to 226
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)input[26] << 18) |
			((uint32_t)input[27] << 10) |
			((uint32_t)(input[28] & 0xe0) << 2);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 227 to 251
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)input[29] << 19) |
			((uint32_t)input[30] << 11) |
			((uint32_t)(input[31] & 0xf0) << 3);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 252 to 276
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)input[32] << 20) |
			((uint32_t)input[33] << 12) |
			((uint32_t)(input[34] & 0xf8) << 4);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 277 to 301
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)input[35] << 21) |
			((uint32_t)input[36] << 13) |
			((uint32_t)(input[37] & 0xfc) << 5);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 302 to 326
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)input[38] << 22) |
			((uint32_t)input[39] << 14) |
			((uint32_t)(input[40] & 0xfe) << 6);
	output[12] = (double)(value >> 7);
}

static void unpack_13_25bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 25-bit unsigned
	// Skip 2 bits, read 325 bits of data.
	// Input must be at least 41 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 26
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)input[1] << 18) |
			((uint32_t)input[2] << 10) |
			((uint32_t)(input[3] & 0xe0) << 2);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 27 to 51
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xf0) << 3);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 52 to 76
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xf8) << 4);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 77 to 101
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)input[10] << 21) |
			((uint32_t)input[11] << 13) |
			((uint32_t)(input[12] & 0xfc) << 5);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 102 to 126
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)input[13] << 22) |
			((uint32_t)input[14] << 14) |
			((uint32_t)(input[15] & 0xfe) << 6);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 127 to 151
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)input[16] << 23) |
			((uint32_t)input[17] << 15) |
			((uint32_t)input[18] << 7);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 152 to 176
	value = ((uint32_t)input[19] << 24) |
			((uint32_t)input[20] << 16) |
			((uint32_t)input[21] << 8) |
			((uint32_t)(input[22] & 0x80));
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 177 to 201
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)input[23] << 17) |
			((uint32_t)input[24] << 9) |
			((uint32_t)(input[25] & 0xc0) << 1);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 202 to 226
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)input[26] << 18) |
			((uint32_t)input[27] << 10) |
			((uint32_t)(input[28] & 0xe0) << 2);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 227 to 251
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)input[29] << 19) |
			((uint32_t)input[30] << 11) |
			((uint32_t)(input[31] & 0xf0) << 3);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 252 to 276
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)input[32] << 20) |
			((uint32_t)input[33] << 12) |
			((uint32_t)(input[34] & 0xf8) << 4);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 277 to 301
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)input[35] << 21) |
			((uint32_t)input[36] << 13) |
			((uint32_t)(input[37] & 0xfc) << 5);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 302 to 326
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)input[38] << 22) |
			((uint32_t)input[39] << 14) |
			((uint32_t)(input[40] & 0xfe) << 6);
	output[12] = (double)(value >> 7);
}

static void unpack_13_25bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 25-bit signed
	// Skip 3 bits, read 325 bits of data.
	// Input must be at least 41 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 27
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)input[1] << 19) |
			((uint32_t)input[2] << 11) |
			((uint32_t)(input[3] & 0xf0) << 3);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 28 to 52
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xf8) << 4);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 53 to 77
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xfc) << 5);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 78 to 102
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)input[10] << 22) |
			((uint32_t)input[11] << 14) |
			((uint32_t)(input[12] & 0xfe) << 6);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 103 to 127
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)input[13] << 23) |
			((uint32_t)input[14] << 15) |
			((uint32_t)input[15] << 7);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 128 to 152
	value = ((uint32_t)input[16] << 24) |
			((uint32_t)input[17] << 16) |
			((uint32_t)input[18] << 8) |
			((uint32_t)(input[19] & 0x80));
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 153 to 177
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)input[20] << 17) |
			((uint32_t)input[21] << 9) |
			((uint32_t)(input[22] & 0xc0) << 1);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 178 to 202
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)input[23] << 18) |
			((uint32_t)input[24] << 10) |
			((uint32_t)(input[25] & 0xe0) << 2);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 203 to 227
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)input[26] << 19) |
			((uint32_t)input[27] << 11) |
			((uint32_t)(input[28] & 0xf0) << 3);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 228 to 252
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)input[29] << 20) |
			((uint32_t)input[30] << 12) |
			((uint32_t)(input[31] & 0xf8) << 4);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 253 to 277
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)input[32] << 21) |
			((uint32_t)input[33] << 13) |
			((uint32_t)(input[34] & 0xfc) << 5);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 278 to 302
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)input[35] << 22) |
			((uint32_t)input[36] << 14) |
			((uint32_t)(input[37] & 0xfe) << 6);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 303 to 327
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)input[38] << 23) |
			((uint32_t)input[39] << 15) |
			((uint32_t)input[40] << 7);
	output[12] = (double)(value >> 7);
}

static void unpack_13_25bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 25-bit unsigned
	// Skip 3 bits, read 325 bits of data.
	// Input must be at least 41 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 27
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)input[1] << 19) |
			((uint32_t)input[2] << 11) |
			((uint32_t)(input[3] & 0xf0) << 3);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 28 to 52
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xf8) << 4);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 53 to 77
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xfc) << 5);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 78 to 102
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)input[10] << 22) |
			((uint32_t)input[11] << 14) |
			((uint32_t)(input[12] & 0xfe) << 6);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 103 to 127
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)input[13] << 23) |
			((uint32_t)input[14] << 15) |
			((uint32_t)input[15] << 7);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 128 to 152
	value = ((uint32_t)input[16] << 24) |
			((uint32_t)input[17] << 16) |
			((uint32_t)input[18] << 8) |
			((uint32_t)(input[19] & 0x80));
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 153 to 177
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)input[20] << 17) |
			((uint32_t)input[21] << 9) |
			((uint32_t)(input[22] & 0xc0) << 1);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 178 to 202
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)input[23] << 18) |
			((uint32_t)input[24] << 10) |
			((uint32_t)(input[25] & 0xe0) << 2);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 203 to 227
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)input[26] << 19) |
			((uint32_t)input[27] << 11) |
			((uint32_t)(input[28] & 0xf0) << 3);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 228 to 252
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)input[29] << 20) |
			((uint32_t)input[30] << 12) |
			((uint32_t)(input[31] & 0xf8) << 4);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 253 to 277
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)input[32] << 21) |
			((uint32_t)input[33] << 13) |
			((uint32_t)(input[34] & 0xfc) << 5);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 278 to 302
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)input[35] << 22) |
			((uint32_t)input[36] << 14) |
			((uint32_t)(input[37] & 0xfe) << 6);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 303 to 327
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)input[38] << 23) |
			((uint32_t)input[39] << 15) |
			((uint32_t)input[40] << 7);
	output[12] = (double)(value >> 7);
}

static void unpack_13_25bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 25-bit signed
	// Skip 4 bits, read 325 bits of data.
	// Input must be at least 42 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 28
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)input[1] << 20) |
			((uint32_t)input[2] << 12) |
			((uint32_t)(input[3] & 0xf8) << 4);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 29 to 53
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xfc) << 5);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 54 to 78
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)input[7] << 22) |
			((uint32_t)input[8] << 14) |
			((uint32_t)(input[9] & 0xfe) << 6);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 79 to 103
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)input[10] << 23) |
			((uint32_t)input[11] << 15) |
			((uint32_t)input[12] << 7);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 104 to 128
	value = ((uint32_t)input[13] << 24) |
			((uint32_t)input[14] << 16) |
			((uint32_t)input[15] << 8) |
			((uint32_t)(input[16] & 0x80));
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 129 to 153
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)input[17] << 17) |
			((uint32_t)input[18] << 9) |
			((uint32_t)(input[19] & 0xc0) << 1);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 154 to 178
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)input[20] << 18) |
			((uint32_t)input[21] << 10) |
			((uint32_t)(input[22] & 0xe0) << 2);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 179 to 203
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)input[23] << 19) |
			((uint32_t)input[24] << 11) |
			((uint32_t)(input[25] & 0xf0) << 3);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 204 to 228
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)input[26] << 20) |
			((uint32_t)input[27] << 12) |
			((uint32_t)(input[28] & 0xf8) << 4);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 229 to 253
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)input[29] << 21) |
			((uint32_t)input[30] << 13) |
			((uint32_t)(input[31] & 0xfc) << 5);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 254 to 278
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)input[32] << 22) |
			((uint32_t)input[33] << 14) |
			((uint32_t)(input[34] & 0xfe) << 6);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 279 to 303
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)input[35] << 23) |
			((uint32_t)input[36] << 15) |
			((uint32_t)input[37] << 7);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 304 to 328
	value = ((uint32_t)input[38] << 24) |
			((uint32_t)input[39] << 16) |
			((uint32_t)input[40] << 8) |
			((uint32_t)(input[41] & 0x80));
	output[12] = (double)(value >> 7);
}

static void unpack_13_25bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 25-bit unsigned
	// Skip 4 bits, read 325 bits of data.
	// Input must be at least 42 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 28
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)input[1] << 20) |
			((uint32_t)input[2] << 12) |
			((uint32_t)(input[3] & 0xf8) << 4);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 29 to 53
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xfc) << 5);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 54 to 78
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)input[7] << 22) |
			((uint32_t)input[8] << 14) |
			((uint32_t)(input[9] & 0xfe) << 6);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 79 to 103
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)input[10] << 23) |
			((uint32_t)input[11] << 15) |
			((uint32_t)input[12] << 7);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 104 to 128
	value = ((uint32_t)input[13] << 24) |
			((uint32_t)input[14] << 16) |
			((uint32_t)input[15] << 8) |
			((uint32_t)(input[16] & 0x80));
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 129 to 153
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)input[17] << 17) |
			((uint32_t)input[18] << 9) |
			((uint32_t)(input[19] & 0xc0) << 1);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 154 to 178
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)input[20] << 18) |
			((uint32_t)input[21] << 10) |
			((uint32_t)(input[22] & 0xe0) << 2);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 179 to 203
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)input[23] << 19) |
			((uint32_t)input[24] << 11) |
			((uint32_t)(input[25] & 0xf0) << 3);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 204 to 228
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)input[26] << 20) |
			((uint32_t)input[27] << 12) |
			((uint32_t)(input[28] & 0xf8) << 4);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 229 to 253
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)input[29] << 21) |
			((uint32_t)input[30] << 13) |
			((uint32_t)(input[31] & 0xfc) << 5);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 254 to 278
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)input[32] << 22) |
			((uint32_t)input[33] << 14) |
			((uint32_t)(input[34] & 0xfe) << 6);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 279 to 303
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)input[35] << 23) |
			((uint32_t)input[36] << 15) |
			((uint32_t)input[37] << 7);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 304 to 328
	value = ((uint32_t)input[38] << 24) |
			((uint32_t)input[39] << 16) |
			((uint32_t)input[40] << 8) |
			((uint32_t)(input[41] & 0x80));
	output[12] = (double)(value >> 7);
}

static void unpack_13_25bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 25-bit signed
	// Skip 5 bits, read 325 bits of data.
	// Input must be at least 42 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 29
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)input[1] << 21) |
			((uint32_t)input[2] << 13) |
			((uint32_t)(input[3] & 0xfc) << 5);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 30 to 54
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xfe) << 6);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 55 to 79
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)input[7] << 23) |
			((uint32_t)input[8] << 15) |
			((uint32_t)input[9] << 7);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 80 to 104
	value = ((uint32_t)input[10] << 24) |
			((uint32_t)input[11] << 16) |
			((uint32_t)input[12] << 8) |
			((uint32_t)(input[13] & 0x80));
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 105 to 129
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)input[14] << 17) |
			((uint32_t)input[15] << 9) |
			((uint32_t)(input[16] & 0xc0) << 1);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 130 to 154
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)input[17] << 18) |
			((uint32_t)input[18] << 10) |
			((uint32_t)(input[19] & 0xe0) << 2);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 155 to 179
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)input[20] << 19) |
			((uint32_t)input[21] << 11) |
			((uint32_t)(input[22] & 0xf0) << 3);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 180 to 204
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)input[23] << 20) |
			((uint32_t)input[24] << 12) |
			((uint32_t)(input[25] & 0xf8) << 4);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 205 to 229
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)input[26] << 21) |
			((uint32_t)input[27] << 13) |
			((uint32_t)(input[28] & 0xfc) << 5);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 230 to 254
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)input[29] << 22) |
			((uint32_t)input[30] << 14) |
			((uint32_t)(input[31] & 0xfe) << 6);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 255 to 279
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)input[32] << 23) |
			((uint32_t)input[33] << 15) |
			((uint32_t)input[34] << 7);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 280 to 304
	value = ((uint32_t)input[35] << 24) |
			((uint32_t)input[36] << 16) |
			((uint32_t)input[37] << 8) |
			((uint32_t)(input[38] & 0x80));
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 305 to 329
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)input[39] << 17) |
			((uint32_t)input[40] << 9) |
			((uint32_t)(input[41] & 0xc0) << 1);
	output[12] = (double)(value >> 7);
}

static void unpack_13_25bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 25-bit unsigned
	// Skip 5 bits, read 325 bits of data.
	// Input must be at least 42 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 29
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)input[1] << 21) |
			((uint32_t)input[2] << 13) |
			((uint32_t)(input[3] & 0xfc) << 5);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 30 to 54
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xfe) << 6);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 55 to 79
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)input[7] << 23) |
			((uint32_t)input[8] << 15) |
			((uint32_t)input[9] << 7);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 80 to 104
	value = ((uint32_t)input[10] << 24) |
			((uint32_t)input[11] << 16) |
			((uint32_t)input[12] << 8) |
			((uint32_t)(input[13] & 0x80));
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 105 to 129
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)input[14] << 17) |
			((uint32_t)input[15] << 9) |
			((uint32_t)(input[16] & 0xc0) << 1);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 130 to 154
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)input[17] << 18) |
			((uint32_t)input[18] << 10) |
			((uint32_t)(input[19] & 0xe0) << 2);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 155 to 179
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)input[20] << 19) |
			((uint32_t)input[21] << 11) |
			((uint32_t)(input[22] & 0xf0) << 3);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 180 to 204
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)input[23] << 20) |
			((uint32_t)input[24] << 12) |
			((uint32_t)(input[25] & 0xf8) << 4);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 205 to 229
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)input[26] << 21) |
			((uint32_t)input[27] << 13) |
			((uint32_t)(input[28] & 0xfc) << 5);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 230 to 254
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)input[29] << 22) |
			((uint32_t)input[30] << 14) |
			((uint32_t)(input[31] & 0xfe) << 6);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 255 to 279
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)input[32] << 23) |
			((uint32_t)input[33] << 15) |
			((uint32_t)input[34] << 7);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 280 to 304
	value = ((uint32_t)input[35] << 24) |
			((uint32_t)input[36] << 16) |
			((uint32_t)input[37] << 8) |
			((uint32_t)(input[38] & 0x80));
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 305 to 329
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)input[39] << 17) |
			((uint32_t)input[40] << 9) |
			((uint32_t)(input[41] & 0xc0) << 1);
	output[12] = (double)(value >> 7);
}

static void unpack_13_25bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 25-bit signed
	// Skip 6 bits, read 325 bits of data.
	// Input must be at least 42 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 30
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)input[1] << 22) |
			((uint32_t)input[2] << 14) |
			((uint32_t)(input[3] & 0xfe) << 6);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 31 to 55
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)input[4] << 23) |
			((uint32_t)input[5] << 15) |
			((uint32_t)input[6] << 7);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 56 to 80
	value = ((uint32_t)input[7] << 24) |
			((uint32_t)input[8] << 16) |
			((uint32_t)input[9] << 8) |
			((uint32_t)(input[10] & 0x80));
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 81 to 105
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)input[11] << 17) |
			((uint32_t)input[12] << 9) |
			((uint32_t)(input[13] & 0xc0) << 1);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 106 to 130
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)input[14] << 18) |
			((uint32_t)input[15] << 10) |
			((uint32_t)(input[16] & 0xe0) << 2);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 131 to 155
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)input[17] << 19) |
			((uint32_t)input[18] << 11) |
			((uint32_t)(input[19] & 0xf0) << 3);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 156 to 180
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)input[20] << 20) |
			((uint32_t)input[21] << 12) |
			((uint32_t)(input[22] & 0xf8) << 4);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 181 to 205
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)input[23] << 21) |
			((uint32_t)input[24] << 13) |
			((uint32_t)(input[25] & 0xfc) << 5);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 206 to 230
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)input[26] << 22) |
			((uint32_t)input[27] << 14) |
			((uint32_t)(input[28] & 0xfe) << 6);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 231 to 255
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)input[29] << 23) |
			((uint32_t)input[30] << 15) |
			((uint32_t)input[31] << 7);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 256 to 280
	value = ((uint32_t)input[32] << 24) |
			((uint32_t)input[33] << 16) |
			((uint32_t)input[34] << 8) |
			((uint32_t)(input[35] & 0x80));
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 281 to 305
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)input[36] << 17) |
			((uint32_t)input[37] << 9) |
			((uint32_t)(input[38] & 0xc0) << 1);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 306 to 330
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)input[39] << 18) |
			((uint32_t)input[40] << 10) |
			((uint32_t)(input[41] & 0xe0) << 2);
	output[12] = (double)(value >> 7);
}

static void unpack_13_25bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 25-bit unsigned
	// Skip 6 bits, read 325 bits of data.
	// Input must be at least 42 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 30
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)input[1] << 22) |
			((uint32_t)input[2] << 14) |
			((uint32_t)(input[3] & 0xfe) << 6);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 31 to 55
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)input[4] << 23) |
			((uint32_t)input[5] << 15) |
			((uint32_t)input[6] << 7);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 56 to 80
	value = ((uint32_t)input[7] << 24) |
			((uint32_t)input[8] << 16) |
			((uint32_t)input[9] << 8) |
			((uint32_t)(input[10] & 0x80));
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 81 to 105
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)input[11] << 17) |
			((uint32_t)input[12] << 9) |
			((uint32_t)(input[13] & 0xc0) << 1);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 106 to 130
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)input[14] << 18) |
			((uint32_t)input[15] << 10) |
			((uint32_t)(input[16] & 0xe0) << 2);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 131 to 155
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)input[17] << 19) |
			((uint32_t)input[18] << 11) |
			((uint32_t)(input[19] & 0xf0) << 3);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 156 to 180
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)input[20] << 20) |
			((uint32_t)input[21] << 12) |
			((uint32_t)(input[22] & 0xf8) << 4);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 181 to 205
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)input[23] << 21) |
			((uint32_t)input[24] << 13) |
			((uint32_t)(input[25] & 0xfc) << 5);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 206 to 230
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)input[26] << 22) |
			((uint32_t)input[27] << 14) |
			((uint32_t)(input[28] & 0xfe) << 6);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 231 to 255
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)input[29] << 23) |
			((uint32_t)input[30] << 15) |
			((uint32_t)input[31] << 7);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 256 to 280
	value = ((uint32_t)input[32] << 24) |
			((uint32_t)input[33] << 16) |
			((uint32_t)input[34] << 8) |
			((uint32_t)(input[35] & 0x80));
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 281 to 305
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)input[36] << 17) |
			((uint32_t)input[37] << 9) |
			((uint32_t)(input[38] & 0xc0) << 1);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 306 to 330
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)input[39] << 18) |
			((uint32_t)input[40] << 10) |
			((uint32_t)(input[41] & 0xe0) << 2);
	output[12] = (double)(value >> 7);
}

static void unpack_13_25bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 25-bit signed
	// Skip 7 bits, read 325 bits of data.
	// Input must be at least 42 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 31
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)input[1] << 23) |
			((uint32_t)input[2] << 15) |
			((uint32_t)input[3] << 7);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 32 to 56
	value = ((uint32_t)input[4] << 24) |
			((uint32_t)input[5] << 16) |
			((uint32_t)input[6] << 8) |
			((uint32_t)(input[7] & 0x80));
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 57 to 81
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)input[8] << 17) |
			((uint32_t)input[9] << 9) |
			((uint32_t)(input[10] & 0xc0) << 1);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 82 to 106
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)input[11] << 18) |
			((uint32_t)input[12] << 10) |
			((uint32_t)(input[13] & 0xe0) << 2);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 107 to 131
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)input[14] << 19) |
			((uint32_t)input[15] << 11) |
			((uint32_t)(input[16] & 0xf0) << 3);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 132 to 156
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)input[17] << 20) |
			((uint32_t)input[18] << 12) |
			((uint32_t)(input[19] & 0xf8) << 4);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 157 to 181
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)input[20] << 21) |
			((uint32_t)input[21] << 13) |
			((uint32_t)(input[22] & 0xfc) << 5);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 182 to 206
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)input[23] << 22) |
			((uint32_t)input[24] << 14) |
			((uint32_t)(input[25] & 0xfe) << 6);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 207 to 231
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)input[28] << 7);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 232 to 256
	value = ((uint32_t)input[29] << 24) |
			((uint32_t)input[30] << 16) |
			((uint32_t)input[31] << 8) |
			((uint32_t)(input[32] & 0x80));
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 257 to 281
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)input[33] << 17) |
			((uint32_t)input[34] << 9) |
			((uint32_t)(input[35] & 0xc0) << 1);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 282 to 306
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)input[36] << 18) |
			((uint32_t)input[37] << 10) |
			((uint32_t)(input[38] & 0xe0) << 2);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 307 to 331
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)input[39] << 19) |
			((uint32_t)input[40] << 11) |
			((uint32_t)(input[41] & 0xf0) << 3);
	output[12] = (double)(value >> 7);
}

static void unpack_13_25bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 25-bit unsigned
	// Skip 7 bits, read 325 bits of data.
	// Input must be at least 42 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 31
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)input[1] << 23) |
			((uint32_t)input[2] << 15) |
			((uint32_t)input[3] << 7);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 32 to 56
	value = ((uint32_t)input[4] << 24) |
			((uint32_t)input[5] << 16) |
			((uint32_t)input[6] << 8) |
			((uint32_t)(input[7] & 0x80));
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 57 to 81
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)input[8] << 17) |
			((uint32_t)input[9] << 9) |
			((uint32_t)(input[10] & 0xc0) << 1);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 82 to 106
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)input[11] << 18) |
			((uint32_t)input[12] << 10) |
			((uint32_t)(input[13] & 0xe0) << 2);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 107 to 131
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)input[14] << 19) |
			((uint32_t)input[15] << 11) |
			((uint32_t)(input[16] & 0xf0) << 3);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 132 to 156
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)input[17] << 20) |
			((uint32_t)input[18] << 12) |
			((uint32_t)(input[19] & 0xf8) << 4);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 157 to 181
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)input[20] << 21) |
			((uint32_t)input[21] << 13) |
			((uint32_t)(input[22] & 0xfc) << 5);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 182 to 206
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)input[23] << 22) |
			((uint32_t)input[24] << 14) |
			((uint32_t)(input[25] & 0xfe) << 6);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 207 to 231
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)input[28] << 7);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 232 to 256
	value = ((uint32_t)input[29] << 24) |
			((uint32_t)input[30] << 16) |
			((uint32_t)input[31] << 8) |
			((uint32_t)(input[32] & 0x80));
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 257 to 281
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)input[33] << 17) |
			((uint32_t)input[34] << 9) |
			((uint32_t)(input[35] & 0xc0) << 1);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 282 to 306
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)input[36] << 18) |
			((uint32_t)input[37] << 10) |
			((uint32_t)(input[38] & 0xe0) << 2);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 307 to 331
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)input[39] << 19) |
			((uint32_t)input[40] << 11) |
			((uint32_t)(input[41] & 0xf0) << 3);
	output[12] = (double)(value >> 7);
}

static void unpack_14_25bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 25-bit signed
	// Skip 0 bits, read 350 bits of data.
	// Input must be at least 44 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 24
	value = ((uint32_t)input[0] << 24) |
			((uint32_t)input[1] << 16) |
			((uint32_t)input[2] << 8) |
			((uint32_t)(input[3] & 0x80));
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 25 to 49
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)input[4] << 17) |
			((uint32_t)input[5] << 9) |
			((uint32_t)(input[6] & 0xc0) << 1);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 50 to 74
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0xe0) << 2);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 75 to 99
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xf0) << 3);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 100 to 124
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)input[13] << 20) |
			((uint32_t)input[14] << 12) |
			((uint32_t)(input[15] & 0xf8) << 4);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 125 to 149
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)input[16] << 21) |
			((uint32_t)input[17] << 13) |
			((uint32_t)(input[18] & 0xfc) << 5);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 150 to 174
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)input[19] << 22) |
			((uint32_t)input[20] << 14) |
			((uint32_t)(input[21] & 0xfe) << 6);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 175 to 199
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)input[22] << 23) |
			((uint32_t)input[23] << 15) |
			((uint32_t)input[24] << 7);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 200 to 224
	value = ((uint32_t)input[25] << 24) |
			((uint32_t)input[26] << 16) |
			((uint32_t)input[27] << 8) |
			((uint32_t)(input[28] & 0x80));
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 225 to 249
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)input[29] << 17) |
			((uint32_t)input[30] << 9) |
			((uint32_t)(input[31] & 0xc0) << 1);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 250 to 274
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)input[32] << 18) |
			((uint32_t)input[33] << 10) |
			((uint32_t)(input[34] & 0xe0) << 2);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 275 to 299
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)input[35] << 19) |
			((uint32_t)input[36] << 11) |
			((uint32_t)(input[37] & 0xf0) << 3);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 300 to 324
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)input[38] << 20) |
			((uint32_t)input[39] << 12) |
			((uint32_t)(input[40] & 0xf8) << 4);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 325 to 349
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)input[41] << 21) |
			((uint32_t)input[42] << 13) |
			((uint32_t)(input[43] & 0xfc) << 5);
	output[13] = (double)(value >> 7);
}

static void unpack_14_25bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 25-bit unsigned
	// Skip 0 bits, read 350 bits of data.
	// Input must be at least 44 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 24
	value = ((uint32_t)input[0] << 24) |
			((uint32_t)input[1] << 16) |
			((uint32_t)input[2] << 8) |
			((uint32_t)(input[3] & 0x80));
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 25 to 49
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)input[4] << 17) |
			((uint32_t)input[5] << 9) |
			((uint32_t)(input[6] & 0xc0) << 1);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 50 to 74
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0xe0) << 2);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 75 to 99
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xf0) << 3);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 100 to 124
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)input[13] << 20) |
			((uint32_t)input[14] << 12) |
			((uint32_t)(input[15] & 0xf8) << 4);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 125 to 149
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)input[16] << 21) |
			((uint32_t)input[17] << 13) |
			((uint32_t)(input[18] & 0xfc) << 5);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 150 to 174
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)input[19] << 22) |
			((uint32_t)input[20] << 14) |
			((uint32_t)(input[21] & 0xfe) << 6);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 175 to 199
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)input[22] << 23) |
			((uint32_t)input[23] << 15) |
			((uint32_t)input[24] << 7);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 200 to 224
	value = ((uint32_t)input[25] << 24) |
			((uint32_t)input[26] << 16) |
			((uint32_t)input[27] << 8) |
			((uint32_t)(input[28] & 0x80));
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 225 to 249
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)input[29] << 17) |
			((uint32_t)input[30] << 9) |
			((uint32_t)(input[31] & 0xc0) << 1);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 250 to 274
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)input[32] << 18) |
			((uint32_t)input[33] << 10) |
			((uint32_t)(input[34] & 0xe0) << 2);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 275 to 299
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)input[35] << 19) |
			((uint32_t)input[36] << 11) |
			((uint32_t)(input[37] & 0xf0) << 3);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 300 to 324
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)input[38] << 20) |
			((uint32_t)input[39] << 12) |
			((uint32_t)(input[40] & 0xf8) << 4);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 325 to 349
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)input[41] << 21) |
			((uint32_t)input[42] << 13) |
			((uint32_t)(input[43] & 0xfc) << 5);
	output[13] = (double)(value >> 7);
}

static void unpack_14_25bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 25-bit signed
	// Skip 1 bits, read 350 bits of data.
	// Input must be at least 44 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 25
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)input[1] << 17) |
			((uint32_t)input[2] << 9) |
			((uint32_t)(input[3] & 0xc0) << 1);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 26 to 50
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0xe0) << 2);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 51 to 75
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xf0) << 3);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 76 to 100
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xf8) << 4);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 101 to 125
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)input[13] << 21) |
			((uint32_t)input[14] << 13) |
			((uint32_t)(input[15] & 0xfc) << 5);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 126 to 150
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)input[16] << 22) |
			((uint32_t)input[17] << 14) |
			((uint32_t)(input[18] & 0xfe) << 6);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 151 to 175
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)input[19] << 23) |
			((uint32_t)input[20] << 15) |
			((uint32_t)input[21] << 7);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 176 to 200
	value = ((uint32_t)input[22] << 24) |
			((uint32_t)input[23] << 16) |
			((uint32_t)input[24] << 8) |
			((uint32_t)(input[25] & 0x80));
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 201 to 225
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)input[26] << 17) |
			((uint32_t)input[27] << 9) |
			((uint32_t)(input[28] & 0xc0) << 1);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 226 to 250
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)input[29] << 18) |
			((uint32_t)input[30] << 10) |
			((uint32_t)(input[31] & 0xe0) << 2);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 251 to 275
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)input[32] << 19) |
			((uint32_t)input[33] << 11) |
			((uint32_t)(input[34] & 0xf0) << 3);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 276 to 300
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)input[35] << 20) |
			((uint32_t)input[36] << 12) |
			((uint32_t)(input[37] & 0xf8) << 4);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 301 to 325
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)input[38] << 21) |
			((uint32_t)input[39] << 13) |
			((uint32_t)(input[40] & 0xfc) << 5);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 326 to 350
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)input[41] << 22) |
			((uint32_t)input[42] << 14) |
			((uint32_t)(input[43] & 0xfe) << 6);
	output[13] = (double)(value >> 7);
}

static void unpack_14_25bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 25-bit unsigned
	// Skip 1 bits, read 350 bits of data.
	// Input must be at least 44 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 25
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)input[1] << 17) |
			((uint32_t)input[2] << 9) |
			((uint32_t)(input[3] & 0xc0) << 1);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 26 to 50
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0xe0) << 2);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 51 to 75
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xf0) << 3);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 76 to 100
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xf8) << 4);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 101 to 125
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)input[13] << 21) |
			((uint32_t)input[14] << 13) |
			((uint32_t)(input[15] & 0xfc) << 5);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 126 to 150
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)input[16] << 22) |
			((uint32_t)input[17] << 14) |
			((uint32_t)(input[18] & 0xfe) << 6);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 151 to 175
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)input[19] << 23) |
			((uint32_t)input[20] << 15) |
			((uint32_t)input[21] << 7);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 176 to 200
	value = ((uint32_t)input[22] << 24) |
			((uint32_t)input[23] << 16) |
			((uint32_t)input[24] << 8) |
			((uint32_t)(input[25] & 0x80));
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 201 to 225
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)input[26] << 17) |
			((uint32_t)input[27] << 9) |
			((uint32_t)(input[28] & 0xc0) << 1);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 226 to 250
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)input[29] << 18) |
			((uint32_t)input[30] << 10) |
			((uint32_t)(input[31] & 0xe0) << 2);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 251 to 275
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)input[32] << 19) |
			((uint32_t)input[33] << 11) |
			((uint32_t)(input[34] & 0xf0) << 3);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 276 to 300
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)input[35] << 20) |
			((uint32_t)input[36] << 12) |
			((uint32_t)(input[37] & 0xf8) << 4);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 301 to 325
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)input[38] << 21) |
			((uint32_t)input[39] << 13) |
			((uint32_t)(input[40] & 0xfc) << 5);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 326 to 350
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)input[41] << 22) |
			((uint32_t)input[42] << 14) |
			((uint32_t)(input[43] & 0xfe) << 6);
	output[13] = (double)(value >> 7);
}

static void unpack_14_25bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 25-bit signed
	// Skip 2 bits, read 350 bits of data.
	// Input must be at least 44 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 26
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)input[1] << 18) |
			((uint32_t)input[2] << 10) |
			((uint32_t)(input[3] & 0xe0) << 2);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 27 to 51
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xf0) << 3);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 52 to 76
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xf8) << 4);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 77 to 101
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)input[10] << 21) |
			((uint32_t)input[11] << 13) |
			((uint32_t)(input[12] & 0xfc) << 5);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 102 to 126
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)input[13] << 22) |
			((uint32_t)input[14] << 14) |
			((uint32_t)(input[15] & 0xfe) << 6);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 127 to 151
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)input[16] << 23) |
			((uint32_t)input[17] << 15) |
			((uint32_t)input[18] << 7);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 152 to 176
	value = ((uint32_t)input[19] << 24) |
			((uint32_t)input[20] << 16) |
			((uint32_t)input[21] << 8) |
			((uint32_t)(input[22] & 0x80));
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 177 to 201
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)input[23] << 17) |
			((uint32_t)input[24] << 9) |
			((uint32_t)(input[25] & 0xc0) << 1);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 202 to 226
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)input[26] << 18) |
			((uint32_t)input[27] << 10) |
			((uint32_t)(input[28] & 0xe0) << 2);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 227 to 251
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)input[29] << 19) |
			((uint32_t)input[30] << 11) |
			((uint32_t)(input[31] & 0xf0) << 3);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 252 to 276
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)input[32] << 20) |
			((uint32_t)input[33] << 12) |
			((uint32_t)(input[34] & 0xf8) << 4);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 277 to 301
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)input[35] << 21) |
			((uint32_t)input[36] << 13) |
			((uint32_t)(input[37] & 0xfc) << 5);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 302 to 326
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)input[38] << 22) |
			((uint32_t)input[39] << 14) |
			((uint32_t)(input[40] & 0xfe) << 6);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 327 to 351
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)input[41] << 23) |
			((uint32_t)input[42] << 15) |
			((uint32_t)input[43] << 7);
	output[13] = (double)(value >> 7);
}

static void unpack_14_25bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 25-bit unsigned
	// Skip 2 bits, read 350 bits of data.
	// Input must be at least 44 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 26
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)input[1] << 18) |
			((uint32_t)input[2] << 10) |
			((uint32_t)(input[3] & 0xe0) << 2);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 27 to 51
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xf0) << 3);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 52 to 76
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xf8) << 4);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 77 to 101
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)input[10] << 21) |
			((uint32_t)input[11] << 13) |
			((uint32_t)(input[12] & 0xfc) << 5);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 102 to 126
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)input[13] << 22) |
			((uint32_t)input[14] << 14) |
			((uint32_t)(input[15] & 0xfe) << 6);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 127 to 151
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)input[16] << 23) |
			((uint32_t)input[17] << 15) |
			((uint32_t)input[18] << 7);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 152 to 176
	value = ((uint32_t)input[19] << 24) |
			((uint32_t)input[20] << 16) |
			((uint32_t)input[21] << 8) |
			((uint32_t)(input[22] & 0x80));
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 177 to 201
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)input[23] << 17) |
			((uint32_t)input[24] << 9) |
			((uint32_t)(input[25] & 0xc0) << 1);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 202 to 226
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)input[26] << 18) |
			((uint32_t)input[27] << 10) |
			((uint32_t)(input[28] & 0xe0) << 2);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 227 to 251
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)input[29] << 19) |
			((uint32_t)input[30] << 11) |
			((uint32_t)(input[31] & 0xf0) << 3);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 252 to 276
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)input[32] << 20) |
			((uint32_t)input[33] << 12) |
			((uint32_t)(input[34] & 0xf8) << 4);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 277 to 301
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)input[35] << 21) |
			((uint32_t)input[36] << 13) |
			((uint32_t)(input[37] & 0xfc) << 5);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 302 to 326
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)input[38] << 22) |
			((uint32_t)input[39] << 14) |
			((uint32_t)(input[40] & 0xfe) << 6);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 327 to 351
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)input[41] << 23) |
			((uint32_t)input[42] << 15) |
			((uint32_t)input[43] << 7);
	output[13] = (double)(value >> 7);
}

static void unpack_14_25bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 25-bit signed
	// Skip 3 bits, read 350 bits of data.
	// Input must be at least 45 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 27
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)input[1] << 19) |
			((uint32_t)input[2] << 11) |
			((uint32_t)(input[3] & 0xf0) << 3);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 28 to 52
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xf8) << 4);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 53 to 77
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xfc) << 5);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 78 to 102
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)input[10] << 22) |
			((uint32_t)input[11] << 14) |
			((uint32_t)(input[12] & 0xfe) << 6);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 103 to 127
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)input[13] << 23) |
			((uint32_t)input[14] << 15) |
			((uint32_t)input[15] << 7);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 128 to 152
	value = ((uint32_t)input[16] << 24) |
			((uint32_t)input[17] << 16) |
			((uint32_t)input[18] << 8) |
			((uint32_t)(input[19] & 0x80));
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 153 to 177
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)input[20] << 17) |
			((uint32_t)input[21] << 9) |
			((uint32_t)(input[22] & 0xc0) << 1);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 178 to 202
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)input[23] << 18) |
			((uint32_t)input[24] << 10) |
			((uint32_t)(input[25] & 0xe0) << 2);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 203 to 227
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)input[26] << 19) |
			((uint32_t)input[27] << 11) |
			((uint32_t)(input[28] & 0xf0) << 3);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 228 to 252
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)input[29] << 20) |
			((uint32_t)input[30] << 12) |
			((uint32_t)(input[31] & 0xf8) << 4);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 253 to 277
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)input[32] << 21) |
			((uint32_t)input[33] << 13) |
			((uint32_t)(input[34] & 0xfc) << 5);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 278 to 302
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)input[35] << 22) |
			((uint32_t)input[36] << 14) |
			((uint32_t)(input[37] & 0xfe) << 6);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 303 to 327
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)input[38] << 23) |
			((uint32_t)input[39] << 15) |
			((uint32_t)input[40] << 7);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 328 to 352
	value = ((uint32_t)input[41] << 24) |
			((uint32_t)input[42] << 16) |
			((uint32_t)input[43] << 8) |
			((uint32_t)(input[44] & 0x80));
	output[13] = (double)(value >> 7);
}

static void unpack_14_25bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 25-bit unsigned
	// Skip 3 bits, read 350 bits of data.
	// Input must be at least 45 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 27
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)input[1] << 19) |
			((uint32_t)input[2] << 11) |
			((uint32_t)(input[3] & 0xf0) << 3);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 28 to 52
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xf8) << 4);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 53 to 77
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xfc) << 5);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 78 to 102
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)input[10] << 22) |
			((uint32_t)input[11] << 14) |
			((uint32_t)(input[12] & 0xfe) << 6);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 103 to 127
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)input[13] << 23) |
			((uint32_t)input[14] << 15) |
			((uint32_t)input[15] << 7);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 128 to 152
	value = ((uint32_t)input[16] << 24) |
			((uint32_t)input[17] << 16) |
			((uint32_t)input[18] << 8) |
			((uint32_t)(input[19] & 0x80));
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 153 to 177
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)input[20] << 17) |
			((uint32_t)input[21] << 9) |
			((uint32_t)(input[22] & 0xc0) << 1);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 178 to 202
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)input[23] << 18) |
			((uint32_t)input[24] << 10) |
			((uint32_t)(input[25] & 0xe0) << 2);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 203 to 227
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)input[26] << 19) |
			((uint32_t)input[27] << 11) |
			((uint32_t)(input[28] & 0xf0) << 3);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 228 to 252
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)input[29] << 20) |
			((uint32_t)input[30] << 12) |
			((uint32_t)(input[31] & 0xf8) << 4);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 253 to 277
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)input[32] << 21) |
			((uint32_t)input[33] << 13) |
			((uint32_t)(input[34] & 0xfc) << 5);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 278 to 302
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)input[35] << 22) |
			((uint32_t)input[36] << 14) |
			((uint32_t)(input[37] & 0xfe) << 6);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 303 to 327
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)input[38] << 23) |
			((uint32_t)input[39] << 15) |
			((uint32_t)input[40] << 7);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 328 to 352
	value = ((uint32_t)input[41] << 24) |
			((uint32_t)input[42] << 16) |
			((uint32_t)input[43] << 8) |
			((uint32_t)(input[44] & 0x80));
	output[13] = (double)(value >> 7);
}

static void unpack_14_25bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 25-bit signed
	// Skip 4 bits, read 350 bits of data.
	// Input must be at least 45 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 28
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)input[1] << 20) |
			((uint32_t)input[2] << 12) |
			((uint32_t)(input[3] & 0xf8) << 4);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 29 to 53
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xfc) << 5);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 54 to 78
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)input[7] << 22) |
			((uint32_t)input[8] << 14) |
			((uint32_t)(input[9] & 0xfe) << 6);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 79 to 103
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)input[10] << 23) |
			((uint32_t)input[11] << 15) |
			((uint32_t)input[12] << 7);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 104 to 128
	value = ((uint32_t)input[13] << 24) |
			((uint32_t)input[14] << 16) |
			((uint32_t)input[15] << 8) |
			((uint32_t)(input[16] & 0x80));
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 129 to 153
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)input[17] << 17) |
			((uint32_t)input[18] << 9) |
			((uint32_t)(input[19] & 0xc0) << 1);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 154 to 178
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)input[20] << 18) |
			((uint32_t)input[21] << 10) |
			((uint32_t)(input[22] & 0xe0) << 2);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 179 to 203
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)input[23] << 19) |
			((uint32_t)input[24] << 11) |
			((uint32_t)(input[25] & 0xf0) << 3);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 204 to 228
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)input[26] << 20) |
			((uint32_t)input[27] << 12) |
			((uint32_t)(input[28] & 0xf8) << 4);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 229 to 253
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)input[29] << 21) |
			((uint32_t)input[30] << 13) |
			((uint32_t)(input[31] & 0xfc) << 5);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 254 to 278
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)input[32] << 22) |
			((uint32_t)input[33] << 14) |
			((uint32_t)(input[34] & 0xfe) << 6);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 279 to 303
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)input[35] << 23) |
			((uint32_t)input[36] << 15) |
			((uint32_t)input[37] << 7);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 304 to 328
	value = ((uint32_t)input[38] << 24) |
			((uint32_t)input[39] << 16) |
			((uint32_t)input[40] << 8) |
			((uint32_t)(input[41] & 0x80));
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 329 to 353
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)input[42] << 17) |
			((uint32_t)input[43] << 9) |
			((uint32_t)(input[44] & 0xc0) << 1);
	output[13] = (double)(value >> 7);
}

static void unpack_14_25bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 25-bit unsigned
	// Skip 4 bits, read 350 bits of data.
	// Input must be at least 45 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 28
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)input[1] << 20) |
			((uint32_t)input[2] << 12) |
			((uint32_t)(input[3] & 0xf8) << 4);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 29 to 53
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xfc) << 5);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 54 to 78
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)input[7] << 22) |
			((uint32_t)input[8] << 14) |
			((uint32_t)(input[9] & 0xfe) << 6);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 79 to 103
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)input[10] << 23) |
			((uint32_t)input[11] << 15) |
			((uint32_t)input[12] << 7);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 104 to 128
	value = ((uint32_t)input[13] << 24) |
			((uint32_t)input[14] << 16) |
			((uint32_t)input[15] << 8) |
			((uint32_t)(input[16] & 0x80));
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 129 to 153
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)input[17] << 17) |
			((uint32_t)input[18] << 9) |
			((uint32_t)(input[19] & 0xc0) << 1);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 154 to 178
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)input[20] << 18) |
			((uint32_t)input[21] << 10) |
			((uint32_t)(input[22] & 0xe0) << 2);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 179 to 203
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)input[23] << 19) |
			((uint32_t)input[24] << 11) |
			((uint32_t)(input[25] & 0xf0) << 3);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 204 to 228
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)input[26] << 20) |
			((uint32_t)input[27] << 12) |
			((uint32_t)(input[28] & 0xf8) << 4);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 229 to 253
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)input[29] << 21) |
			((uint32_t)input[30] << 13) |
			((uint32_t)(input[31] & 0xfc) << 5);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 254 to 278
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)input[32] << 22) |
			((uint32_t)input[33] << 14) |
			((uint32_t)(input[34] & 0xfe) << 6);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 279 to 303
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)input[35] << 23) |
			((uint32_t)input[36] << 15) |
			((uint32_t)input[37] << 7);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 304 to 328
	value = ((uint32_t)input[38] << 24) |
			((uint32_t)input[39] << 16) |
			((uint32_t)input[40] << 8) |
			((uint32_t)(input[41] & 0x80));
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 329 to 353
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)input[42] << 17) |
			((uint32_t)input[43] << 9) |
			((uint32_t)(input[44] & 0xc0) << 1);
	output[13] = (double)(value >> 7);
}

static void unpack_14_25bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 25-bit signed
	// Skip 5 bits, read 350 bits of data.
	// Input must be at least 45 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 29
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)input[1] << 21) |
			((uint32_t)input[2] << 13) |
			((uint32_t)(input[3] & 0xfc) << 5);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 30 to 54
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xfe) << 6);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 55 to 79
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)input[7] << 23) |
			((uint32_t)input[8] << 15) |
			((uint32_t)input[9] << 7);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 80 to 104
	value = ((uint32_t)input[10] << 24) |
			((uint32_t)input[11] << 16) |
			((uint32_t)input[12] << 8) |
			((uint32_t)(input[13] & 0x80));
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 105 to 129
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)input[14] << 17) |
			((uint32_t)input[15] << 9) |
			((uint32_t)(input[16] & 0xc0) << 1);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 130 to 154
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)input[17] << 18) |
			((uint32_t)input[18] << 10) |
			((uint32_t)(input[19] & 0xe0) << 2);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 155 to 179
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)input[20] << 19) |
			((uint32_t)input[21] << 11) |
			((uint32_t)(input[22] & 0xf0) << 3);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 180 to 204
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)input[23] << 20) |
			((uint32_t)input[24] << 12) |
			((uint32_t)(input[25] & 0xf8) << 4);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 205 to 229
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)input[26] << 21) |
			((uint32_t)input[27] << 13) |
			((uint32_t)(input[28] & 0xfc) << 5);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 230 to 254
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)input[29] << 22) |
			((uint32_t)input[30] << 14) |
			((uint32_t)(input[31] & 0xfe) << 6);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 255 to 279
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)input[32] << 23) |
			((uint32_t)input[33] << 15) |
			((uint32_t)input[34] << 7);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 280 to 304
	value = ((uint32_t)input[35] << 24) |
			((uint32_t)input[36] << 16) |
			((uint32_t)input[37] << 8) |
			((uint32_t)(input[38] & 0x80));
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 305 to 329
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)input[39] << 17) |
			((uint32_t)input[40] << 9) |
			((uint32_t)(input[41] & 0xc0) << 1);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 330 to 354
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)input[42] << 18) |
			((uint32_t)input[43] << 10) |
			((uint32_t)(input[44] & 0xe0) << 2);
	output[13] = (double)(value >> 7);
}

static void unpack_14_25bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 25-bit unsigned
	// Skip 5 bits, read 350 bits of data.
	// Input must be at least 45 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 29
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)input[1] << 21) |
			((uint32_t)input[2] << 13) |
			((uint32_t)(input[3] & 0xfc) << 5);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 30 to 54
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xfe) << 6);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 55 to 79
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)input[7] << 23) |
			((uint32_t)input[8] << 15) |
			((uint32_t)input[9] << 7);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 80 to 104
	value = ((uint32_t)input[10] << 24) |
			((uint32_t)input[11] << 16) |
			((uint32_t)input[12] << 8) |
			((uint32_t)(input[13] & 0x80));
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 105 to 129
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)input[14] << 17) |
			((uint32_t)input[15] << 9) |
			((uint32_t)(input[16] & 0xc0) << 1);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 130 to 154
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)input[17] << 18) |
			((uint32_t)input[18] << 10) |
			((uint32_t)(input[19] & 0xe0) << 2);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 155 to 179
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)input[20] << 19) |
			((uint32_t)input[21] << 11) |
			((uint32_t)(input[22] & 0xf0) << 3);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 180 to 204
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)input[23] << 20) |
			((uint32_t)input[24] << 12) |
			((uint32_t)(input[25] & 0xf8) << 4);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 205 to 229
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)input[26] << 21) |
			((uint32_t)input[27] << 13) |
			((uint32_t)(input[28] & 0xfc) << 5);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 230 to 254
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)input[29] << 22) |
			((uint32_t)input[30] << 14) |
			((uint32_t)(input[31] & 0xfe) << 6);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 255 to 279
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)input[32] << 23) |
			((uint32_t)input[33] << 15) |
			((uint32_t)input[34] << 7);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 280 to 304
	value = ((uint32_t)input[35] << 24) |
			((uint32_t)input[36] << 16) |
			((uint32_t)input[37] << 8) |
			((uint32_t)(input[38] & 0x80));
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 305 to 329
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)input[39] << 17) |
			((uint32_t)input[40] << 9) |
			((uint32_t)(input[41] & 0xc0) << 1);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 330 to 354
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)input[42] << 18) |
			((uint32_t)input[43] << 10) |
			((uint32_t)(input[44] & 0xe0) << 2);
	output[13] = (double)(value >> 7);
}

static void unpack_14_25bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 25-bit signed
	// Skip 6 bits, read 350 bits of data.
	// Input must be at least 45 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 30
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)input[1] << 22) |
			((uint32_t)input[2] << 14) |
			((uint32_t)(input[3] & 0xfe) << 6);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 31 to 55
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)input[4] << 23) |
			((uint32_t)input[5] << 15) |
			((uint32_t)input[6] << 7);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 56 to 80
	value = ((uint32_t)input[7] << 24) |
			((uint32_t)input[8] << 16) |
			((uint32_t)input[9] << 8) |
			((uint32_t)(input[10] & 0x80));
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 81 to 105
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)input[11] << 17) |
			((uint32_t)input[12] << 9) |
			((uint32_t)(input[13] & 0xc0) << 1);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 106 to 130
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)input[14] << 18) |
			((uint32_t)input[15] << 10) |
			((uint32_t)(input[16] & 0xe0) << 2);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 131 to 155
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)input[17] << 19) |
			((uint32_t)input[18] << 11) |
			((uint32_t)(input[19] & 0xf0) << 3);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 156 to 180
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)input[20] << 20) |
			((uint32_t)input[21] << 12) |
			((uint32_t)(input[22] & 0xf8) << 4);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 181 to 205
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)input[23] << 21) |
			((uint32_t)input[24] << 13) |
			((uint32_t)(input[25] & 0xfc) << 5);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 206 to 230
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)input[26] << 22) |
			((uint32_t)input[27] << 14) |
			((uint32_t)(input[28] & 0xfe) << 6);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 231 to 255
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)input[29] << 23) |
			((uint32_t)input[30] << 15) |
			((uint32_t)input[31] << 7);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 256 to 280
	value = ((uint32_t)input[32] << 24) |
			((uint32_t)input[33] << 16) |
			((uint32_t)input[34] << 8) |
			((uint32_t)(input[35] & 0x80));
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 281 to 305
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)input[36] << 17) |
			((uint32_t)input[37] << 9) |
			((uint32_t)(input[38] & 0xc0) << 1);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 306 to 330
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)input[39] << 18) |
			((uint32_t)input[40] << 10) |
			((uint32_t)(input[41] & 0xe0) << 2);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 331 to 355
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)input[42] << 19) |
			((uint32_t)input[43] << 11) |
			((uint32_t)(input[44] & 0xf0) << 3);
	output[13] = (double)(value >> 7);
}

static void unpack_14_25bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 25-bit unsigned
	// Skip 6 bits, read 350 bits of data.
	// Input must be at least 45 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 30
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)input[1] << 22) |
			((uint32_t)input[2] << 14) |
			((uint32_t)(input[3] & 0xfe) << 6);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 31 to 55
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)input[4] << 23) |
			((uint32_t)input[5] << 15) |
			((uint32_t)input[6] << 7);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 56 to 80
	value = ((uint32_t)input[7] << 24) |
			((uint32_t)input[8] << 16) |
			((uint32_t)input[9] << 8) |
			((uint32_t)(input[10] & 0x80));
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 81 to 105
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)input[11] << 17) |
			((uint32_t)input[12] << 9) |
			((uint32_t)(input[13] & 0xc0) << 1);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 106 to 130
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)input[14] << 18) |
			((uint32_t)input[15] << 10) |
			((uint32_t)(input[16] & 0xe0) << 2);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 131 to 155
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)input[17] << 19) |
			((uint32_t)input[18] << 11) |
			((uint32_t)(input[19] & 0xf0) << 3);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 156 to 180
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)input[20] << 20) |
			((uint32_t)input[21] << 12) |
			((uint32_t)(input[22] & 0xf8) << 4);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 181 to 205
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)input[23] << 21) |
			((uint32_t)input[24] << 13) |
			((uint32_t)(input[25] & 0xfc) << 5);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 206 to 230
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)input[26] << 22) |
			((uint32_t)input[27] << 14) |
			((uint32_t)(input[28] & 0xfe) << 6);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 231 to 255
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)input[29] << 23) |
			((uint32_t)input[30] << 15) |
			((uint32_t)input[31] << 7);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 256 to 280
	value = ((uint32_t)input[32] << 24) |
			((uint32_t)input[33] << 16) |
			((uint32_t)input[34] << 8) |
			((uint32_t)(input[35] & 0x80));
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 281 to 305
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)input[36] << 17) |
			((uint32_t)input[37] << 9) |
			((uint32_t)(input[38] & 0xc0) << 1);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 306 to 330
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)input[39] << 18) |
			((uint32_t)input[40] << 10) |
			((uint32_t)(input[41] & 0xe0) << 2);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 331 to 355
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)input[42] << 19) |
			((uint32_t)input[43] << 11) |
			((uint32_t)(input[44] & 0xf0) << 3);
	output[13] = (double)(value >> 7);
}

static void unpack_14_25bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 25-bit signed
	// Skip 7 bits, read 350 bits of data.
	// Input must be at least 45 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 31
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)input[1] << 23) |
			((uint32_t)input[2] << 15) |
			((uint32_t)input[3] << 7);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 32 to 56
	value = ((uint32_t)input[4] << 24) |
			((uint32_t)input[5] << 16) |
			((uint32_t)input[6] << 8) |
			((uint32_t)(input[7] & 0x80));
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 57 to 81
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)input[8] << 17) |
			((uint32_t)input[9] << 9) |
			((uint32_t)(input[10] & 0xc0) << 1);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 82 to 106
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)input[11] << 18) |
			((uint32_t)input[12] << 10) |
			((uint32_t)(input[13] & 0xe0) << 2);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 107 to 131
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)input[14] << 19) |
			((uint32_t)input[15] << 11) |
			((uint32_t)(input[16] & 0xf0) << 3);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 132 to 156
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)input[17] << 20) |
			((uint32_t)input[18] << 12) |
			((uint32_t)(input[19] & 0xf8) << 4);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 157 to 181
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)input[20] << 21) |
			((uint32_t)input[21] << 13) |
			((uint32_t)(input[22] & 0xfc) << 5);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 182 to 206
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)input[23] << 22) |
			((uint32_t)input[24] << 14) |
			((uint32_t)(input[25] & 0xfe) << 6);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 207 to 231
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)input[28] << 7);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 232 to 256
	value = ((uint32_t)input[29] << 24) |
			((uint32_t)input[30] << 16) |
			((uint32_t)input[31] << 8) |
			((uint32_t)(input[32] & 0x80));
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 257 to 281
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)input[33] << 17) |
			((uint32_t)input[34] << 9) |
			((uint32_t)(input[35] & 0xc0) << 1);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 282 to 306
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)input[36] << 18) |
			((uint32_t)input[37] << 10) |
			((uint32_t)(input[38] & 0xe0) << 2);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 307 to 331
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)input[39] << 19) |
			((uint32_t)input[40] << 11) |
			((uint32_t)(input[41] & 0xf0) << 3);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 332 to 356
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)input[42] << 20) |
			((uint32_t)input[43] << 12) |
			((uint32_t)(input[44] & 0xf8) << 4);
	output[13] = (double)(value >> 7);
}

static void unpack_14_25bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 25-bit unsigned
	// Skip 7 bits, read 350 bits of data.
	// Input must be at least 45 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 31
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)input[1] << 23) |
			((uint32_t)input[2] << 15) |
			((uint32_t)input[3] << 7);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 32 to 56
	value = ((uint32_t)input[4] << 24) |
			((uint32_t)input[5] << 16) |
			((uint32_t)input[6] << 8) |
			((uint32_t)(input[7] & 0x80));
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 57 to 81
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)input[8] << 17) |
			((uint32_t)input[9] << 9) |
			((uint32_t)(input[10] & 0xc0) << 1);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 82 to 106
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)input[11] << 18) |
			((uint32_t)input[12] << 10) |
			((uint32_t)(input[13] & 0xe0) << 2);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 107 to 131
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)input[14] << 19) |
			((uint32_t)input[15] << 11) |
			((uint32_t)(input[16] & 0xf0) << 3);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 132 to 156
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)input[17] << 20) |
			((uint32_t)input[18] << 12) |
			((uint32_t)(input[19] & 0xf8) << 4);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 157 to 181
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)input[20] << 21) |
			((uint32_t)input[21] << 13) |
			((uint32_t)(input[22] & 0xfc) << 5);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 182 to 206
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)input[23] << 22) |
			((uint32_t)input[24] << 14) |
			((uint32_t)(input[25] & 0xfe) << 6);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 207 to 231
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)input[28] << 7);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 232 to 256
	value = ((uint32_t)input[29] << 24) |
			((uint32_t)input[30] << 16) |
			((uint32_t)input[31] << 8) |
			((uint32_t)(input[32] & 0x80));
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 257 to 281
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)input[33] << 17) |
			((uint32_t)input[34] << 9) |
			((uint32_t)(input[35] & 0xc0) << 1);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 282 to 306
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)input[36] << 18) |
			((uint32_t)input[37] << 10) |
			((uint32_t)(input[38] & 0xe0) << 2);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 307 to 331
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)input[39] << 19) |
			((uint32_t)input[40] << 11) |
			((uint32_t)(input[41] & 0xf0) << 3);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 332 to 356
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)input[42] << 20) |
			((uint32_t)input[43] << 12) |
			((uint32_t)(input[44] & 0xf8) << 4);
	output[13] = (double)(value >> 7);
}

static void unpack_15_25bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 25-bit signed
	// Skip 0 bits, read 375 bits of data.
	// Input must be at least 47 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 24
	value = ((uint32_t)input[0] << 24) |
			((uint32_t)input[1] << 16) |
			((uint32_t)input[2] << 8) |
			((uint32_t)(input[3] & 0x80));
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 25 to 49
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)input[4] << 17) |
			((uint32_t)input[5] << 9) |
			((uint32_t)(input[6] & 0xc0) << 1);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 50 to 74
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0xe0) << 2);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 75 to 99
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xf0) << 3);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 100 to 124
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)input[13] << 20) |
			((uint32_t)input[14] << 12) |
			((uint32_t)(input[15] & 0xf8) << 4);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 125 to 149
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)input[16] << 21) |
			((uint32_t)input[17] << 13) |
			((uint32_t)(input[18] & 0xfc) << 5);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 150 to 174
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)input[19] << 22) |
			((uint32_t)input[20] << 14) |
			((uint32_t)(input[21] & 0xfe) << 6);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 175 to 199
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)input[22] << 23) |
			((uint32_t)input[23] << 15) |
			((uint32_t)input[24] << 7);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 200 to 224
	value = ((uint32_t)input[25] << 24) |
			((uint32_t)input[26] << 16) |
			((uint32_t)input[27] << 8) |
			((uint32_t)(input[28] & 0x80));
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 225 to 249
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)input[29] << 17) |
			((uint32_t)input[30] << 9) |
			((uint32_t)(input[31] & 0xc0) << 1);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 250 to 274
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)input[32] << 18) |
			((uint32_t)input[33] << 10) |
			((uint32_t)(input[34] & 0xe0) << 2);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 275 to 299
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)input[35] << 19) |
			((uint32_t)input[36] << 11) |
			((uint32_t)(input[37] & 0xf0) << 3);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 300 to 324
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)input[38] << 20) |
			((uint32_t)input[39] << 12) |
			((uint32_t)(input[40] & 0xf8) << 4);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 325 to 349
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)input[41] << 21) |
			((uint32_t)input[42] << 13) |
			((uint32_t)(input[43] & 0xfc) << 5);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 350 to 374
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)input[44] << 22) |
			((uint32_t)input[45] << 14) |
			((uint32_t)(input[46] & 0xfe) << 6);
	output[14] = (double)(value >> 7);
}

static void unpack_15_25bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 25-bit unsigned
	// Skip 0 bits, read 375 bits of data.
	// Input must be at least 47 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 24
	value = ((uint32_t)input[0] << 24) |
			((uint32_t)input[1] << 16) |
			((uint32_t)input[2] << 8) |
			((uint32_t)(input[3] & 0x80));
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 25 to 49
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)input[4] << 17) |
			((uint32_t)input[5] << 9) |
			((uint32_t)(input[6] & 0xc0) << 1);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 50 to 74
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0xe0) << 2);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 75 to 99
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xf0) << 3);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 100 to 124
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)input[13] << 20) |
			((uint32_t)input[14] << 12) |
			((uint32_t)(input[15] & 0xf8) << 4);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 125 to 149
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)input[16] << 21) |
			((uint32_t)input[17] << 13) |
			((uint32_t)(input[18] & 0xfc) << 5);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 150 to 174
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)input[19] << 22) |
			((uint32_t)input[20] << 14) |
			((uint32_t)(input[21] & 0xfe) << 6);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 175 to 199
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)input[22] << 23) |
			((uint32_t)input[23] << 15) |
			((uint32_t)input[24] << 7);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 200 to 224
	value = ((uint32_t)input[25] << 24) |
			((uint32_t)input[26] << 16) |
			((uint32_t)input[27] << 8) |
			((uint32_t)(input[28] & 0x80));
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 225 to 249
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)input[29] << 17) |
			((uint32_t)input[30] << 9) |
			((uint32_t)(input[31] & 0xc0) << 1);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 250 to 274
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)input[32] << 18) |
			((uint32_t)input[33] << 10) |
			((uint32_t)(input[34] & 0xe0) << 2);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 275 to 299
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)input[35] << 19) |
			((uint32_t)input[36] << 11) |
			((uint32_t)(input[37] & 0xf0) << 3);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 300 to 324
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)input[38] << 20) |
			((uint32_t)input[39] << 12) |
			((uint32_t)(input[40] & 0xf8) << 4);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 325 to 349
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)input[41] << 21) |
			((uint32_t)input[42] << 13) |
			((uint32_t)(input[43] & 0xfc) << 5);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 350 to 374
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)input[44] << 22) |
			((uint32_t)input[45] << 14) |
			((uint32_t)(input[46] & 0xfe) << 6);
	output[14] = (double)(value >> 7);
}

static void unpack_15_25bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 25-bit signed
	// Skip 1 bits, read 375 bits of data.
	// Input must be at least 47 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 25
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)input[1] << 17) |
			((uint32_t)input[2] << 9) |
			((uint32_t)(input[3] & 0xc0) << 1);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 26 to 50
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0xe0) << 2);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 51 to 75
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xf0) << 3);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 76 to 100
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xf8) << 4);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 101 to 125
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)input[13] << 21) |
			((uint32_t)input[14] << 13) |
			((uint32_t)(input[15] & 0xfc) << 5);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 126 to 150
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)input[16] << 22) |
			((uint32_t)input[17] << 14) |
			((uint32_t)(input[18] & 0xfe) << 6);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 151 to 175
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)input[19] << 23) |
			((uint32_t)input[20] << 15) |
			((uint32_t)input[21] << 7);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 176 to 200
	value = ((uint32_t)input[22] << 24) |
			((uint32_t)input[23] << 16) |
			((uint32_t)input[24] << 8) |
			((uint32_t)(input[25] & 0x80));
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 201 to 225
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)input[26] << 17) |
			((uint32_t)input[27] << 9) |
			((uint32_t)(input[28] & 0xc0) << 1);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 226 to 250
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)input[29] << 18) |
			((uint32_t)input[30] << 10) |
			((uint32_t)(input[31] & 0xe0) << 2);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 251 to 275
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)input[32] << 19) |
			((uint32_t)input[33] << 11) |
			((uint32_t)(input[34] & 0xf0) << 3);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 276 to 300
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)input[35] << 20) |
			((uint32_t)input[36] << 12) |
			((uint32_t)(input[37] & 0xf8) << 4);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 301 to 325
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)input[38] << 21) |
			((uint32_t)input[39] << 13) |
			((uint32_t)(input[40] & 0xfc) << 5);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 326 to 350
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)input[41] << 22) |
			((uint32_t)input[42] << 14) |
			((uint32_t)(input[43] & 0xfe) << 6);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 351 to 375
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)input[44] << 23) |
			((uint32_t)input[45] << 15) |
			((uint32_t)input[46] << 7);
	output[14] = (double)(value >> 7);
}

static void unpack_15_25bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 25-bit unsigned
	// Skip 1 bits, read 375 bits of data.
	// Input must be at least 47 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 25
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)input[1] << 17) |
			((uint32_t)input[2] << 9) |
			((uint32_t)(input[3] & 0xc0) << 1);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 26 to 50
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0xe0) << 2);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 51 to 75
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xf0) << 3);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 76 to 100
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xf8) << 4);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 101 to 125
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)input[13] << 21) |
			((uint32_t)input[14] << 13) |
			((uint32_t)(input[15] & 0xfc) << 5);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 126 to 150
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)input[16] << 22) |
			((uint32_t)input[17] << 14) |
			((uint32_t)(input[18] & 0xfe) << 6);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 151 to 175
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)input[19] << 23) |
			((uint32_t)input[20] << 15) |
			((uint32_t)input[21] << 7);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 176 to 200
	value = ((uint32_t)input[22] << 24) |
			((uint32_t)input[23] << 16) |
			((uint32_t)input[24] << 8) |
			((uint32_t)(input[25] & 0x80));
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 201 to 225
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)input[26] << 17) |
			((uint32_t)input[27] << 9) |
			((uint32_t)(input[28] & 0xc0) << 1);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 226 to 250
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)input[29] << 18) |
			((uint32_t)input[30] << 10) |
			((uint32_t)(input[31] & 0xe0) << 2);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 251 to 275
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)input[32] << 19) |
			((uint32_t)input[33] << 11) |
			((uint32_t)(input[34] & 0xf0) << 3);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 276 to 300
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)input[35] << 20) |
			((uint32_t)input[36] << 12) |
			((uint32_t)(input[37] & 0xf8) << 4);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 301 to 325
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)input[38] << 21) |
			((uint32_t)input[39] << 13) |
			((uint32_t)(input[40] & 0xfc) << 5);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 326 to 350
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)input[41] << 22) |
			((uint32_t)input[42] << 14) |
			((uint32_t)(input[43] & 0xfe) << 6);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 351 to 375
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)input[44] << 23) |
			((uint32_t)input[45] << 15) |
			((uint32_t)input[46] << 7);
	output[14] = (double)(value >> 7);
}

static void unpack_15_25bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 25-bit signed
	// Skip 2 bits, read 375 bits of data.
	// Input must be at least 48 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 26
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)input[1] << 18) |
			((uint32_t)input[2] << 10) |
			((uint32_t)(input[3] & 0xe0) << 2);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 27 to 51
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xf0) << 3);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 52 to 76
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xf8) << 4);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 77 to 101
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)input[10] << 21) |
			((uint32_t)input[11] << 13) |
			((uint32_t)(input[12] & 0xfc) << 5);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 102 to 126
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)input[13] << 22) |
			((uint32_t)input[14] << 14) |
			((uint32_t)(input[15] & 0xfe) << 6);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 127 to 151
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)input[16] << 23) |
			((uint32_t)input[17] << 15) |
			((uint32_t)input[18] << 7);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 152 to 176
	value = ((uint32_t)input[19] << 24) |
			((uint32_t)input[20] << 16) |
			((uint32_t)input[21] << 8) |
			((uint32_t)(input[22] & 0x80));
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 177 to 201
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)input[23] << 17) |
			((uint32_t)input[24] << 9) |
			((uint32_t)(input[25] & 0xc0) << 1);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 202 to 226
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)input[26] << 18) |
			((uint32_t)input[27] << 10) |
			((uint32_t)(input[28] & 0xe0) << 2);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 227 to 251
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)input[29] << 19) |
			((uint32_t)input[30] << 11) |
			((uint32_t)(input[31] & 0xf0) << 3);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 252 to 276
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)input[32] << 20) |
			((uint32_t)input[33] << 12) |
			((uint32_t)(input[34] & 0xf8) << 4);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 277 to 301
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)input[35] << 21) |
			((uint32_t)input[36] << 13) |
			((uint32_t)(input[37] & 0xfc) << 5);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 302 to 326
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)input[38] << 22) |
			((uint32_t)input[39] << 14) |
			((uint32_t)(input[40] & 0xfe) << 6);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 327 to 351
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)input[41] << 23) |
			((uint32_t)input[42] << 15) |
			((uint32_t)input[43] << 7);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 352 to 376
	value = ((uint32_t)input[44] << 24) |
			((uint32_t)input[45] << 16) |
			((uint32_t)input[46] << 8) |
			((uint32_t)(input[47] & 0x80));
	output[14] = (double)(value >> 7);
}

static void unpack_15_25bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 25-bit unsigned
	// Skip 2 bits, read 375 bits of data.
	// Input must be at least 48 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 26
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)input[1] << 18) |
			((uint32_t)input[2] << 10) |
			((uint32_t)(input[3] & 0xe0) << 2);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 27 to 51
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xf0) << 3);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 52 to 76
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xf8) << 4);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 77 to 101
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)input[10] << 21) |
			((uint32_t)input[11] << 13) |
			((uint32_t)(input[12] & 0xfc) << 5);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 102 to 126
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)input[13] << 22) |
			((uint32_t)input[14] << 14) |
			((uint32_t)(input[15] & 0xfe) << 6);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 127 to 151
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)input[16] << 23) |
			((uint32_t)input[17] << 15) |
			((uint32_t)input[18] << 7);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 152 to 176
	value = ((uint32_t)input[19] << 24) |
			((uint32_t)input[20] << 16) |
			((uint32_t)input[21] << 8) |
			((uint32_t)(input[22] & 0x80));
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 177 to 201
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)input[23] << 17) |
			((uint32_t)input[24] << 9) |
			((uint32_t)(input[25] & 0xc0) << 1);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 202 to 226
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)input[26] << 18) |
			((uint32_t)input[27] << 10) |
			((uint32_t)(input[28] & 0xe0) << 2);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 227 to 251
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)input[29] << 19) |
			((uint32_t)input[30] << 11) |
			((uint32_t)(input[31] & 0xf0) << 3);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 252 to 276
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)input[32] << 20) |
			((uint32_t)input[33] << 12) |
			((uint32_t)(input[34] & 0xf8) << 4);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 277 to 301
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)input[35] << 21) |
			((uint32_t)input[36] << 13) |
			((uint32_t)(input[37] & 0xfc) << 5);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 302 to 326
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)input[38] << 22) |
			((uint32_t)input[39] << 14) |
			((uint32_t)(input[40] & 0xfe) << 6);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 327 to 351
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)input[41] << 23) |
			((uint32_t)input[42] << 15) |
			((uint32_t)input[43] << 7);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 352 to 376
	value = ((uint32_t)input[44] << 24) |
			((uint32_t)input[45] << 16) |
			((uint32_t)input[46] << 8) |
			((uint32_t)(input[47] & 0x80));
	output[14] = (double)(value >> 7);
}

static void unpack_15_25bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 25-bit signed
	// Skip 3 bits, read 375 bits of data.
	// Input must be at least 48 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 27
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)input[1] << 19) |
			((uint32_t)input[2] << 11) |
			((uint32_t)(input[3] & 0xf0) << 3);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 28 to 52
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xf8) << 4);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 53 to 77
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xfc) << 5);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 78 to 102
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)input[10] << 22) |
			((uint32_t)input[11] << 14) |
			((uint32_t)(input[12] & 0xfe) << 6);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 103 to 127
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)input[13] << 23) |
			((uint32_t)input[14] << 15) |
			((uint32_t)input[15] << 7);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 128 to 152
	value = ((uint32_t)input[16] << 24) |
			((uint32_t)input[17] << 16) |
			((uint32_t)input[18] << 8) |
			((uint32_t)(input[19] & 0x80));
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 153 to 177
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)input[20] << 17) |
			((uint32_t)input[21] << 9) |
			((uint32_t)(input[22] & 0xc0) << 1);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 178 to 202
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)input[23] << 18) |
			((uint32_t)input[24] << 10) |
			((uint32_t)(input[25] & 0xe0) << 2);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 203 to 227
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)input[26] << 19) |
			((uint32_t)input[27] << 11) |
			((uint32_t)(input[28] & 0xf0) << 3);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 228 to 252
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)input[29] << 20) |
			((uint32_t)input[30] << 12) |
			((uint32_t)(input[31] & 0xf8) << 4);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 253 to 277
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)input[32] << 21) |
			((uint32_t)input[33] << 13) |
			((uint32_t)(input[34] & 0xfc) << 5);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 278 to 302
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)input[35] << 22) |
			((uint32_t)input[36] << 14) |
			((uint32_t)(input[37] & 0xfe) << 6);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 303 to 327
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)input[38] << 23) |
			((uint32_t)input[39] << 15) |
			((uint32_t)input[40] << 7);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 328 to 352
	value = ((uint32_t)input[41] << 24) |
			((uint32_t)input[42] << 16) |
			((uint32_t)input[43] << 8) |
			((uint32_t)(input[44] & 0x80));
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 353 to 377
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)input[45] << 17) |
			((uint32_t)input[46] << 9) |
			((uint32_t)(input[47] & 0xc0) << 1);
	output[14] = (double)(value >> 7);
}

static void unpack_15_25bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 25-bit unsigned
	// Skip 3 bits, read 375 bits of data.
	// Input must be at least 48 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 27
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)input[1] << 19) |
			((uint32_t)input[2] << 11) |
			((uint32_t)(input[3] & 0xf0) << 3);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 28 to 52
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xf8) << 4);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 53 to 77
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xfc) << 5);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 78 to 102
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)input[10] << 22) |
			((uint32_t)input[11] << 14) |
			((uint32_t)(input[12] & 0xfe) << 6);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 103 to 127
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)input[13] << 23) |
			((uint32_t)input[14] << 15) |
			((uint32_t)input[15] << 7);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 128 to 152
	value = ((uint32_t)input[16] << 24) |
			((uint32_t)input[17] << 16) |
			((uint32_t)input[18] << 8) |
			((uint32_t)(input[19] & 0x80));
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 153 to 177
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)input[20] << 17) |
			((uint32_t)input[21] << 9) |
			((uint32_t)(input[22] & 0xc0) << 1);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 178 to 202
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)input[23] << 18) |
			((uint32_t)input[24] << 10) |
			((uint32_t)(input[25] & 0xe0) << 2);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 203 to 227
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)input[26] << 19) |
			((uint32_t)input[27] << 11) |
			((uint32_t)(input[28] & 0xf0) << 3);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 228 to 252
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)input[29] << 20) |
			((uint32_t)input[30] << 12) |
			((uint32_t)(input[31] & 0xf8) << 4);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 253 to 277
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)input[32] << 21) |
			((uint32_t)input[33] << 13) |
			((uint32_t)(input[34] & 0xfc) << 5);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 278 to 302
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)input[35] << 22) |
			((uint32_t)input[36] << 14) |
			((uint32_t)(input[37] & 0xfe) << 6);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 303 to 327
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)input[38] << 23) |
			((uint32_t)input[39] << 15) |
			((uint32_t)input[40] << 7);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 328 to 352
	value = ((uint32_t)input[41] << 24) |
			((uint32_t)input[42] << 16) |
			((uint32_t)input[43] << 8) |
			((uint32_t)(input[44] & 0x80));
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 353 to 377
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)input[45] << 17) |
			((uint32_t)input[46] << 9) |
			((uint32_t)(input[47] & 0xc0) << 1);
	output[14] = (double)(value >> 7);
}

static void unpack_15_25bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 25-bit signed
	// Skip 4 bits, read 375 bits of data.
	// Input must be at least 48 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 28
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)input[1] << 20) |
			((uint32_t)input[2] << 12) |
			((uint32_t)(input[3] & 0xf8) << 4);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 29 to 53
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xfc) << 5);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 54 to 78
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)input[7] << 22) |
			((uint32_t)input[8] << 14) |
			((uint32_t)(input[9] & 0xfe) << 6);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 79 to 103
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)input[10] << 23) |
			((uint32_t)input[11] << 15) |
			((uint32_t)input[12] << 7);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 104 to 128
	value = ((uint32_t)input[13] << 24) |
			((uint32_t)input[14] << 16) |
			((uint32_t)input[15] << 8) |
			((uint32_t)(input[16] & 0x80));
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 129 to 153
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)input[17] << 17) |
			((uint32_t)input[18] << 9) |
			((uint32_t)(input[19] & 0xc0) << 1);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 154 to 178
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)input[20] << 18) |
			((uint32_t)input[21] << 10) |
			((uint32_t)(input[22] & 0xe0) << 2);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 179 to 203
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)input[23] << 19) |
			((uint32_t)input[24] << 11) |
			((uint32_t)(input[25] & 0xf0) << 3);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 204 to 228
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)input[26] << 20) |
			((uint32_t)input[27] << 12) |
			((uint32_t)(input[28] & 0xf8) << 4);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 229 to 253
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)input[29] << 21) |
			((uint32_t)input[30] << 13) |
			((uint32_t)(input[31] & 0xfc) << 5);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 254 to 278
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)input[32] << 22) |
			((uint32_t)input[33] << 14) |
			((uint32_t)(input[34] & 0xfe) << 6);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 279 to 303
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)input[35] << 23) |
			((uint32_t)input[36] << 15) |
			((uint32_t)input[37] << 7);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 304 to 328
	value = ((uint32_t)input[38] << 24) |
			((uint32_t)input[39] << 16) |
			((uint32_t)input[40] << 8) |
			((uint32_t)(input[41] & 0x80));
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 329 to 353
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)input[42] << 17) |
			((uint32_t)input[43] << 9) |
			((uint32_t)(input[44] & 0xc0) << 1);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 354 to 378
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)input[45] << 18) |
			((uint32_t)input[46] << 10) |
			((uint32_t)(input[47] & 0xe0) << 2);
	output[14] = (double)(value >> 7);
}

static void unpack_15_25bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 25-bit unsigned
	// Skip 4 bits, read 375 bits of data.
	// Input must be at least 48 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 28
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)input[1] << 20) |
			((uint32_t)input[2] << 12) |
			((uint32_t)(input[3] & 0xf8) << 4);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 29 to 53
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xfc) << 5);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 54 to 78
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)input[7] << 22) |
			((uint32_t)input[8] << 14) |
			((uint32_t)(input[9] & 0xfe) << 6);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 79 to 103
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)input[10] << 23) |
			((uint32_t)input[11] << 15) |
			((uint32_t)input[12] << 7);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 104 to 128
	value = ((uint32_t)input[13] << 24) |
			((uint32_t)input[14] << 16) |
			((uint32_t)input[15] << 8) |
			((uint32_t)(input[16] & 0x80));
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 129 to 153
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)input[17] << 17) |
			((uint32_t)input[18] << 9) |
			((uint32_t)(input[19] & 0xc0) << 1);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 154 to 178
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)input[20] << 18) |
			((uint32_t)input[21] << 10) |
			((uint32_t)(input[22] & 0xe0) << 2);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 179 to 203
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)input[23] << 19) |
			((uint32_t)input[24] << 11) |
			((uint32_t)(input[25] & 0xf0) << 3);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 204 to 228
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)input[26] << 20) |
			((uint32_t)input[27] << 12) |
			((uint32_t)(input[28] & 0xf8) << 4);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 229 to 253
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)input[29] << 21) |
			((uint32_t)input[30] << 13) |
			((uint32_t)(input[31] & 0xfc) << 5);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 254 to 278
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)input[32] << 22) |
			((uint32_t)input[33] << 14) |
			((uint32_t)(input[34] & 0xfe) << 6);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 279 to 303
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)input[35] << 23) |
			((uint32_t)input[36] << 15) |
			((uint32_t)input[37] << 7);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 304 to 328
	value = ((uint32_t)input[38] << 24) |
			((uint32_t)input[39] << 16) |
			((uint32_t)input[40] << 8) |
			((uint32_t)(input[41] & 0x80));
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 329 to 353
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)input[42] << 17) |
			((uint32_t)input[43] << 9) |
			((uint32_t)(input[44] & 0xc0) << 1);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 354 to 378
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)input[45] << 18) |
			((uint32_t)input[46] << 10) |
			((uint32_t)(input[47] & 0xe0) << 2);
	output[14] = (double)(value >> 7);
}

static void unpack_15_25bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 25-bit signed
	// Skip 5 bits, read 375 bits of data.
	// Input must be at least 48 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 29
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)input[1] << 21) |
			((uint32_t)input[2] << 13) |
			((uint32_t)(input[3] & 0xfc) << 5);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 30 to 54
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xfe) << 6);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 55 to 79
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)input[7] << 23) |
			((uint32_t)input[8] << 15) |
			((uint32_t)input[9] << 7);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 80 to 104
	value = ((uint32_t)input[10] << 24) |
			((uint32_t)input[11] << 16) |
			((uint32_t)input[12] << 8) |
			((uint32_t)(input[13] & 0x80));
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 105 to 129
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)input[14] << 17) |
			((uint32_t)input[15] << 9) |
			((uint32_t)(input[16] & 0xc0) << 1);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 130 to 154
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)input[17] << 18) |
			((uint32_t)input[18] << 10) |
			((uint32_t)(input[19] & 0xe0) << 2);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 155 to 179
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)input[20] << 19) |
			((uint32_t)input[21] << 11) |
			((uint32_t)(input[22] & 0xf0) << 3);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 180 to 204
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)input[23] << 20) |
			((uint32_t)input[24] << 12) |
			((uint32_t)(input[25] & 0xf8) << 4);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 205 to 229
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)input[26] << 21) |
			((uint32_t)input[27] << 13) |
			((uint32_t)(input[28] & 0xfc) << 5);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 230 to 254
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)input[29] << 22) |
			((uint32_t)input[30] << 14) |
			((uint32_t)(input[31] & 0xfe) << 6);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 255 to 279
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)input[32] << 23) |
			((uint32_t)input[33] << 15) |
			((uint32_t)input[34] << 7);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 280 to 304
	value = ((uint32_t)input[35] << 24) |
			((uint32_t)input[36] << 16) |
			((uint32_t)input[37] << 8) |
			((uint32_t)(input[38] & 0x80));
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 305 to 329
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)input[39] << 17) |
			((uint32_t)input[40] << 9) |
			((uint32_t)(input[41] & 0xc0) << 1);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 330 to 354
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)input[42] << 18) |
			((uint32_t)input[43] << 10) |
			((uint32_t)(input[44] & 0xe0) << 2);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 355 to 379
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)input[45] << 19) |
			((uint32_t)input[46] << 11) |
			((uint32_t)(input[47] & 0xf0) << 3);
	output[14] = (double)(value >> 7);
}

static void unpack_15_25bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 25-bit unsigned
	// Skip 5 bits, read 375 bits of data.
	// Input must be at least 48 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 29
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)input[1] << 21) |
			((uint32_t)input[2] << 13) |
			((uint32_t)(input[3] & 0xfc) << 5);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 30 to 54
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xfe) << 6);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 55 to 79
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)input[7] << 23) |
			((uint32_t)input[8] << 15) |
			((uint32_t)input[9] << 7);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 80 to 104
	value = ((uint32_t)input[10] << 24) |
			((uint32_t)input[11] << 16) |
			((uint32_t)input[12] << 8) |
			((uint32_t)(input[13] & 0x80));
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 105 to 129
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)input[14] << 17) |
			((uint32_t)input[15] << 9) |
			((uint32_t)(input[16] & 0xc0) << 1);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 130 to 154
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)input[17] << 18) |
			((uint32_t)input[18] << 10) |
			((uint32_t)(input[19] & 0xe0) << 2);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 155 to 179
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)input[20] << 19) |
			((uint32_t)input[21] << 11) |
			((uint32_t)(input[22] & 0xf0) << 3);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 180 to 204
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)input[23] << 20) |
			((uint32_t)input[24] << 12) |
			((uint32_t)(input[25] & 0xf8) << 4);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 205 to 229
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)input[26] << 21) |
			((uint32_t)input[27] << 13) |
			((uint32_t)(input[28] & 0xfc) << 5);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 230 to 254
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)input[29] << 22) |
			((uint32_t)input[30] << 14) |
			((uint32_t)(input[31] & 0xfe) << 6);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 255 to 279
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)input[32] << 23) |
			((uint32_t)input[33] << 15) |
			((uint32_t)input[34] << 7);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 280 to 304
	value = ((uint32_t)input[35] << 24) |
			((uint32_t)input[36] << 16) |
			((uint32_t)input[37] << 8) |
			((uint32_t)(input[38] & 0x80));
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 305 to 329
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)input[39] << 17) |
			((uint32_t)input[40] << 9) |
			((uint32_t)(input[41] & 0xc0) << 1);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 330 to 354
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)input[42] << 18) |
			((uint32_t)input[43] << 10) |
			((uint32_t)(input[44] & 0xe0) << 2);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 355 to 379
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)input[45] << 19) |
			((uint32_t)input[46] << 11) |
			((uint32_t)(input[47] & 0xf0) << 3);
	output[14] = (double)(value >> 7);
}

static void unpack_15_25bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 25-bit signed
	// Skip 6 bits, read 375 bits of data.
	// Input must be at least 48 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 30
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)input[1] << 22) |
			((uint32_t)input[2] << 14) |
			((uint32_t)(input[3] & 0xfe) << 6);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 31 to 55
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)input[4] << 23) |
			((uint32_t)input[5] << 15) |
			((uint32_t)input[6] << 7);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 56 to 80
	value = ((uint32_t)input[7] << 24) |
			((uint32_t)input[8] << 16) |
			((uint32_t)input[9] << 8) |
			((uint32_t)(input[10] & 0x80));
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 81 to 105
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)input[11] << 17) |
			((uint32_t)input[12] << 9) |
			((uint32_t)(input[13] & 0xc0) << 1);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 106 to 130
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)input[14] << 18) |
			((uint32_t)input[15] << 10) |
			((uint32_t)(input[16] & 0xe0) << 2);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 131 to 155
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)input[17] << 19) |
			((uint32_t)input[18] << 11) |
			((uint32_t)(input[19] & 0xf0) << 3);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 156 to 180
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)input[20] << 20) |
			((uint32_t)input[21] << 12) |
			((uint32_t)(input[22] & 0xf8) << 4);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 181 to 205
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)input[23] << 21) |
			((uint32_t)input[24] << 13) |
			((uint32_t)(input[25] & 0xfc) << 5);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 206 to 230
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)input[26] << 22) |
			((uint32_t)input[27] << 14) |
			((uint32_t)(input[28] & 0xfe) << 6);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 231 to 255
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)input[29] << 23) |
			((uint32_t)input[30] << 15) |
			((uint32_t)input[31] << 7);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 256 to 280
	value = ((uint32_t)input[32] << 24) |
			((uint32_t)input[33] << 16) |
			((uint32_t)input[34] << 8) |
			((uint32_t)(input[35] & 0x80));
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 281 to 305
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)input[36] << 17) |
			((uint32_t)input[37] << 9) |
			((uint32_t)(input[38] & 0xc0) << 1);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 306 to 330
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)input[39] << 18) |
			((uint32_t)input[40] << 10) |
			((uint32_t)(input[41] & 0xe0) << 2);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 331 to 355
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)input[42] << 19) |
			((uint32_t)input[43] << 11) |
			((uint32_t)(input[44] & 0xf0) << 3);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 356 to 380
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)input[45] << 20) |
			((uint32_t)input[46] << 12) |
			((uint32_t)(input[47] & 0xf8) << 4);
	output[14] = (double)(value >> 7);
}

static void unpack_15_25bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 25-bit unsigned
	// Skip 6 bits, read 375 bits of data.
	// Input must be at least 48 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 30
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)input[1] << 22) |
			((uint32_t)input[2] << 14) |
			((uint32_t)(input[3] & 0xfe) << 6);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 31 to 55
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)input[4] << 23) |
			((uint32_t)input[5] << 15) |
			((uint32_t)input[6] << 7);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 56 to 80
	value = ((uint32_t)input[7] << 24) |
			((uint32_t)input[8] << 16) |
			((uint32_t)input[9] << 8) |
			((uint32_t)(input[10] & 0x80));
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 81 to 105
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)input[11] << 17) |
			((uint32_t)input[12] << 9) |
			((uint32_t)(input[13] & 0xc0) << 1);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 106 to 130
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)input[14] << 18) |
			((uint32_t)input[15] << 10) |
			((uint32_t)(input[16] & 0xe0) << 2);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 131 to 155
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)input[17] << 19) |
			((uint32_t)input[18] << 11) |
			((uint32_t)(input[19] & 0xf0) << 3);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 156 to 180
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)input[20] << 20) |
			((uint32_t)input[21] << 12) |
			((uint32_t)(input[22] & 0xf8) << 4);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 181 to 205
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)input[23] << 21) |
			((uint32_t)input[24] << 13) |
			((uint32_t)(input[25] & 0xfc) << 5);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 206 to 230
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)input[26] << 22) |
			((uint32_t)input[27] << 14) |
			((uint32_t)(input[28] & 0xfe) << 6);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 231 to 255
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)input[29] << 23) |
			((uint32_t)input[30] << 15) |
			((uint32_t)input[31] << 7);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 256 to 280
	value = ((uint32_t)input[32] << 24) |
			((uint32_t)input[33] << 16) |
			((uint32_t)input[34] << 8) |
			((uint32_t)(input[35] & 0x80));
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 281 to 305
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)input[36] << 17) |
			((uint32_t)input[37] << 9) |
			((uint32_t)(input[38] & 0xc0) << 1);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 306 to 330
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)input[39] << 18) |
			((uint32_t)input[40] << 10) |
			((uint32_t)(input[41] & 0xe0) << 2);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 331 to 355
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)input[42] << 19) |
			((uint32_t)input[43] << 11) |
			((uint32_t)(input[44] & 0xf0) << 3);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 356 to 380
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)input[45] << 20) |
			((uint32_t)input[46] << 12) |
			((uint32_t)(input[47] & 0xf8) << 4);
	output[14] = (double)(value >> 7);
}

static void unpack_15_25bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 25-bit signed
	// Skip 7 bits, read 375 bits of data.
	// Input must be at least 48 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 31
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)input[1] << 23) |
			((uint32_t)input[2] << 15) |
			((uint32_t)input[3] << 7);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 32 to 56
	value = ((uint32_t)input[4] << 24) |
			((uint32_t)input[5] << 16) |
			((uint32_t)input[6] << 8) |
			((uint32_t)(input[7] & 0x80));
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 57 to 81
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)input[8] << 17) |
			((uint32_t)input[9] << 9) |
			((uint32_t)(input[10] & 0xc0) << 1);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 82 to 106
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)input[11] << 18) |
			((uint32_t)input[12] << 10) |
			((uint32_t)(input[13] & 0xe0) << 2);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 107 to 131
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)input[14] << 19) |
			((uint32_t)input[15] << 11) |
			((uint32_t)(input[16] & 0xf0) << 3);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 132 to 156
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)input[17] << 20) |
			((uint32_t)input[18] << 12) |
			((uint32_t)(input[19] & 0xf8) << 4);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 157 to 181
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)input[20] << 21) |
			((uint32_t)input[21] << 13) |
			((uint32_t)(input[22] & 0xfc) << 5);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 182 to 206
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)input[23] << 22) |
			((uint32_t)input[24] << 14) |
			((uint32_t)(input[25] & 0xfe) << 6);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 207 to 231
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)input[28] << 7);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 232 to 256
	value = ((uint32_t)input[29] << 24) |
			((uint32_t)input[30] << 16) |
			((uint32_t)input[31] << 8) |
			((uint32_t)(input[32] & 0x80));
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 257 to 281
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)input[33] << 17) |
			((uint32_t)input[34] << 9) |
			((uint32_t)(input[35] & 0xc0) << 1);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 282 to 306
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)input[36] << 18) |
			((uint32_t)input[37] << 10) |
			((uint32_t)(input[38] & 0xe0) << 2);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 307 to 331
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)input[39] << 19) |
			((uint32_t)input[40] << 11) |
			((uint32_t)(input[41] & 0xf0) << 3);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 332 to 356
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)input[42] << 20) |
			((uint32_t)input[43] << 12) |
			((uint32_t)(input[44] & 0xf8) << 4);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 357 to 381
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)input[45] << 21) |
			((uint32_t)input[46] << 13) |
			((uint32_t)(input[47] & 0xfc) << 5);
	output[14] = (double)(value >> 7);
}

static void unpack_15_25bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 25-bit unsigned
	// Skip 7 bits, read 375 bits of data.
	// Input must be at least 48 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 31
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)input[1] << 23) |
			((uint32_t)input[2] << 15) |
			((uint32_t)input[3] << 7);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 32 to 56
	value = ((uint32_t)input[4] << 24) |
			((uint32_t)input[5] << 16) |
			((uint32_t)input[6] << 8) |
			((uint32_t)(input[7] & 0x80));
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 57 to 81
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)input[8] << 17) |
			((uint32_t)input[9] << 9) |
			((uint32_t)(input[10] & 0xc0) << 1);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 82 to 106
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)input[11] << 18) |
			((uint32_t)input[12] << 10) |
			((uint32_t)(input[13] & 0xe0) << 2);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 107 to 131
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)input[14] << 19) |
			((uint32_t)input[15] << 11) |
			((uint32_t)(input[16] & 0xf0) << 3);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 132 to 156
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)input[17] << 20) |
			((uint32_t)input[18] << 12) |
			((uint32_t)(input[19] & 0xf8) << 4);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 157 to 181
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)input[20] << 21) |
			((uint32_t)input[21] << 13) |
			((uint32_t)(input[22] & 0xfc) << 5);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 182 to 206
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)input[23] << 22) |
			((uint32_t)input[24] << 14) |
			((uint32_t)(input[25] & 0xfe) << 6);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 207 to 231
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)input[28] << 7);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 232 to 256
	value = ((uint32_t)input[29] << 24) |
			((uint32_t)input[30] << 16) |
			((uint32_t)input[31] << 8) |
			((uint32_t)(input[32] & 0x80));
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 257 to 281
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)input[33] << 17) |
			((uint32_t)input[34] << 9) |
			((uint32_t)(input[35] & 0xc0) << 1);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 282 to 306
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)input[36] << 18) |
			((uint32_t)input[37] << 10) |
			((uint32_t)(input[38] & 0xe0) << 2);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 307 to 331
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)input[39] << 19) |
			((uint32_t)input[40] << 11) |
			((uint32_t)(input[41] & 0xf0) << 3);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 332 to 356
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)input[42] << 20) |
			((uint32_t)input[43] << 12) |
			((uint32_t)(input[44] & 0xf8) << 4);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 357 to 381
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)input[45] << 21) |
			((uint32_t)input[46] << 13) |
			((uint32_t)(input[47] & 0xfc) << 5);
	output[14] = (double)(value >> 7);
}

static void unpack_16_25bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 25-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 24
	value = ((uint32_t)input[0] << 24) |
			((uint32_t)input[1] << 16) |
			((uint32_t)input[2] << 8) |
			((uint32_t)(input[3] & 0x80));
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 25 to 49
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)input[4] << 17) |
			((uint32_t)input[5] << 9) |
			((uint32_t)(input[6] & 0xc0) << 1);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 50 to 74
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0xe0) << 2);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 75 to 99
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xf0) << 3);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 100 to 124
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)input[13] << 20) |
			((uint32_t)input[14] << 12) |
			((uint32_t)(input[15] & 0xf8) << 4);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 125 to 149
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)input[16] << 21) |
			((uint32_t)input[17] << 13) |
			((uint32_t)(input[18] & 0xfc) << 5);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 150 to 174
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)input[19] << 22) |
			((uint32_t)input[20] << 14) |
			((uint32_t)(input[21] & 0xfe) << 6);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 175 to 199
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)input[22] << 23) |
			((uint32_t)input[23] << 15) |
			((uint32_t)input[24] << 7);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 200 to 224
	value = ((uint32_t)input[25] << 24) |
			((uint32_t)input[26] << 16) |
			((uint32_t)input[27] << 8) |
			((uint32_t)(input[28] & 0x80));
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 225 to 249
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)input[29] << 17) |
			((uint32_t)input[30] << 9) |
			((uint32_t)(input[31] & 0xc0) << 1);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 250 to 274
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)input[32] << 18) |
			((uint32_t)input[33] << 10) |
			((uint32_t)(input[34] & 0xe0) << 2);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 275 to 299
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)input[35] << 19) |
			((uint32_t)input[36] << 11) |
			((uint32_t)(input[37] & 0xf0) << 3);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 300 to 324
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)input[38] << 20) |
			((uint32_t)input[39] << 12) |
			((uint32_t)(input[40] & 0xf8) << 4);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 325 to 349
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)input[41] << 21) |
			((uint32_t)input[42] << 13) |
			((uint32_t)(input[43] & 0xfc) << 5);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 350 to 374
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)input[44] << 22) |
			((uint32_t)input[45] << 14) |
			((uint32_t)(input[46] & 0xfe) << 6);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 375 to 399
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)input[47] << 23) |
			((uint32_t)input[48] << 15) |
			((uint32_t)input[49] << 7);
	output[15] = (double)(value >> 7);
}

static void unpack_16_25bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 25-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 24
	value = ((uint32_t)input[0] << 24) |
			((uint32_t)input[1] << 16) |
			((uint32_t)input[2] << 8) |
			((uint32_t)(input[3] & 0x80));
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 25 to 49
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)input[4] << 17) |
			((uint32_t)input[5] << 9) |
			((uint32_t)(input[6] & 0xc0) << 1);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 50 to 74
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0xe0) << 2);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 75 to 99
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xf0) << 3);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 100 to 124
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)input[13] << 20) |
			((uint32_t)input[14] << 12) |
			((uint32_t)(input[15] & 0xf8) << 4);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 125 to 149
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)input[16] << 21) |
			((uint32_t)input[17] << 13) |
			((uint32_t)(input[18] & 0xfc) << 5);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 150 to 174
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)input[19] << 22) |
			((uint32_t)input[20] << 14) |
			((uint32_t)(input[21] & 0xfe) << 6);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 175 to 199
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)input[22] << 23) |
			((uint32_t)input[23] << 15) |
			((uint32_t)input[24] << 7);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 200 to 224
	value = ((uint32_t)input[25] << 24) |
			((uint32_t)input[26] << 16) |
			((uint32_t)input[27] << 8) |
			((uint32_t)(input[28] & 0x80));
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 225 to 249
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)input[29] << 17) |
			((uint32_t)input[30] << 9) |
			((uint32_t)(input[31] & 0xc0) << 1);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 250 to 274
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)input[32] << 18) |
			((uint32_t)input[33] << 10) |
			((uint32_t)(input[34] & 0xe0) << 2);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 275 to 299
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)input[35] << 19) |
			((uint32_t)input[36] << 11) |
			((uint32_t)(input[37] & 0xf0) << 3);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 300 to 324
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)input[38] << 20) |
			((uint32_t)input[39] << 12) |
			((uint32_t)(input[40] & 0xf8) << 4);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 325 to 349
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)input[41] << 21) |
			((uint32_t)input[42] << 13) |
			((uint32_t)(input[43] & 0xfc) << 5);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 350 to 374
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)input[44] << 22) |
			((uint32_t)input[45] << 14) |
			((uint32_t)(input[46] & 0xfe) << 6);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 375 to 399
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)input[47] << 23) |
			((uint32_t)input[48] << 15) |
			((uint32_t)input[49] << 7);
	output[15] = (double)(value >> 7);
}

static void unpack_16_25bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 25-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 25
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)input[1] << 17) |
			((uint32_t)input[2] << 9) |
			((uint32_t)(input[3] & 0xc0) << 1);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 26 to 50
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0xe0) << 2);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 51 to 75
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xf0) << 3);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 76 to 100
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xf8) << 4);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 101 to 125
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)input[13] << 21) |
			((uint32_t)input[14] << 13) |
			((uint32_t)(input[15] & 0xfc) << 5);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 126 to 150
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)input[16] << 22) |
			((uint32_t)input[17] << 14) |
			((uint32_t)(input[18] & 0xfe) << 6);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 151 to 175
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)input[19] << 23) |
			((uint32_t)input[20] << 15) |
			((uint32_t)input[21] << 7);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 176 to 200
	value = ((uint32_t)input[22] << 24) |
			((uint32_t)input[23] << 16) |
			((uint32_t)input[24] << 8) |
			((uint32_t)(input[25] & 0x80));
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 201 to 225
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)input[26] << 17) |
			((uint32_t)input[27] << 9) |
			((uint32_t)(input[28] & 0xc0) << 1);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 226 to 250
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)input[29] << 18) |
			((uint32_t)input[30] << 10) |
			((uint32_t)(input[31] & 0xe0) << 2);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 251 to 275
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)input[32] << 19) |
			((uint32_t)input[33] << 11) |
			((uint32_t)(input[34] & 0xf0) << 3);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 276 to 300
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)input[35] << 20) |
			((uint32_t)input[36] << 12) |
			((uint32_t)(input[37] & 0xf8) << 4);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 301 to 325
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)input[38] << 21) |
			((uint32_t)input[39] << 13) |
			((uint32_t)(input[40] & 0xfc) << 5);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 326 to 350
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)input[41] << 22) |
			((uint32_t)input[42] << 14) |
			((uint32_t)(input[43] & 0xfe) << 6);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 351 to 375
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)input[44] << 23) |
			((uint32_t)input[45] << 15) |
			((uint32_t)input[46] << 7);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 376 to 400
	value = ((uint32_t)input[47] << 24) |
			((uint32_t)input[48] << 16) |
			((uint32_t)input[49] << 8) |
			((uint32_t)(input[50] & 0x80));
	output[15] = (double)(value >> 7);
}

static void unpack_16_25bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 25-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 25
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)input[1] << 17) |
			((uint32_t)input[2] << 9) |
			((uint32_t)(input[3] & 0xc0) << 1);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 26 to 50
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0xe0) << 2);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 51 to 75
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xf0) << 3);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 76 to 100
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xf8) << 4);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 101 to 125
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)input[13] << 21) |
			((uint32_t)input[14] << 13) |
			((uint32_t)(input[15] & 0xfc) << 5);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 126 to 150
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)input[16] << 22) |
			((uint32_t)input[17] << 14) |
			((uint32_t)(input[18] & 0xfe) << 6);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 151 to 175
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)input[19] << 23) |
			((uint32_t)input[20] << 15) |
			((uint32_t)input[21] << 7);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 176 to 200
	value = ((uint32_t)input[22] << 24) |
			((uint32_t)input[23] << 16) |
			((uint32_t)input[24] << 8) |
			((uint32_t)(input[25] & 0x80));
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 201 to 225
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)input[26] << 17) |
			((uint32_t)input[27] << 9) |
			((uint32_t)(input[28] & 0xc0) << 1);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 226 to 250
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)input[29] << 18) |
			((uint32_t)input[30] << 10) |
			((uint32_t)(input[31] & 0xe0) << 2);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 251 to 275
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)input[32] << 19) |
			((uint32_t)input[33] << 11) |
			((uint32_t)(input[34] & 0xf0) << 3);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 276 to 300
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)input[35] << 20) |
			((uint32_t)input[36] << 12) |
			((uint32_t)(input[37] & 0xf8) << 4);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 301 to 325
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)input[38] << 21) |
			((uint32_t)input[39] << 13) |
			((uint32_t)(input[40] & 0xfc) << 5);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 326 to 350
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)input[41] << 22) |
			((uint32_t)input[42] << 14) |
			((uint32_t)(input[43] & 0xfe) << 6);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 351 to 375
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)input[44] << 23) |
			((uint32_t)input[45] << 15) |
			((uint32_t)input[46] << 7);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 376 to 400
	value = ((uint32_t)input[47] << 24) |
			((uint32_t)input[48] << 16) |
			((uint32_t)input[49] << 8) |
			((uint32_t)(input[50] & 0x80));
	output[15] = (double)(value >> 7);
}

static void unpack_16_25bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 25-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 26
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)input[1] << 18) |
			((uint32_t)input[2] << 10) |
			((uint32_t)(input[3] & 0xe0) << 2);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 27 to 51
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xf0) << 3);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 52 to 76
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xf8) << 4);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 77 to 101
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)input[10] << 21) |
			((uint32_t)input[11] << 13) |
			((uint32_t)(input[12] & 0xfc) << 5);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 102 to 126
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)input[13] << 22) |
			((uint32_t)input[14] << 14) |
			((uint32_t)(input[15] & 0xfe) << 6);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 127 to 151
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)input[16] << 23) |
			((uint32_t)input[17] << 15) |
			((uint32_t)input[18] << 7);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 152 to 176
	value = ((uint32_t)input[19] << 24) |
			((uint32_t)input[20] << 16) |
			((uint32_t)input[21] << 8) |
			((uint32_t)(input[22] & 0x80));
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 177 to 201
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)input[23] << 17) |
			((uint32_t)input[24] << 9) |
			((uint32_t)(input[25] & 0xc0) << 1);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 202 to 226
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)input[26] << 18) |
			((uint32_t)input[27] << 10) |
			((uint32_t)(input[28] & 0xe0) << 2);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 227 to 251
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)input[29] << 19) |
			((uint32_t)input[30] << 11) |
			((uint32_t)(input[31] & 0xf0) << 3);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 252 to 276
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)input[32] << 20) |
			((uint32_t)input[33] << 12) |
			((uint32_t)(input[34] & 0xf8) << 4);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 277 to 301
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)input[35] << 21) |
			((uint32_t)input[36] << 13) |
			((uint32_t)(input[37] & 0xfc) << 5);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 302 to 326
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)input[38] << 22) |
			((uint32_t)input[39] << 14) |
			((uint32_t)(input[40] & 0xfe) << 6);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 327 to 351
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)input[41] << 23) |
			((uint32_t)input[42] << 15) |
			((uint32_t)input[43] << 7);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 352 to 376
	value = ((uint32_t)input[44] << 24) |
			((uint32_t)input[45] << 16) |
			((uint32_t)input[46] << 8) |
			((uint32_t)(input[47] & 0x80));
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 377 to 401
	value = ((uint32_t)(input[47] & 0x7f) << 25) |
			((uint32_t)input[48] << 17) |
			((uint32_t)input[49] << 9) |
			((uint32_t)(input[50] & 0xc0) << 1);
	output[15] = (double)(value >> 7);
}

static void unpack_16_25bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 25-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 26
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)input[1] << 18) |
			((uint32_t)input[2] << 10) |
			((uint32_t)(input[3] & 0xe0) << 2);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 27 to 51
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xf0) << 3);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 52 to 76
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xf8) << 4);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 77 to 101
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)input[10] << 21) |
			((uint32_t)input[11] << 13) |
			((uint32_t)(input[12] & 0xfc) << 5);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 102 to 126
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)input[13] << 22) |
			((uint32_t)input[14] << 14) |
			((uint32_t)(input[15] & 0xfe) << 6);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 127 to 151
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)input[16] << 23) |
			((uint32_t)input[17] << 15) |
			((uint32_t)input[18] << 7);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 152 to 176
	value = ((uint32_t)input[19] << 24) |
			((uint32_t)input[20] << 16) |
			((uint32_t)input[21] << 8) |
			((uint32_t)(input[22] & 0x80));
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 177 to 201
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)input[23] << 17) |
			((uint32_t)input[24] << 9) |
			((uint32_t)(input[25] & 0xc0) << 1);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 202 to 226
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)input[26] << 18) |
			((uint32_t)input[27] << 10) |
			((uint32_t)(input[28] & 0xe0) << 2);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 227 to 251
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)input[29] << 19) |
			((uint32_t)input[30] << 11) |
			((uint32_t)(input[31] & 0xf0) << 3);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 252 to 276
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)input[32] << 20) |
			((uint32_t)input[33] << 12) |
			((uint32_t)(input[34] & 0xf8) << 4);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 277 to 301
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)input[35] << 21) |
			((uint32_t)input[36] << 13) |
			((uint32_t)(input[37] & 0xfc) << 5);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 302 to 326
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)input[38] << 22) |
			((uint32_t)input[39] << 14) |
			((uint32_t)(input[40] & 0xfe) << 6);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 327 to 351
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)input[41] << 23) |
			((uint32_t)input[42] << 15) |
			((uint32_t)input[43] << 7);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 352 to 376
	value = ((uint32_t)input[44] << 24) |
			((uint32_t)input[45] << 16) |
			((uint32_t)input[46] << 8) |
			((uint32_t)(input[47] & 0x80));
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 377 to 401
	value = ((uint32_t)(input[47] & 0x7f) << 25) |
			((uint32_t)input[48] << 17) |
			((uint32_t)input[49] << 9) |
			((uint32_t)(input[50] & 0xc0) << 1);
	output[15] = (double)(value >> 7);
}

static void unpack_16_25bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 25-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 27
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)input[1] << 19) |
			((uint32_t)input[2] << 11) |
			((uint32_t)(input[3] & 0xf0) << 3);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 28 to 52
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xf8) << 4);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 53 to 77
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xfc) << 5);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 78 to 102
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)input[10] << 22) |
			((uint32_t)input[11] << 14) |
			((uint32_t)(input[12] & 0xfe) << 6);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 103 to 127
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)input[13] << 23) |
			((uint32_t)input[14] << 15) |
			((uint32_t)input[15] << 7);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 128 to 152
	value = ((uint32_t)input[16] << 24) |
			((uint32_t)input[17] << 16) |
			((uint32_t)input[18] << 8) |
			((uint32_t)(input[19] & 0x80));
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 153 to 177
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)input[20] << 17) |
			((uint32_t)input[21] << 9) |
			((uint32_t)(input[22] & 0xc0) << 1);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 178 to 202
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)input[23] << 18) |
			((uint32_t)input[24] << 10) |
			((uint32_t)(input[25] & 0xe0) << 2);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 203 to 227
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)input[26] << 19) |
			((uint32_t)input[27] << 11) |
			((uint32_t)(input[28] & 0xf0) << 3);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 228 to 252
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)input[29] << 20) |
			((uint32_t)input[30] << 12) |
			((uint32_t)(input[31] & 0xf8) << 4);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 253 to 277
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)input[32] << 21) |
			((uint32_t)input[33] << 13) |
			((uint32_t)(input[34] & 0xfc) << 5);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 278 to 302
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)input[35] << 22) |
			((uint32_t)input[36] << 14) |
			((uint32_t)(input[37] & 0xfe) << 6);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 303 to 327
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)input[38] << 23) |
			((uint32_t)input[39] << 15) |
			((uint32_t)input[40] << 7);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 328 to 352
	value = ((uint32_t)input[41] << 24) |
			((uint32_t)input[42] << 16) |
			((uint32_t)input[43] << 8) |
			((uint32_t)(input[44] & 0x80));
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 353 to 377
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)input[45] << 17) |
			((uint32_t)input[46] << 9) |
			((uint32_t)(input[47] & 0xc0) << 1);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 378 to 402
	value = ((uint32_t)(input[47] & 0x3f) << 26) |
			((uint32_t)input[48] << 18) |
			((uint32_t)input[49] << 10) |
			((uint32_t)(input[50] & 0xe0) << 2);
	output[15] = (double)(value >> 7);
}

static void unpack_16_25bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 25-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 27
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)input[1] << 19) |
			((uint32_t)input[2] << 11) |
			((uint32_t)(input[3] & 0xf0) << 3);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 28 to 52
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xf8) << 4);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 53 to 77
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xfc) << 5);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 78 to 102
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)input[10] << 22) |
			((uint32_t)input[11] << 14) |
			((uint32_t)(input[12] & 0xfe) << 6);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 103 to 127
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)input[13] << 23) |
			((uint32_t)input[14] << 15) |
			((uint32_t)input[15] << 7);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 128 to 152
	value = ((uint32_t)input[16] << 24) |
			((uint32_t)input[17] << 16) |
			((uint32_t)input[18] << 8) |
			((uint32_t)(input[19] & 0x80));
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 153 to 177
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)input[20] << 17) |
			((uint32_t)input[21] << 9) |
			((uint32_t)(input[22] & 0xc0) << 1);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 178 to 202
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)input[23] << 18) |
			((uint32_t)input[24] << 10) |
			((uint32_t)(input[25] & 0xe0) << 2);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 203 to 227
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)input[26] << 19) |
			((uint32_t)input[27] << 11) |
			((uint32_t)(input[28] & 0xf0) << 3);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 228 to 252
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)input[29] << 20) |
			((uint32_t)input[30] << 12) |
			((uint32_t)(input[31] & 0xf8) << 4);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 253 to 277
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)input[32] << 21) |
			((uint32_t)input[33] << 13) |
			((uint32_t)(input[34] & 0xfc) << 5);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 278 to 302
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)input[35] << 22) |
			((uint32_t)input[36] << 14) |
			((uint32_t)(input[37] & 0xfe) << 6);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 303 to 327
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)input[38] << 23) |
			((uint32_t)input[39] << 15) |
			((uint32_t)input[40] << 7);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 328 to 352
	value = ((uint32_t)input[41] << 24) |
			((uint32_t)input[42] << 16) |
			((uint32_t)input[43] << 8) |
			((uint32_t)(input[44] & 0x80));
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 353 to 377
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)input[45] << 17) |
			((uint32_t)input[46] << 9) |
			((uint32_t)(input[47] & 0xc0) << 1);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 378 to 402
	value = ((uint32_t)(input[47] & 0x3f) << 26) |
			((uint32_t)input[48] << 18) |
			((uint32_t)input[49] << 10) |
			((uint32_t)(input[50] & 0xe0) << 2);
	output[15] = (double)(value >> 7);
}

static void unpack_16_25bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 25-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 28
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)input[1] << 20) |
			((uint32_t)input[2] << 12) |
			((uint32_t)(input[3] & 0xf8) << 4);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 29 to 53
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xfc) << 5);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 54 to 78
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)input[7] << 22) |
			((uint32_t)input[8] << 14) |
			((uint32_t)(input[9] & 0xfe) << 6);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 79 to 103
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)input[10] << 23) |
			((uint32_t)input[11] << 15) |
			((uint32_t)input[12] << 7);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 104 to 128
	value = ((uint32_t)input[13] << 24) |
			((uint32_t)input[14] << 16) |
			((uint32_t)input[15] << 8) |
			((uint32_t)(input[16] & 0x80));
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 129 to 153
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)input[17] << 17) |
			((uint32_t)input[18] << 9) |
			((uint32_t)(input[19] & 0xc0) << 1);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 154 to 178
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)input[20] << 18) |
			((uint32_t)input[21] << 10) |
			((uint32_t)(input[22] & 0xe0) << 2);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 179 to 203
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)input[23] << 19) |
			((uint32_t)input[24] << 11) |
			((uint32_t)(input[25] & 0xf0) << 3);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 204 to 228
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)input[26] << 20) |
			((uint32_t)input[27] << 12) |
			((uint32_t)(input[28] & 0xf8) << 4);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 229 to 253
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)input[29] << 21) |
			((uint32_t)input[30] << 13) |
			((uint32_t)(input[31] & 0xfc) << 5);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 254 to 278
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)input[32] << 22) |
			((uint32_t)input[33] << 14) |
			((uint32_t)(input[34] & 0xfe) << 6);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 279 to 303
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)input[35] << 23) |
			((uint32_t)input[36] << 15) |
			((uint32_t)input[37] << 7);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 304 to 328
	value = ((uint32_t)input[38] << 24) |
			((uint32_t)input[39] << 16) |
			((uint32_t)input[40] << 8) |
			((uint32_t)(input[41] & 0x80));
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 329 to 353
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)input[42] << 17) |
			((uint32_t)input[43] << 9) |
			((uint32_t)(input[44] & 0xc0) << 1);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 354 to 378
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)input[45] << 18) |
			((uint32_t)input[46] << 10) |
			((uint32_t)(input[47] & 0xe0) << 2);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 379 to 403
	value = ((uint32_t)(input[47] & 0x1f) << 27) |
			((uint32_t)input[48] << 19) |
			((uint32_t)input[49] << 11) |
			((uint32_t)(input[50] & 0xf0) << 3);
	output[15] = (double)(value >> 7);
}

static void unpack_16_25bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 25-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 28
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)input[1] << 20) |
			((uint32_t)input[2] << 12) |
			((uint32_t)(input[3] & 0xf8) << 4);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 29 to 53
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xfc) << 5);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 54 to 78
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)input[7] << 22) |
			((uint32_t)input[8] << 14) |
			((uint32_t)(input[9] & 0xfe) << 6);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 79 to 103
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)input[10] << 23) |
			((uint32_t)input[11] << 15) |
			((uint32_t)input[12] << 7);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 104 to 128
	value = ((uint32_t)input[13] << 24) |
			((uint32_t)input[14] << 16) |
			((uint32_t)input[15] << 8) |
			((uint32_t)(input[16] & 0x80));
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 129 to 153
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)input[17] << 17) |
			((uint32_t)input[18] << 9) |
			((uint32_t)(input[19] & 0xc0) << 1);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 154 to 178
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)input[20] << 18) |
			((uint32_t)input[21] << 10) |
			((uint32_t)(input[22] & 0xe0) << 2);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 179 to 203
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)input[23] << 19) |
			((uint32_t)input[24] << 11) |
			((uint32_t)(input[25] & 0xf0) << 3);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 204 to 228
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)input[26] << 20) |
			((uint32_t)input[27] << 12) |
			((uint32_t)(input[28] & 0xf8) << 4);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 229 to 253
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)input[29] << 21) |
			((uint32_t)input[30] << 13) |
			((uint32_t)(input[31] & 0xfc) << 5);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 254 to 278
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)input[32] << 22) |
			((uint32_t)input[33] << 14) |
			((uint32_t)(input[34] & 0xfe) << 6);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 279 to 303
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)input[35] << 23) |
			((uint32_t)input[36] << 15) |
			((uint32_t)input[37] << 7);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 304 to 328
	value = ((uint32_t)input[38] << 24) |
			((uint32_t)input[39] << 16) |
			((uint32_t)input[40] << 8) |
			((uint32_t)(input[41] & 0x80));
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 329 to 353
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)input[42] << 17) |
			((uint32_t)input[43] << 9) |
			((uint32_t)(input[44] & 0xc0) << 1);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 354 to 378
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)input[45] << 18) |
			((uint32_t)input[46] << 10) |
			((uint32_t)(input[47] & 0xe0) << 2);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 379 to 403
	value = ((uint32_t)(input[47] & 0x1f) << 27) |
			((uint32_t)input[48] << 19) |
			((uint32_t)input[49] << 11) |
			((uint32_t)(input[50] & 0xf0) << 3);
	output[15] = (double)(value >> 7);
}

static void unpack_16_25bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 25-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 29
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)input[1] << 21) |
			((uint32_t)input[2] << 13) |
			((uint32_t)(input[3] & 0xfc) << 5);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 30 to 54
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xfe) << 6);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 55 to 79
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)input[7] << 23) |
			((uint32_t)input[8] << 15) |
			((uint32_t)input[9] << 7);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 80 to 104
	value = ((uint32_t)input[10] << 24) |
			((uint32_t)input[11] << 16) |
			((uint32_t)input[12] << 8) |
			((uint32_t)(input[13] & 0x80));
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 105 to 129
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)input[14] << 17) |
			((uint32_t)input[15] << 9) |
			((uint32_t)(input[16] & 0xc0) << 1);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 130 to 154
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)input[17] << 18) |
			((uint32_t)input[18] << 10) |
			((uint32_t)(input[19] & 0xe0) << 2);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 155 to 179
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)input[20] << 19) |
			((uint32_t)input[21] << 11) |
			((uint32_t)(input[22] & 0xf0) << 3);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 180 to 204
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)input[23] << 20) |
			((uint32_t)input[24] << 12) |
			((uint32_t)(input[25] & 0xf8) << 4);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 205 to 229
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)input[26] << 21) |
			((uint32_t)input[27] << 13) |
			((uint32_t)(input[28] & 0xfc) << 5);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 230 to 254
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)input[29] << 22) |
			((uint32_t)input[30] << 14) |
			((uint32_t)(input[31] & 0xfe) << 6);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 255 to 279
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)input[32] << 23) |
			((uint32_t)input[33] << 15) |
			((uint32_t)input[34] << 7);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 280 to 304
	value = ((uint32_t)input[35] << 24) |
			((uint32_t)input[36] << 16) |
			((uint32_t)input[37] << 8) |
			((uint32_t)(input[38] & 0x80));
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 305 to 329
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)input[39] << 17) |
			((uint32_t)input[40] << 9) |
			((uint32_t)(input[41] & 0xc0) << 1);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 330 to 354
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)input[42] << 18) |
			((uint32_t)input[43] << 10) |
			((uint32_t)(input[44] & 0xe0) << 2);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 355 to 379
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)input[45] << 19) |
			((uint32_t)input[46] << 11) |
			((uint32_t)(input[47] & 0xf0) << 3);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 380 to 404
	value = ((uint32_t)(input[47] & 0x0f) << 28) |
			((uint32_t)input[48] << 20) |
			((uint32_t)input[49] << 12) |
			((uint32_t)(input[50] & 0xf8) << 4);
	output[15] = (double)(value >> 7);
}

static void unpack_16_25bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 25-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 29
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)input[1] << 21) |
			((uint32_t)input[2] << 13) |
			((uint32_t)(input[3] & 0xfc) << 5);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 30 to 54
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xfe) << 6);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 55 to 79
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)input[7] << 23) |
			((uint32_t)input[8] << 15) |
			((uint32_t)input[9] << 7);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 80 to 104
	value = ((uint32_t)input[10] << 24) |
			((uint32_t)input[11] << 16) |
			((uint32_t)input[12] << 8) |
			((uint32_t)(input[13] & 0x80));
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 105 to 129
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)input[14] << 17) |
			((uint32_t)input[15] << 9) |
			((uint32_t)(input[16] & 0xc0) << 1);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 130 to 154
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)input[17] << 18) |
			((uint32_t)input[18] << 10) |
			((uint32_t)(input[19] & 0xe0) << 2);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 155 to 179
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)input[20] << 19) |
			((uint32_t)input[21] << 11) |
			((uint32_t)(input[22] & 0xf0) << 3);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 180 to 204
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)input[23] << 20) |
			((uint32_t)input[24] << 12) |
			((uint32_t)(input[25] & 0xf8) << 4);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 205 to 229
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)input[26] << 21) |
			((uint32_t)input[27] << 13) |
			((uint32_t)(input[28] & 0xfc) << 5);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 230 to 254
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)input[29] << 22) |
			((uint32_t)input[30] << 14) |
			((uint32_t)(input[31] & 0xfe) << 6);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 255 to 279
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)input[32] << 23) |
			((uint32_t)input[33] << 15) |
			((uint32_t)input[34] << 7);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 280 to 304
	value = ((uint32_t)input[35] << 24) |
			((uint32_t)input[36] << 16) |
			((uint32_t)input[37] << 8) |
			((uint32_t)(input[38] & 0x80));
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 305 to 329
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)input[39] << 17) |
			((uint32_t)input[40] << 9) |
			((uint32_t)(input[41] & 0xc0) << 1);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 330 to 354
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)input[42] << 18) |
			((uint32_t)input[43] << 10) |
			((uint32_t)(input[44] & 0xe0) << 2);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 355 to 379
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)input[45] << 19) |
			((uint32_t)input[46] << 11) |
			((uint32_t)(input[47] & 0xf0) << 3);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 380 to 404
	value = ((uint32_t)(input[47] & 0x0f) << 28) |
			((uint32_t)input[48] << 20) |
			((uint32_t)input[49] << 12) |
			((uint32_t)(input[50] & 0xf8) << 4);
	output[15] = (double)(value >> 7);
}

static void unpack_16_25bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 25-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 30
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)input[1] << 22) |
			((uint32_t)input[2] << 14) |
			((uint32_t)(input[3] & 0xfe) << 6);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 31 to 55
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)input[4] << 23) |
			((uint32_t)input[5] << 15) |
			((uint32_t)input[6] << 7);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 56 to 80
	value = ((uint32_t)input[7] << 24) |
			((uint32_t)input[8] << 16) |
			((uint32_t)input[9] << 8) |
			((uint32_t)(input[10] & 0x80));
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 81 to 105
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)input[11] << 17) |
			((uint32_t)input[12] << 9) |
			((uint32_t)(input[13] & 0xc0) << 1);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 106 to 130
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)input[14] << 18) |
			((uint32_t)input[15] << 10) |
			((uint32_t)(input[16] & 0xe0) << 2);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 131 to 155
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)input[17] << 19) |
			((uint32_t)input[18] << 11) |
			((uint32_t)(input[19] & 0xf0) << 3);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 156 to 180
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)input[20] << 20) |
			((uint32_t)input[21] << 12) |
			((uint32_t)(input[22] & 0xf8) << 4);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 181 to 205
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)input[23] << 21) |
			((uint32_t)input[24] << 13) |
			((uint32_t)(input[25] & 0xfc) << 5);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 206 to 230
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)input[26] << 22) |
			((uint32_t)input[27] << 14) |
			((uint32_t)(input[28] & 0xfe) << 6);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 231 to 255
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)input[29] << 23) |
			((uint32_t)input[30] << 15) |
			((uint32_t)input[31] << 7);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 256 to 280
	value = ((uint32_t)input[32] << 24) |
			((uint32_t)input[33] << 16) |
			((uint32_t)input[34] << 8) |
			((uint32_t)(input[35] & 0x80));
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 281 to 305
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)input[36] << 17) |
			((uint32_t)input[37] << 9) |
			((uint32_t)(input[38] & 0xc0) << 1);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 306 to 330
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)input[39] << 18) |
			((uint32_t)input[40] << 10) |
			((uint32_t)(input[41] & 0xe0) << 2);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 331 to 355
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)input[42] << 19) |
			((uint32_t)input[43] << 11) |
			((uint32_t)(input[44] & 0xf0) << 3);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 356 to 380
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)input[45] << 20) |
			((uint32_t)input[46] << 12) |
			((uint32_t)(input[47] & 0xf8) << 4);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 381 to 405
	value = ((uint32_t)(input[47] & 0x07) << 29) |
			((uint32_t)input[48] << 21) |
			((uint32_t)input[49] << 13) |
			((uint32_t)(input[50] & 0xfc) << 5);
	output[15] = (double)(value >> 7);
}

static void unpack_16_25bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 25-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 30
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)input[1] << 22) |
			((uint32_t)input[2] << 14) |
			((uint32_t)(input[3] & 0xfe) << 6);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 31 to 55
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)input[4] << 23) |
			((uint32_t)input[5] << 15) |
			((uint32_t)input[6] << 7);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 56 to 80
	value = ((uint32_t)input[7] << 24) |
			((uint32_t)input[8] << 16) |
			((uint32_t)input[9] << 8) |
			((uint32_t)(input[10] & 0x80));
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 81 to 105
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)input[11] << 17) |
			((uint32_t)input[12] << 9) |
			((uint32_t)(input[13] & 0xc0) << 1);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 106 to 130
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)input[14] << 18) |
			((uint32_t)input[15] << 10) |
			((uint32_t)(input[16] & 0xe0) << 2);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 131 to 155
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)input[17] << 19) |
			((uint32_t)input[18] << 11) |
			((uint32_t)(input[19] & 0xf0) << 3);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 156 to 180
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)input[20] << 20) |
			((uint32_t)input[21] << 12) |
			((uint32_t)(input[22] & 0xf8) << 4);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 181 to 205
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)input[23] << 21) |
			((uint32_t)input[24] << 13) |
			((uint32_t)(input[25] & 0xfc) << 5);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 206 to 230
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)input[26] << 22) |
			((uint32_t)input[27] << 14) |
			((uint32_t)(input[28] & 0xfe) << 6);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 231 to 255
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)input[29] << 23) |
			((uint32_t)input[30] << 15) |
			((uint32_t)input[31] << 7);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 256 to 280
	value = ((uint32_t)input[32] << 24) |
			((uint32_t)input[33] << 16) |
			((uint32_t)input[34] << 8) |
			((uint32_t)(input[35] & 0x80));
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 281 to 305
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)input[36] << 17) |
			((uint32_t)input[37] << 9) |
			((uint32_t)(input[38] & 0xc0) << 1);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 306 to 330
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)input[39] << 18) |
			((uint32_t)input[40] << 10) |
			((uint32_t)(input[41] & 0xe0) << 2);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 331 to 355
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)input[42] << 19) |
			((uint32_t)input[43] << 11) |
			((uint32_t)(input[44] & 0xf0) << 3);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 356 to 380
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)input[45] << 20) |
			((uint32_t)input[46] << 12) |
			((uint32_t)(input[47] & 0xf8) << 4);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 381 to 405
	value = ((uint32_t)(input[47] & 0x07) << 29) |
			((uint32_t)input[48] << 21) |
			((uint32_t)input[49] << 13) |
			((uint32_t)(input[50] & 0xfc) << 5);
	output[15] = (double)(value >> 7);
}

static void unpack_16_25bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 25-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 31
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)input[1] << 23) |
			((uint32_t)input[2] << 15) |
			((uint32_t)input[3] << 7);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 32 to 56
	value = ((uint32_t)input[4] << 24) |
			((uint32_t)input[5] << 16) |
			((uint32_t)input[6] << 8) |
			((uint32_t)(input[7] & 0x80));
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 57 to 81
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)input[8] << 17) |
			((uint32_t)input[9] << 9) |
			((uint32_t)(input[10] & 0xc0) << 1);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 82 to 106
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)input[11] << 18) |
			((uint32_t)input[12] << 10) |
			((uint32_t)(input[13] & 0xe0) << 2);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 107 to 131
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)input[14] << 19) |
			((uint32_t)input[15] << 11) |
			((uint32_t)(input[16] & 0xf0) << 3);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 132 to 156
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)input[17] << 20) |
			((uint32_t)input[18] << 12) |
			((uint32_t)(input[19] & 0xf8) << 4);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 157 to 181
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)input[20] << 21) |
			((uint32_t)input[21] << 13) |
			((uint32_t)(input[22] & 0xfc) << 5);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 182 to 206
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)input[23] << 22) |
			((uint32_t)input[24] << 14) |
			((uint32_t)(input[25] & 0xfe) << 6);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 207 to 231
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)input[28] << 7);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 232 to 256
	value = ((uint32_t)input[29] << 24) |
			((uint32_t)input[30] << 16) |
			((uint32_t)input[31] << 8) |
			((uint32_t)(input[32] & 0x80));
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 257 to 281
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)input[33] << 17) |
			((uint32_t)input[34] << 9) |
			((uint32_t)(input[35] & 0xc0) << 1);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 282 to 306
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)input[36] << 18) |
			((uint32_t)input[37] << 10) |
			((uint32_t)(input[38] & 0xe0) << 2);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 307 to 331
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)input[39] << 19) |
			((uint32_t)input[40] << 11) |
			((uint32_t)(input[41] & 0xf0) << 3);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 332 to 356
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)input[42] << 20) |
			((uint32_t)input[43] << 12) |
			((uint32_t)(input[44] & 0xf8) << 4);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 357 to 381
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)input[45] << 21) |
			((uint32_t)input[46] << 13) |
			((uint32_t)(input[47] & 0xfc) << 5);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 382 to 406
	value = ((uint32_t)(input[47] & 0x03) << 30) |
			((uint32_t)input[48] << 22) |
			((uint32_t)input[49] << 14) |
			((uint32_t)(input[50] & 0xfe) << 6);
	output[15] = (double)(value >> 7);
}

static void unpack_16_25bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 25-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 31
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)input[1] << 23) |
			((uint32_t)input[2] << 15) |
			((uint32_t)input[3] << 7);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 32 to 56
	value = ((uint32_t)input[4] << 24) |
			((uint32_t)input[5] << 16) |
			((uint32_t)input[6] << 8) |
			((uint32_t)(input[7] & 0x80));
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 57 to 81
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)input[8] << 17) |
			((uint32_t)input[9] << 9) |
			((uint32_t)(input[10] & 0xc0) << 1);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 82 to 106
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)input[11] << 18) |
			((uint32_t)input[12] << 10) |
			((uint32_t)(input[13] & 0xe0) << 2);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 107 to 131
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)input[14] << 19) |
			((uint32_t)input[15] << 11) |
			((uint32_t)(input[16] & 0xf0) << 3);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 132 to 156
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)input[17] << 20) |
			((uint32_t)input[18] << 12) |
			((uint32_t)(input[19] & 0xf8) << 4);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 157 to 181
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)input[20] << 21) |
			((uint32_t)input[21] << 13) |
			((uint32_t)(input[22] & 0xfc) << 5);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 182 to 206
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)input[23] << 22) |
			((uint32_t)input[24] << 14) |
			((uint32_t)(input[25] & 0xfe) << 6);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 207 to 231
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)input[28] << 7);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 232 to 256
	value = ((uint32_t)input[29] << 24) |
			((uint32_t)input[30] << 16) |
			((uint32_t)input[31] << 8) |
			((uint32_t)(input[32] & 0x80));
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 257 to 281
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)input[33] << 17) |
			((uint32_t)input[34] << 9) |
			((uint32_t)(input[35] & 0xc0) << 1);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 282 to 306
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)input[36] << 18) |
			((uint32_t)input[37] << 10) |
			((uint32_t)(input[38] & 0xe0) << 2);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 307 to 331
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)input[39] << 19) |
			((uint32_t)input[40] << 11) |
			((uint32_t)(input[41] & 0xf0) << 3);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 332 to 356
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)input[42] << 20) |
			((uint32_t)input[43] << 12) |
			((uint32_t)(input[44] & 0xf8) << 4);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 357 to 381
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)input[45] << 21) |
			((uint32_t)input[46] << 13) |
			((uint32_t)(input[47] & 0xfc) << 5);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 382 to 406
	value = ((uint32_t)(input[47] & 0x03) << 30) |
			((uint32_t)input[48] << 22) |
			((uint32_t)input[49] << 14) |
			((uint32_t)(input[50] & 0xfe) << 6);
	output[15] = (double)(value >> 7);
}

static void unpack_17_25bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 25-bit signed
	// Skip 0 bits, read 425 bits of data.
	// Input must be at least 54 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 24
	value = ((uint32_t)input[0] << 24) |
			((uint32_t)input[1] << 16) |
			((uint32_t)input[2] << 8) |
			((uint32_t)(input[3] & 0x80));
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 25 to 49
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)input[4] << 17) |
			((uint32_t)input[5] << 9) |
			((uint32_t)(input[6] & 0xc0) << 1);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 50 to 74
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0xe0) << 2);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 75 to 99
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xf0) << 3);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 100 to 124
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)input[13] << 20) |
			((uint32_t)input[14] << 12) |
			((uint32_t)(input[15] & 0xf8) << 4);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 125 to 149
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)input[16] << 21) |
			((uint32_t)input[17] << 13) |
			((uint32_t)(input[18] & 0xfc) << 5);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 150 to 174
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)input[19] << 22) |
			((uint32_t)input[20] << 14) |
			((uint32_t)(input[21] & 0xfe) << 6);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 175 to 199
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)input[22] << 23) |
			((uint32_t)input[23] << 15) |
			((uint32_t)input[24] << 7);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 200 to 224
	value = ((uint32_t)input[25] << 24) |
			((uint32_t)input[26] << 16) |
			((uint32_t)input[27] << 8) |
			((uint32_t)(input[28] & 0x80));
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 225 to 249
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)input[29] << 17) |
			((uint32_t)input[30] << 9) |
			((uint32_t)(input[31] & 0xc0) << 1);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 250 to 274
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)input[32] << 18) |
			((uint32_t)input[33] << 10) |
			((uint32_t)(input[34] & 0xe0) << 2);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 275 to 299
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)input[35] << 19) |
			((uint32_t)input[36] << 11) |
			((uint32_t)(input[37] & 0xf0) << 3);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 300 to 324
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)input[38] << 20) |
			((uint32_t)input[39] << 12) |
			((uint32_t)(input[40] & 0xf8) << 4);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 325 to 349
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)input[41] << 21) |
			((uint32_t)input[42] << 13) |
			((uint32_t)(input[43] & 0xfc) << 5);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 350 to 374
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)input[44] << 22) |
			((uint32_t)input[45] << 14) |
			((uint32_t)(input[46] & 0xfe) << 6);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 375 to 399
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)input[47] << 23) |
			((uint32_t)input[48] << 15) |
			((uint32_t)input[49] << 7);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 400 to 424
	value = ((uint32_t)input[50] << 24) |
			((uint32_t)input[51] << 16) |
			((uint32_t)input[52] << 8) |
			((uint32_t)(input[53] & 0x80));
	output[16] = (double)(value >> 7);
}

static void unpack_17_25bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 25-bit unsigned
	// Skip 0 bits, read 425 bits of data.
	// Input must be at least 54 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 24
	value = ((uint32_t)input[0] << 24) |
			((uint32_t)input[1] << 16) |
			((uint32_t)input[2] << 8) |
			((uint32_t)(input[3] & 0x80));
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 25 to 49
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)input[4] << 17) |
			((uint32_t)input[5] << 9) |
			((uint32_t)(input[6] & 0xc0) << 1);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 50 to 74
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0xe0) << 2);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 75 to 99
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xf0) << 3);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 100 to 124
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)input[13] << 20) |
			((uint32_t)input[14] << 12) |
			((uint32_t)(input[15] & 0xf8) << 4);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 125 to 149
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)input[16] << 21) |
			((uint32_t)input[17] << 13) |
			((uint32_t)(input[18] & 0xfc) << 5);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 150 to 174
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)input[19] << 22) |
			((uint32_t)input[20] << 14) |
			((uint32_t)(input[21] & 0xfe) << 6);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 175 to 199
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)input[22] << 23) |
			((uint32_t)input[23] << 15) |
			((uint32_t)input[24] << 7);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 200 to 224
	value = ((uint32_t)input[25] << 24) |
			((uint32_t)input[26] << 16) |
			((uint32_t)input[27] << 8) |
			((uint32_t)(input[28] & 0x80));
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 225 to 249
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)input[29] << 17) |
			((uint32_t)input[30] << 9) |
			((uint32_t)(input[31] & 0xc0) << 1);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 250 to 274
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)input[32] << 18) |
			((uint32_t)input[33] << 10) |
			((uint32_t)(input[34] & 0xe0) << 2);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 275 to 299
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)input[35] << 19) |
			((uint32_t)input[36] << 11) |
			((uint32_t)(input[37] & 0xf0) << 3);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 300 to 324
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)input[38] << 20) |
			((uint32_t)input[39] << 12) |
			((uint32_t)(input[40] & 0xf8) << 4);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 325 to 349
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)input[41] << 21) |
			((uint32_t)input[42] << 13) |
			((uint32_t)(input[43] & 0xfc) << 5);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 350 to 374
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)input[44] << 22) |
			((uint32_t)input[45] << 14) |
			((uint32_t)(input[46] & 0xfe) << 6);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 375 to 399
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)input[47] << 23) |
			((uint32_t)input[48] << 15) |
			((uint32_t)input[49] << 7);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 400 to 424
	value = ((uint32_t)input[50] << 24) |
			((uint32_t)input[51] << 16) |
			((uint32_t)input[52] << 8) |
			((uint32_t)(input[53] & 0x80));
	output[16] = (double)(value >> 7);
}

static void unpack_17_25bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 25-bit signed
	// Skip 1 bits, read 425 bits of data.
	// Input must be at least 54 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 25
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)input[1] << 17) |
			((uint32_t)input[2] << 9) |
			((uint32_t)(input[3] & 0xc0) << 1);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 26 to 50
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0xe0) << 2);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 51 to 75
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xf0) << 3);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 76 to 100
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xf8) << 4);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 101 to 125
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)input[13] << 21) |
			((uint32_t)input[14] << 13) |
			((uint32_t)(input[15] & 0xfc) << 5);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 126 to 150
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)input[16] << 22) |
			((uint32_t)input[17] << 14) |
			((uint32_t)(input[18] & 0xfe) << 6);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 151 to 175
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)input[19] << 23) |
			((uint32_t)input[20] << 15) |
			((uint32_t)input[21] << 7);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 176 to 200
	value = ((uint32_t)input[22] << 24) |
			((uint32_t)input[23] << 16) |
			((uint32_t)input[24] << 8) |
			((uint32_t)(input[25] & 0x80));
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 201 to 225
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)input[26] << 17) |
			((uint32_t)input[27] << 9) |
			((uint32_t)(input[28] & 0xc0) << 1);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 226 to 250
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)input[29] << 18) |
			((uint32_t)input[30] << 10) |
			((uint32_t)(input[31] & 0xe0) << 2);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 251 to 275
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)input[32] << 19) |
			((uint32_t)input[33] << 11) |
			((uint32_t)(input[34] & 0xf0) << 3);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 276 to 300
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)input[35] << 20) |
			((uint32_t)input[36] << 12) |
			((uint32_t)(input[37] & 0xf8) << 4);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 301 to 325
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)input[38] << 21) |
			((uint32_t)input[39] << 13) |
			((uint32_t)(input[40] & 0xfc) << 5);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 326 to 350
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)input[41] << 22) |
			((uint32_t)input[42] << 14) |
			((uint32_t)(input[43] & 0xfe) << 6);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 351 to 375
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)input[44] << 23) |
			((uint32_t)input[45] << 15) |
			((uint32_t)input[46] << 7);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 376 to 400
	value = ((uint32_t)input[47] << 24) |
			((uint32_t)input[48] << 16) |
			((uint32_t)input[49] << 8) |
			((uint32_t)(input[50] & 0x80));
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 401 to 425
	value = ((uint32_t)(input[50] & 0x7f) << 25) |
			((uint32_t)input[51] << 17) |
			((uint32_t)input[52] << 9) |
			((uint32_t)(input[53] & 0xc0) << 1);
	output[16] = (double)(value >> 7);
}

static void unpack_17_25bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 25-bit unsigned
	// Skip 1 bits, read 425 bits of data.
	// Input must be at least 54 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 25
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)input[1] << 17) |
			((uint32_t)input[2] << 9) |
			((uint32_t)(input[3] & 0xc0) << 1);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 26 to 50
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0xe0) << 2);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 51 to 75
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xf0) << 3);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 76 to 100
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xf8) << 4);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 101 to 125
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)input[13] << 21) |
			((uint32_t)input[14] << 13) |
			((uint32_t)(input[15] & 0xfc) << 5);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 126 to 150
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)input[16] << 22) |
			((uint32_t)input[17] << 14) |
			((uint32_t)(input[18] & 0xfe) << 6);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 151 to 175
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)input[19] << 23) |
			((uint32_t)input[20] << 15) |
			((uint32_t)input[21] << 7);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 176 to 200
	value = ((uint32_t)input[22] << 24) |
			((uint32_t)input[23] << 16) |
			((uint32_t)input[24] << 8) |
			((uint32_t)(input[25] & 0x80));
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 201 to 225
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)input[26] << 17) |
			((uint32_t)input[27] << 9) |
			((uint32_t)(input[28] & 0xc0) << 1);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 226 to 250
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)input[29] << 18) |
			((uint32_t)input[30] << 10) |
			((uint32_t)(input[31] & 0xe0) << 2);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 251 to 275
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)input[32] << 19) |
			((uint32_t)input[33] << 11) |
			((uint32_t)(input[34] & 0xf0) << 3);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 276 to 300
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)input[35] << 20) |
			((uint32_t)input[36] << 12) |
			((uint32_t)(input[37] & 0xf8) << 4);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 301 to 325
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)input[38] << 21) |
			((uint32_t)input[39] << 13) |
			((uint32_t)(input[40] & 0xfc) << 5);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 326 to 350
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)input[41] << 22) |
			((uint32_t)input[42] << 14) |
			((uint32_t)(input[43] & 0xfe) << 6);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 351 to 375
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)input[44] << 23) |
			((uint32_t)input[45] << 15) |
			((uint32_t)input[46] << 7);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 376 to 400
	value = ((uint32_t)input[47] << 24) |
			((uint32_t)input[48] << 16) |
			((uint32_t)input[49] << 8) |
			((uint32_t)(input[50] & 0x80));
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 401 to 425
	value = ((uint32_t)(input[50] & 0x7f) << 25) |
			((uint32_t)input[51] << 17) |
			((uint32_t)input[52] << 9) |
			((uint32_t)(input[53] & 0xc0) << 1);
	output[16] = (double)(value >> 7);
}

static void unpack_17_25bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 25-bit signed
	// Skip 2 bits, read 425 bits of data.
	// Input must be at least 54 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 26
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)input[1] << 18) |
			((uint32_t)input[2] << 10) |
			((uint32_t)(input[3] & 0xe0) << 2);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 27 to 51
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xf0) << 3);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 52 to 76
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xf8) << 4);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 77 to 101
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)input[10] << 21) |
			((uint32_t)input[11] << 13) |
			((uint32_t)(input[12] & 0xfc) << 5);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 102 to 126
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)input[13] << 22) |
			((uint32_t)input[14] << 14) |
			((uint32_t)(input[15] & 0xfe) << 6);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 127 to 151
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)input[16] << 23) |
			((uint32_t)input[17] << 15) |
			((uint32_t)input[18] << 7);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 152 to 176
	value = ((uint32_t)input[19] << 24) |
			((uint32_t)input[20] << 16) |
			((uint32_t)input[21] << 8) |
			((uint32_t)(input[22] & 0x80));
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 177 to 201
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)input[23] << 17) |
			((uint32_t)input[24] << 9) |
			((uint32_t)(input[25] & 0xc0) << 1);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 202 to 226
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)input[26] << 18) |
			((uint32_t)input[27] << 10) |
			((uint32_t)(input[28] & 0xe0) << 2);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 227 to 251
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)input[29] << 19) |
			((uint32_t)input[30] << 11) |
			((uint32_t)(input[31] & 0xf0) << 3);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 252 to 276
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)input[32] << 20) |
			((uint32_t)input[33] << 12) |
			((uint32_t)(input[34] & 0xf8) << 4);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 277 to 301
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)input[35] << 21) |
			((uint32_t)input[36] << 13) |
			((uint32_t)(input[37] & 0xfc) << 5);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 302 to 326
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)input[38] << 22) |
			((uint32_t)input[39] << 14) |
			((uint32_t)(input[40] & 0xfe) << 6);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 327 to 351
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)input[41] << 23) |
			((uint32_t)input[42] << 15) |
			((uint32_t)input[43] << 7);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 352 to 376
	value = ((uint32_t)input[44] << 24) |
			((uint32_t)input[45] << 16) |
			((uint32_t)input[46] << 8) |
			((uint32_t)(input[47] & 0x80));
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 377 to 401
	value = ((uint32_t)(input[47] & 0x7f) << 25) |
			((uint32_t)input[48] << 17) |
			((uint32_t)input[49] << 9) |
			((uint32_t)(input[50] & 0xc0) << 1);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 402 to 426
	value = ((uint32_t)(input[50] & 0x3f) << 26) |
			((uint32_t)input[51] << 18) |
			((uint32_t)input[52] << 10) |
			((uint32_t)(input[53] & 0xe0) << 2);
	output[16] = (double)(value >> 7);
}

static void unpack_17_25bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 25-bit unsigned
	// Skip 2 bits, read 425 bits of data.
	// Input must be at least 54 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 26
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)input[1] << 18) |
			((uint32_t)input[2] << 10) |
			((uint32_t)(input[3] & 0xe0) << 2);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 27 to 51
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xf0) << 3);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 52 to 76
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xf8) << 4);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 77 to 101
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)input[10] << 21) |
			((uint32_t)input[11] << 13) |
			((uint32_t)(input[12] & 0xfc) << 5);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 102 to 126
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)input[13] << 22) |
			((uint32_t)input[14] << 14) |
			((uint32_t)(input[15] & 0xfe) << 6);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 127 to 151
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)input[16] << 23) |
			((uint32_t)input[17] << 15) |
			((uint32_t)input[18] << 7);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 152 to 176
	value = ((uint32_t)input[19] << 24) |
			((uint32_t)input[20] << 16) |
			((uint32_t)input[21] << 8) |
			((uint32_t)(input[22] & 0x80));
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 177 to 201
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)input[23] << 17) |
			((uint32_t)input[24] << 9) |
			((uint32_t)(input[25] & 0xc0) << 1);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 202 to 226
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)input[26] << 18) |
			((uint32_t)input[27] << 10) |
			((uint32_t)(input[28] & 0xe0) << 2);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 227 to 251
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)input[29] << 19) |
			((uint32_t)input[30] << 11) |
			((uint32_t)(input[31] & 0xf0) << 3);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 252 to 276
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)input[32] << 20) |
			((uint32_t)input[33] << 12) |
			((uint32_t)(input[34] & 0xf8) << 4);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 277 to 301
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)input[35] << 21) |
			((uint32_t)input[36] << 13) |
			((uint32_t)(input[37] & 0xfc) << 5);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 302 to 326
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)input[38] << 22) |
			((uint32_t)input[39] << 14) |
			((uint32_t)(input[40] & 0xfe) << 6);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 327 to 351
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)input[41] << 23) |
			((uint32_t)input[42] << 15) |
			((uint32_t)input[43] << 7);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 352 to 376
	value = ((uint32_t)input[44] << 24) |
			((uint32_t)input[45] << 16) |
			((uint32_t)input[46] << 8) |
			((uint32_t)(input[47] & 0x80));
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 377 to 401
	value = ((uint32_t)(input[47] & 0x7f) << 25) |
			((uint32_t)input[48] << 17) |
			((uint32_t)input[49] << 9) |
			((uint32_t)(input[50] & 0xc0) << 1);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 402 to 426
	value = ((uint32_t)(input[50] & 0x3f) << 26) |
			((uint32_t)input[51] << 18) |
			((uint32_t)input[52] << 10) |
			((uint32_t)(input[53] & 0xe0) << 2);
	output[16] = (double)(value >> 7);
}

static void unpack_17_25bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 25-bit signed
	// Skip 3 bits, read 425 bits of data.
	// Input must be at least 54 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 27
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)input[1] << 19) |
			((uint32_t)input[2] << 11) |
			((uint32_t)(input[3] & 0xf0) << 3);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 28 to 52
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xf8) << 4);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 53 to 77
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xfc) << 5);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 78 to 102
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)input[10] << 22) |
			((uint32_t)input[11] << 14) |
			((uint32_t)(input[12] & 0xfe) << 6);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 103 to 127
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)input[13] << 23) |
			((uint32_t)input[14] << 15) |
			((uint32_t)input[15] << 7);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 128 to 152
	value = ((uint32_t)input[16] << 24) |
			((uint32_t)input[17] << 16) |
			((uint32_t)input[18] << 8) |
			((uint32_t)(input[19] & 0x80));
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 153 to 177
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)input[20] << 17) |
			((uint32_t)input[21] << 9) |
			((uint32_t)(input[22] & 0xc0) << 1);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 178 to 202
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)input[23] << 18) |
			((uint32_t)input[24] << 10) |
			((uint32_t)(input[25] & 0xe0) << 2);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 203 to 227
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)input[26] << 19) |
			((uint32_t)input[27] << 11) |
			((uint32_t)(input[28] & 0xf0) << 3);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 228 to 252
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)input[29] << 20) |
			((uint32_t)input[30] << 12) |
			((uint32_t)(input[31] & 0xf8) << 4);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 253 to 277
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)input[32] << 21) |
			((uint32_t)input[33] << 13) |
			((uint32_t)(input[34] & 0xfc) << 5);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 278 to 302
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)input[35] << 22) |
			((uint32_t)input[36] << 14) |
			((uint32_t)(input[37] & 0xfe) << 6);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 303 to 327
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)input[38] << 23) |
			((uint32_t)input[39] << 15) |
			((uint32_t)input[40] << 7);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 328 to 352
	value = ((uint32_t)input[41] << 24) |
			((uint32_t)input[42] << 16) |
			((uint32_t)input[43] << 8) |
			((uint32_t)(input[44] & 0x80));
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 353 to 377
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)input[45] << 17) |
			((uint32_t)input[46] << 9) |
			((uint32_t)(input[47] & 0xc0) << 1);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 378 to 402
	value = ((uint32_t)(input[47] & 0x3f) << 26) |
			((uint32_t)input[48] << 18) |
			((uint32_t)input[49] << 10) |
			((uint32_t)(input[50] & 0xe0) << 2);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 403 to 427
	value = ((uint32_t)(input[50] & 0x1f) << 27) |
			((uint32_t)input[51] << 19) |
			((uint32_t)input[52] << 11) |
			((uint32_t)(input[53] & 0xf0) << 3);
	output[16] = (double)(value >> 7);
}

static void unpack_17_25bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 25-bit unsigned
	// Skip 3 bits, read 425 bits of data.
	// Input must be at least 54 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 27
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)input[1] << 19) |
			((uint32_t)input[2] << 11) |
			((uint32_t)(input[3] & 0xf0) << 3);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 28 to 52
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xf8) << 4);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 53 to 77
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xfc) << 5);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 78 to 102
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)input[10] << 22) |
			((uint32_t)input[11] << 14) |
			((uint32_t)(input[12] & 0xfe) << 6);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 103 to 127
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)input[13] << 23) |
			((uint32_t)input[14] << 15) |
			((uint32_t)input[15] << 7);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 128 to 152
	value = ((uint32_t)input[16] << 24) |
			((uint32_t)input[17] << 16) |
			((uint32_t)input[18] << 8) |
			((uint32_t)(input[19] & 0x80));
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 153 to 177
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)input[20] << 17) |
			((uint32_t)input[21] << 9) |
			((uint32_t)(input[22] & 0xc0) << 1);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 178 to 202
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)input[23] << 18) |
			((uint32_t)input[24] << 10) |
			((uint32_t)(input[25] & 0xe0) << 2);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 203 to 227
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)input[26] << 19) |
			((uint32_t)input[27] << 11) |
			((uint32_t)(input[28] & 0xf0) << 3);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 228 to 252
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)input[29] << 20) |
			((uint32_t)input[30] << 12) |
			((uint32_t)(input[31] & 0xf8) << 4);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 253 to 277
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)input[32] << 21) |
			((uint32_t)input[33] << 13) |
			((uint32_t)(input[34] & 0xfc) << 5);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 278 to 302
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)input[35] << 22) |
			((uint32_t)input[36] << 14) |
			((uint32_t)(input[37] & 0xfe) << 6);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 303 to 327
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)input[38] << 23) |
			((uint32_t)input[39] << 15) |
			((uint32_t)input[40] << 7);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 328 to 352
	value = ((uint32_t)input[41] << 24) |
			((uint32_t)input[42] << 16) |
			((uint32_t)input[43] << 8) |
			((uint32_t)(input[44] & 0x80));
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 353 to 377
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)input[45] << 17) |
			((uint32_t)input[46] << 9) |
			((uint32_t)(input[47] & 0xc0) << 1);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 378 to 402
	value = ((uint32_t)(input[47] & 0x3f) << 26) |
			((uint32_t)input[48] << 18) |
			((uint32_t)input[49] << 10) |
			((uint32_t)(input[50] & 0xe0) << 2);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 403 to 427
	value = ((uint32_t)(input[50] & 0x1f) << 27) |
			((uint32_t)input[51] << 19) |
			((uint32_t)input[52] << 11) |
			((uint32_t)(input[53] & 0xf0) << 3);
	output[16] = (double)(value >> 7);
}

static void unpack_17_25bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 25-bit signed
	// Skip 4 bits, read 425 bits of data.
	// Input must be at least 54 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 28
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)input[1] << 20) |
			((uint32_t)input[2] << 12) |
			((uint32_t)(input[3] & 0xf8) << 4);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 29 to 53
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xfc) << 5);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 54 to 78
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)input[7] << 22) |
			((uint32_t)input[8] << 14) |
			((uint32_t)(input[9] & 0xfe) << 6);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 79 to 103
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)input[10] << 23) |
			((uint32_t)input[11] << 15) |
			((uint32_t)input[12] << 7);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 104 to 128
	value = ((uint32_t)input[13] << 24) |
			((uint32_t)input[14] << 16) |
			((uint32_t)input[15] << 8) |
			((uint32_t)(input[16] & 0x80));
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 129 to 153
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)input[17] << 17) |
			((uint32_t)input[18] << 9) |
			((uint32_t)(input[19] & 0xc0) << 1);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 154 to 178
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)input[20] << 18) |
			((uint32_t)input[21] << 10) |
			((uint32_t)(input[22] & 0xe0) << 2);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 179 to 203
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)input[23] << 19) |
			((uint32_t)input[24] << 11) |
			((uint32_t)(input[25] & 0xf0) << 3);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 204 to 228
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)input[26] << 20) |
			((uint32_t)input[27] << 12) |
			((uint32_t)(input[28] & 0xf8) << 4);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 229 to 253
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)input[29] << 21) |
			((uint32_t)input[30] << 13) |
			((uint32_t)(input[31] & 0xfc) << 5);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 254 to 278
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)input[32] << 22) |
			((uint32_t)input[33] << 14) |
			((uint32_t)(input[34] & 0xfe) << 6);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 279 to 303
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)input[35] << 23) |
			((uint32_t)input[36] << 15) |
			((uint32_t)input[37] << 7);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 304 to 328
	value = ((uint32_t)input[38] << 24) |
			((uint32_t)input[39] << 16) |
			((uint32_t)input[40] << 8) |
			((uint32_t)(input[41] & 0x80));
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 329 to 353
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)input[42] << 17) |
			((uint32_t)input[43] << 9) |
			((uint32_t)(input[44] & 0xc0) << 1);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 354 to 378
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)input[45] << 18) |
			((uint32_t)input[46] << 10) |
			((uint32_t)(input[47] & 0xe0) << 2);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 379 to 403
	value = ((uint32_t)(input[47] & 0x1f) << 27) |
			((uint32_t)input[48] << 19) |
			((uint32_t)input[49] << 11) |
			((uint32_t)(input[50] & 0xf0) << 3);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 404 to 428
	value = ((uint32_t)(input[50] & 0x0f) << 28) |
			((uint32_t)input[51] << 20) |
			((uint32_t)input[52] << 12) |
			((uint32_t)(input[53] & 0xf8) << 4);
	output[16] = (double)(value >> 7);
}

static void unpack_17_25bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 25-bit unsigned
	// Skip 4 bits, read 425 bits of data.
	// Input must be at least 54 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 28
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)input[1] << 20) |
			((uint32_t)input[2] << 12) |
			((uint32_t)(input[3] & 0xf8) << 4);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 29 to 53
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xfc) << 5);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 54 to 78
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)input[7] << 22) |
			((uint32_t)input[8] << 14) |
			((uint32_t)(input[9] & 0xfe) << 6);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 79 to 103
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)input[10] << 23) |
			((uint32_t)input[11] << 15) |
			((uint32_t)input[12] << 7);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 104 to 128
	value = ((uint32_t)input[13] << 24) |
			((uint32_t)input[14] << 16) |
			((uint32_t)input[15] << 8) |
			((uint32_t)(input[16] & 0x80));
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 129 to 153
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)input[17] << 17) |
			((uint32_t)input[18] << 9) |
			((uint32_t)(input[19] & 0xc0) << 1);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 154 to 178
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)input[20] << 18) |
			((uint32_t)input[21] << 10) |
			((uint32_t)(input[22] & 0xe0) << 2);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 179 to 203
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)input[23] << 19) |
			((uint32_t)input[24] << 11) |
			((uint32_t)(input[25] & 0xf0) << 3);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 204 to 228
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)input[26] << 20) |
			((uint32_t)input[27] << 12) |
			((uint32_t)(input[28] & 0xf8) << 4);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 229 to 253
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)input[29] << 21) |
			((uint32_t)input[30] << 13) |
			((uint32_t)(input[31] & 0xfc) << 5);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 254 to 278
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)input[32] << 22) |
			((uint32_t)input[33] << 14) |
			((uint32_t)(input[34] & 0xfe) << 6);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 279 to 303
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)input[35] << 23) |
			((uint32_t)input[36] << 15) |
			((uint32_t)input[37] << 7);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 304 to 328
	value = ((uint32_t)input[38] << 24) |
			((uint32_t)input[39] << 16) |
			((uint32_t)input[40] << 8) |
			((uint32_t)(input[41] & 0x80));
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 329 to 353
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)input[42] << 17) |
			((uint32_t)input[43] << 9) |
			((uint32_t)(input[44] & 0xc0) << 1);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 354 to 378
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)input[45] << 18) |
			((uint32_t)input[46] << 10) |
			((uint32_t)(input[47] & 0xe0) << 2);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 379 to 403
	value = ((uint32_t)(input[47] & 0x1f) << 27) |
			((uint32_t)input[48] << 19) |
			((uint32_t)input[49] << 11) |
			((uint32_t)(input[50] & 0xf0) << 3);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 404 to 428
	value = ((uint32_t)(input[50] & 0x0f) << 28) |
			((uint32_t)input[51] << 20) |
			((uint32_t)input[52] << 12) |
			((uint32_t)(input[53] & 0xf8) << 4);
	output[16] = (double)(value >> 7);
}

static void unpack_17_25bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 25-bit signed
	// Skip 5 bits, read 425 bits of data.
	// Input must be at least 54 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 29
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)input[1] << 21) |
			((uint32_t)input[2] << 13) |
			((uint32_t)(input[3] & 0xfc) << 5);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 30 to 54
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xfe) << 6);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 55 to 79
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)input[7] << 23) |
			((uint32_t)input[8] << 15) |
			((uint32_t)input[9] << 7);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 80 to 104
	value = ((uint32_t)input[10] << 24) |
			((uint32_t)input[11] << 16) |
			((uint32_t)input[12] << 8) |
			((uint32_t)(input[13] & 0x80));
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 105 to 129
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)input[14] << 17) |
			((uint32_t)input[15] << 9) |
			((uint32_t)(input[16] & 0xc0) << 1);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 130 to 154
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)input[17] << 18) |
			((uint32_t)input[18] << 10) |
			((uint32_t)(input[19] & 0xe0) << 2);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 155 to 179
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)input[20] << 19) |
			((uint32_t)input[21] << 11) |
			((uint32_t)(input[22] & 0xf0) << 3);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 180 to 204
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)input[23] << 20) |
			((uint32_t)input[24] << 12) |
			((uint32_t)(input[25] & 0xf8) << 4);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 205 to 229
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)input[26] << 21) |
			((uint32_t)input[27] << 13) |
			((uint32_t)(input[28] & 0xfc) << 5);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 230 to 254
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)input[29] << 22) |
			((uint32_t)input[30] << 14) |
			((uint32_t)(input[31] & 0xfe) << 6);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 255 to 279
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)input[32] << 23) |
			((uint32_t)input[33] << 15) |
			((uint32_t)input[34] << 7);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 280 to 304
	value = ((uint32_t)input[35] << 24) |
			((uint32_t)input[36] << 16) |
			((uint32_t)input[37] << 8) |
			((uint32_t)(input[38] & 0x80));
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 305 to 329
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)input[39] << 17) |
			((uint32_t)input[40] << 9) |
			((uint32_t)(input[41] & 0xc0) << 1);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 330 to 354
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)input[42] << 18) |
			((uint32_t)input[43] << 10) |
			((uint32_t)(input[44] & 0xe0) << 2);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 355 to 379
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)input[45] << 19) |
			((uint32_t)input[46] << 11) |
			((uint32_t)(input[47] & 0xf0) << 3);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 380 to 404
	value = ((uint32_t)(input[47] & 0x0f) << 28) |
			((uint32_t)input[48] << 20) |
			((uint32_t)input[49] << 12) |
			((uint32_t)(input[50] & 0xf8) << 4);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 405 to 429
	value = ((uint32_t)(input[50] & 0x07) << 29) |
			((uint32_t)input[51] << 21) |
			((uint32_t)input[52] << 13) |
			((uint32_t)(input[53] & 0xfc) << 5);
	output[16] = (double)(value >> 7);
}

static void unpack_17_25bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 25-bit unsigned
	// Skip 5 bits, read 425 bits of data.
	// Input must be at least 54 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 29
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)input[1] << 21) |
			((uint32_t)input[2] << 13) |
			((uint32_t)(input[3] & 0xfc) << 5);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 30 to 54
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xfe) << 6);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 55 to 79
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)input[7] << 23) |
			((uint32_t)input[8] << 15) |
			((uint32_t)input[9] << 7);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 80 to 104
	value = ((uint32_t)input[10] << 24) |
			((uint32_t)input[11] << 16) |
			((uint32_t)input[12] << 8) |
			((uint32_t)(input[13] & 0x80));
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 105 to 129
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)input[14] << 17) |
			((uint32_t)input[15] << 9) |
			((uint32_t)(input[16] & 0xc0) << 1);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 130 to 154
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)input[17] << 18) |
			((uint32_t)input[18] << 10) |
			((uint32_t)(input[19] & 0xe0) << 2);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 155 to 179
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)input[20] << 19) |
			((uint32_t)input[21] << 11) |
			((uint32_t)(input[22] & 0xf0) << 3);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 180 to 204
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)input[23] << 20) |
			((uint32_t)input[24] << 12) |
			((uint32_t)(input[25] & 0xf8) << 4);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 205 to 229
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)input[26] << 21) |
			((uint32_t)input[27] << 13) |
			((uint32_t)(input[28] & 0xfc) << 5);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 230 to 254
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)input[29] << 22) |
			((uint32_t)input[30] << 14) |
			((uint32_t)(input[31] & 0xfe) << 6);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 255 to 279
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)input[32] << 23) |
			((uint32_t)input[33] << 15) |
			((uint32_t)input[34] << 7);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 280 to 304
	value = ((uint32_t)input[35] << 24) |
			((uint32_t)input[36] << 16) |
			((uint32_t)input[37] << 8) |
			((uint32_t)(input[38] & 0x80));
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 305 to 329
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)input[39] << 17) |
			((uint32_t)input[40] << 9) |
			((uint32_t)(input[41] & 0xc0) << 1);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 330 to 354
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)input[42] << 18) |
			((uint32_t)input[43] << 10) |
			((uint32_t)(input[44] & 0xe0) << 2);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 355 to 379
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)input[45] << 19) |
			((uint32_t)input[46] << 11) |
			((uint32_t)(input[47] & 0xf0) << 3);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 380 to 404
	value = ((uint32_t)(input[47] & 0x0f) << 28) |
			((uint32_t)input[48] << 20) |
			((uint32_t)input[49] << 12) |
			((uint32_t)(input[50] & 0xf8) << 4);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 405 to 429
	value = ((uint32_t)(input[50] & 0x07) << 29) |
			((uint32_t)input[51] << 21) |
			((uint32_t)input[52] << 13) |
			((uint32_t)(input[53] & 0xfc) << 5);
	output[16] = (double)(value >> 7);
}

static void unpack_17_25bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 25-bit signed
	// Skip 6 bits, read 425 bits of data.
	// Input must be at least 54 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 30
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)input[1] << 22) |
			((uint32_t)input[2] << 14) |
			((uint32_t)(input[3] & 0xfe) << 6);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 31 to 55
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)input[4] << 23) |
			((uint32_t)input[5] << 15) |
			((uint32_t)input[6] << 7);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 56 to 80
	value = ((uint32_t)input[7] << 24) |
			((uint32_t)input[8] << 16) |
			((uint32_t)input[9] << 8) |
			((uint32_t)(input[10] & 0x80));
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 81 to 105
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)input[11] << 17) |
			((uint32_t)input[12] << 9) |
			((uint32_t)(input[13] & 0xc0) << 1);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 106 to 130
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)input[14] << 18) |
			((uint32_t)input[15] << 10) |
			((uint32_t)(input[16] & 0xe0) << 2);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 131 to 155
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)input[17] << 19) |
			((uint32_t)input[18] << 11) |
			((uint32_t)(input[19] & 0xf0) << 3);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 156 to 180
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)input[20] << 20) |
			((uint32_t)input[21] << 12) |
			((uint32_t)(input[22] & 0xf8) << 4);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 181 to 205
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)input[23] << 21) |
			((uint32_t)input[24] << 13) |
			((uint32_t)(input[25] & 0xfc) << 5);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 206 to 230
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)input[26] << 22) |
			((uint32_t)input[27] << 14) |
			((uint32_t)(input[28] & 0xfe) << 6);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 231 to 255
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)input[29] << 23) |
			((uint32_t)input[30] << 15) |
			((uint32_t)input[31] << 7);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 256 to 280
	value = ((uint32_t)input[32] << 24) |
			((uint32_t)input[33] << 16) |
			((uint32_t)input[34] << 8) |
			((uint32_t)(input[35] & 0x80));
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 281 to 305
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)input[36] << 17) |
			((uint32_t)input[37] << 9) |
			((uint32_t)(input[38] & 0xc0) << 1);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 306 to 330
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)input[39] << 18) |
			((uint32_t)input[40] << 10) |
			((uint32_t)(input[41] & 0xe0) << 2);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 331 to 355
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)input[42] << 19) |
			((uint32_t)input[43] << 11) |
			((uint32_t)(input[44] & 0xf0) << 3);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 356 to 380
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)input[45] << 20) |
			((uint32_t)input[46] << 12) |
			((uint32_t)(input[47] & 0xf8) << 4);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 381 to 405
	value = ((uint32_t)(input[47] & 0x07) << 29) |
			((uint32_t)input[48] << 21) |
			((uint32_t)input[49] << 13) |
			((uint32_t)(input[50] & 0xfc) << 5);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 406 to 430
	value = ((uint32_t)(input[50] & 0x03) << 30) |
			((uint32_t)input[51] << 22) |
			((uint32_t)input[52] << 14) |
			((uint32_t)(input[53] & 0xfe) << 6);
	output[16] = (double)(value >> 7);
}

static void unpack_17_25bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 25-bit unsigned
	// Skip 6 bits, read 425 bits of data.
	// Input must be at least 54 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 30
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)input[1] << 22) |
			((uint32_t)input[2] << 14) |
			((uint32_t)(input[3] & 0xfe) << 6);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 31 to 55
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)input[4] << 23) |
			((uint32_t)input[5] << 15) |
			((uint32_t)input[6] << 7);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 56 to 80
	value = ((uint32_t)input[7] << 24) |
			((uint32_t)input[8] << 16) |
			((uint32_t)input[9] << 8) |
			((uint32_t)(input[10] & 0x80));
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 81 to 105
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)input[11] << 17) |
			((uint32_t)input[12] << 9) |
			((uint32_t)(input[13] & 0xc0) << 1);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 106 to 130
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)input[14] << 18) |
			((uint32_t)input[15] << 10) |
			((uint32_t)(input[16] & 0xe0) << 2);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 131 to 155
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)input[17] << 19) |
			((uint32_t)input[18] << 11) |
			((uint32_t)(input[19] & 0xf0) << 3);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 156 to 180
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)input[20] << 20) |
			((uint32_t)input[21] << 12) |
			((uint32_t)(input[22] & 0xf8) << 4);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 181 to 205
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)input[23] << 21) |
			((uint32_t)input[24] << 13) |
			((uint32_t)(input[25] & 0xfc) << 5);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 206 to 230
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)input[26] << 22) |
			((uint32_t)input[27] << 14) |
			((uint32_t)(input[28] & 0xfe) << 6);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 231 to 255
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)input[29] << 23) |
			((uint32_t)input[30] << 15) |
			((uint32_t)input[31] << 7);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 256 to 280
	value = ((uint32_t)input[32] << 24) |
			((uint32_t)input[33] << 16) |
			((uint32_t)input[34] << 8) |
			((uint32_t)(input[35] & 0x80));
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 281 to 305
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)input[36] << 17) |
			((uint32_t)input[37] << 9) |
			((uint32_t)(input[38] & 0xc0) << 1);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 306 to 330
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)input[39] << 18) |
			((uint32_t)input[40] << 10) |
			((uint32_t)(input[41] & 0xe0) << 2);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 331 to 355
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)input[42] << 19) |
			((uint32_t)input[43] << 11) |
			((uint32_t)(input[44] & 0xf0) << 3);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 356 to 380
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)input[45] << 20) |
			((uint32_t)input[46] << 12) |
			((uint32_t)(input[47] & 0xf8) << 4);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 381 to 405
	value = ((uint32_t)(input[47] & 0x07) << 29) |
			((uint32_t)input[48] << 21) |
			((uint32_t)input[49] << 13) |
			((uint32_t)(input[50] & 0xfc) << 5);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 406 to 430
	value = ((uint32_t)(input[50] & 0x03) << 30) |
			((uint32_t)input[51] << 22) |
			((uint32_t)input[52] << 14) |
			((uint32_t)(input[53] & 0xfe) << 6);
	output[16] = (double)(value >> 7);
}

static void unpack_17_25bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 25-bit signed
	// Skip 7 bits, read 425 bits of data.
	// Input must be at least 54 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 31
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)input[1] << 23) |
			((uint32_t)input[2] << 15) |
			((uint32_t)input[3] << 7);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 32 to 56
	value = ((uint32_t)input[4] << 24) |
			((uint32_t)input[5] << 16) |
			((uint32_t)input[6] << 8) |
			((uint32_t)(input[7] & 0x80));
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 57 to 81
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)input[8] << 17) |
			((uint32_t)input[9] << 9) |
			((uint32_t)(input[10] & 0xc0) << 1);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 82 to 106
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)input[11] << 18) |
			((uint32_t)input[12] << 10) |
			((uint32_t)(input[13] & 0xe0) << 2);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 107 to 131
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)input[14] << 19) |
			((uint32_t)input[15] << 11) |
			((uint32_t)(input[16] & 0xf0) << 3);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 132 to 156
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)input[17] << 20) |
			((uint32_t)input[18] << 12) |
			((uint32_t)(input[19] & 0xf8) << 4);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 157 to 181
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)input[20] << 21) |
			((uint32_t)input[21] << 13) |
			((uint32_t)(input[22] & 0xfc) << 5);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 182 to 206
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)input[23] << 22) |
			((uint32_t)input[24] << 14) |
			((uint32_t)(input[25] & 0xfe) << 6);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 207 to 231
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)input[28] << 7);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 232 to 256
	value = ((uint32_t)input[29] << 24) |
			((uint32_t)input[30] << 16) |
			((uint32_t)input[31] << 8) |
			((uint32_t)(input[32] & 0x80));
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 257 to 281
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)input[33] << 17) |
			((uint32_t)input[34] << 9) |
			((uint32_t)(input[35] & 0xc0) << 1);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 282 to 306
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)input[36] << 18) |
			((uint32_t)input[37] << 10) |
			((uint32_t)(input[38] & 0xe0) << 2);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 307 to 331
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)input[39] << 19) |
			((uint32_t)input[40] << 11) |
			((uint32_t)(input[41] & 0xf0) << 3);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 332 to 356
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)input[42] << 20) |
			((uint32_t)input[43] << 12) |
			((uint32_t)(input[44] & 0xf8) << 4);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 357 to 381
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)input[45] << 21) |
			((uint32_t)input[46] << 13) |
			((uint32_t)(input[47] & 0xfc) << 5);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 382 to 406
	value = ((uint32_t)(input[47] & 0x03) << 30) |
			((uint32_t)input[48] << 22) |
			((uint32_t)input[49] << 14) |
			((uint32_t)(input[50] & 0xfe) << 6);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 407 to 431
	value = ((uint32_t)(input[50] & 0x01) << 31) |
			((uint32_t)input[51] << 23) |
			((uint32_t)input[52] << 15) |
			((uint32_t)input[53] << 7);
	output[16] = (double)(value >> 7);
}

static void unpack_17_25bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 25-bit unsigned
	// Skip 7 bits, read 425 bits of data.
	// Input must be at least 54 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 31
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)input[1] << 23) |
			((uint32_t)input[2] << 15) |
			((uint32_t)input[3] << 7);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 32 to 56
	value = ((uint32_t)input[4] << 24) |
			((uint32_t)input[5] << 16) |
			((uint32_t)input[6] << 8) |
			((uint32_t)(input[7] & 0x80));
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 57 to 81
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)input[8] << 17) |
			((uint32_t)input[9] << 9) |
			((uint32_t)(input[10] & 0xc0) << 1);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 82 to 106
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)input[11] << 18) |
			((uint32_t)input[12] << 10) |
			((uint32_t)(input[13] & 0xe0) << 2);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 107 to 131
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)input[14] << 19) |
			((uint32_t)input[15] << 11) |
			((uint32_t)(input[16] & 0xf0) << 3);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 132 to 156
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)input[17] << 20) |
			((uint32_t)input[18] << 12) |
			((uint32_t)(input[19] & 0xf8) << 4);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 157 to 181
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)input[20] << 21) |
			((uint32_t)input[21] << 13) |
			((uint32_t)(input[22] & 0xfc) << 5);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 182 to 206
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)input[23] << 22) |
			((uint32_t)input[24] << 14) |
			((uint32_t)(input[25] & 0xfe) << 6);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 207 to 231
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)input[28] << 7);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 232 to 256
	value = ((uint32_t)input[29] << 24) |
			((uint32_t)input[30] << 16) |
			((uint32_t)input[31] << 8) |
			((uint32_t)(input[32] & 0x80));
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 257 to 281
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)input[33] << 17) |
			((uint32_t)input[34] << 9) |
			((uint32_t)(input[35] & 0xc0) << 1);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 282 to 306
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)input[36] << 18) |
			((uint32_t)input[37] << 10) |
			((uint32_t)(input[38] & 0xe0) << 2);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 307 to 331
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)input[39] << 19) |
			((uint32_t)input[40] << 11) |
			((uint32_t)(input[41] & 0xf0) << 3);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 332 to 356
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)input[42] << 20) |
			((uint32_t)input[43] << 12) |
			((uint32_t)(input[44] & 0xf8) << 4);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 357 to 381
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)input[45] << 21) |
			((uint32_t)input[46] << 13) |
			((uint32_t)(input[47] & 0xfc) << 5);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 382 to 406
	value = ((uint32_t)(input[47] & 0x03) << 30) |
			((uint32_t)input[48] << 22) |
			((uint32_t)input[49] << 14) |
			((uint32_t)(input[50] & 0xfe) << 6);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 407 to 431
	value = ((uint32_t)(input[50] & 0x01) << 31) |
			((uint32_t)input[51] << 23) |
			((uint32_t)input[52] << 15) |
			((uint32_t)input[53] << 7);
	output[16] = (double)(value >> 7);
}

static void unpack_18_25bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 18 values into output
	// Values are 25-bit signed
	// Skip 0 bits, read 450 bits of data.
	// Input must be at least 57 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 24
	value = ((uint32_t)input[0] << 24) |
			((uint32_t)input[1] << 16) |
			((uint32_t)input[2] << 8) |
			((uint32_t)(input[3] & 0x80));
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 25 to 49
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)input[4] << 17) |
			((uint32_t)input[5] << 9) |
			((uint32_t)(input[6] & 0xc0) << 1);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 50 to 74
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0xe0) << 2);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 75 to 99
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xf0) << 3);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 100 to 124
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)input[13] << 20) |
			((uint32_t)input[14] << 12) |
			((uint32_t)(input[15] & 0xf8) << 4);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 125 to 149
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)input[16] << 21) |
			((uint32_t)input[17] << 13) |
			((uint32_t)(input[18] & 0xfc) << 5);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 150 to 174
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)input[19] << 22) |
			((uint32_t)input[20] << 14) |
			((uint32_t)(input[21] & 0xfe) << 6);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 175 to 199
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)input[22] << 23) |
			((uint32_t)input[23] << 15) |
			((uint32_t)input[24] << 7);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 200 to 224
	value = ((uint32_t)input[25] << 24) |
			((uint32_t)input[26] << 16) |
			((uint32_t)input[27] << 8) |
			((uint32_t)(input[28] & 0x80));
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 225 to 249
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)input[29] << 17) |
			((uint32_t)input[30] << 9) |
			((uint32_t)(input[31] & 0xc0) << 1);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 250 to 274
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)input[32] << 18) |
			((uint32_t)input[33] << 10) |
			((uint32_t)(input[34] & 0xe0) << 2);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 275 to 299
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)input[35] << 19) |
			((uint32_t)input[36] << 11) |
			((uint32_t)(input[37] & 0xf0) << 3);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 300 to 324
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)input[38] << 20) |
			((uint32_t)input[39] << 12) |
			((uint32_t)(input[40] & 0xf8) << 4);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 325 to 349
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)input[41] << 21) |
			((uint32_t)input[42] << 13) |
			((uint32_t)(input[43] & 0xfc) << 5);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 350 to 374
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)input[44] << 22) |
			((uint32_t)input[45] << 14) |
			((uint32_t)(input[46] & 0xfe) << 6);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 375 to 399
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)input[47] << 23) |
			((uint32_t)input[48] << 15) |
			((uint32_t)input[49] << 7);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 400 to 424
	value = ((uint32_t)input[50] << 24) |
			((uint32_t)input[51] << 16) |
			((uint32_t)input[52] << 8) |
			((uint32_t)(input[53] & 0x80));
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 425 to 449
	value = ((uint32_t)(input[53] & 0x7f) << 25) |
			((uint32_t)input[54] << 17) |
			((uint32_t)input[55] << 9) |
			((uint32_t)(input[56] & 0xc0) << 1);
	output[17] = (double)(value >> 7);
}

static void unpack_18_25bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 18 values into output
	// Values are 25-bit unsigned
	// Skip 0 bits, read 450 bits of data.
	// Input must be at least 57 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 24
	value = ((uint32_t)input[0] << 24) |
			((uint32_t)input[1] << 16) |
			((uint32_t)input[2] << 8) |
			((uint32_t)(input[3] & 0x80));
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 25 to 49
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)input[4] << 17) |
			((uint32_t)input[5] << 9) |
			((uint32_t)(input[6] & 0xc0) << 1);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 50 to 74
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0xe0) << 2);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 75 to 99
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xf0) << 3);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 100 to 124
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)input[13] << 20) |
			((uint32_t)input[14] << 12) |
			((uint32_t)(input[15] & 0xf8) << 4);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 125 to 149
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)input[16] << 21) |
			((uint32_t)input[17] << 13) |
			((uint32_t)(input[18] & 0xfc) << 5);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 150 to 174
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)input[19] << 22) |
			((uint32_t)input[20] << 14) |
			((uint32_t)(input[21] & 0xfe) << 6);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 175 to 199
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)input[22] << 23) |
			((uint32_t)input[23] << 15) |
			((uint32_t)input[24] << 7);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 200 to 224
	value = ((uint32_t)input[25] << 24) |
			((uint32_t)input[26] << 16) |
			((uint32_t)input[27] << 8) |
			((uint32_t)(input[28] & 0x80));
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 225 to 249
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)input[29] << 17) |
			((uint32_t)input[30] << 9) |
			((uint32_t)(input[31] & 0xc0) << 1);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 250 to 274
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)input[32] << 18) |
			((uint32_t)input[33] << 10) |
			((uint32_t)(input[34] & 0xe0) << 2);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 275 to 299
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)input[35] << 19) |
			((uint32_t)input[36] << 11) |
			((uint32_t)(input[37] & 0xf0) << 3);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 300 to 324
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)input[38] << 20) |
			((uint32_t)input[39] << 12) |
			((uint32_t)(input[40] & 0xf8) << 4);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 325 to 349
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)input[41] << 21) |
			((uint32_t)input[42] << 13) |
			((uint32_t)(input[43] & 0xfc) << 5);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 350 to 374
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)input[44] << 22) |
			((uint32_t)input[45] << 14) |
			((uint32_t)(input[46] & 0xfe) << 6);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 375 to 399
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)input[47] << 23) |
			((uint32_t)input[48] << 15) |
			((uint32_t)input[49] << 7);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 400 to 424
	value = ((uint32_t)input[50] << 24) |
			((uint32_t)input[51] << 16) |
			((uint32_t)input[52] << 8) |
			((uint32_t)(input[53] & 0x80));
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 425 to 449
	value = ((uint32_t)(input[53] & 0x7f) << 25) |
			((uint32_t)input[54] << 17) |
			((uint32_t)input[55] << 9) |
			((uint32_t)(input[56] & 0xc0) << 1);
	output[17] = (double)(value >> 7);
}

static void unpack_18_25bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 18 values into output
	// Values are 25-bit signed
	// Skip 1 bits, read 450 bits of data.
	// Input must be at least 57 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 25
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)input[1] << 17) |
			((uint32_t)input[2] << 9) |
			((uint32_t)(input[3] & 0xc0) << 1);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 26 to 50
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0xe0) << 2);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 51 to 75
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xf0) << 3);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 76 to 100
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xf8) << 4);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 101 to 125
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)input[13] << 21) |
			((uint32_t)input[14] << 13) |
			((uint32_t)(input[15] & 0xfc) << 5);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 126 to 150
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)input[16] << 22) |
			((uint32_t)input[17] << 14) |
			((uint32_t)(input[18] & 0xfe) << 6);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 151 to 175
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)input[19] << 23) |
			((uint32_t)input[20] << 15) |
			((uint32_t)input[21] << 7);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 176 to 200
	value = ((uint32_t)input[22] << 24) |
			((uint32_t)input[23] << 16) |
			((uint32_t)input[24] << 8) |
			((uint32_t)(input[25] & 0x80));
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 201 to 225
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)input[26] << 17) |
			((uint32_t)input[27] << 9) |
			((uint32_t)(input[28] & 0xc0) << 1);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 226 to 250
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)input[29] << 18) |
			((uint32_t)input[30] << 10) |
			((uint32_t)(input[31] & 0xe0) << 2);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 251 to 275
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)input[32] << 19) |
			((uint32_t)input[33] << 11) |
			((uint32_t)(input[34] & 0xf0) << 3);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 276 to 300
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)input[35] << 20) |
			((uint32_t)input[36] << 12) |
			((uint32_t)(input[37] & 0xf8) << 4);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 301 to 325
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)input[38] << 21) |
			((uint32_t)input[39] << 13) |
			((uint32_t)(input[40] & 0xfc) << 5);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 326 to 350
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)input[41] << 22) |
			((uint32_t)input[42] << 14) |
			((uint32_t)(input[43] & 0xfe) << 6);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 351 to 375
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)input[44] << 23) |
			((uint32_t)input[45] << 15) |
			((uint32_t)input[46] << 7);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 376 to 400
	value = ((uint32_t)input[47] << 24) |
			((uint32_t)input[48] << 16) |
			((uint32_t)input[49] << 8) |
			((uint32_t)(input[50] & 0x80));
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 401 to 425
	value = ((uint32_t)(input[50] & 0x7f) << 25) |
			((uint32_t)input[51] << 17) |
			((uint32_t)input[52] << 9) |
			((uint32_t)(input[53] & 0xc0) << 1);
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 426 to 450
	value = ((uint32_t)(input[53] & 0x3f) << 26) |
			((uint32_t)input[54] << 18) |
			((uint32_t)input[55] << 10) |
			((uint32_t)(input[56] & 0xe0) << 2);
	output[17] = (double)(value >> 7);
}

static void unpack_18_25bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 18 values into output
	// Values are 25-bit unsigned
	// Skip 1 bits, read 450 bits of data.
	// Input must be at least 57 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 25
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)input[1] << 17) |
			((uint32_t)input[2] << 9) |
			((uint32_t)(input[3] & 0xc0) << 1);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 26 to 50
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0xe0) << 2);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 51 to 75
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xf0) << 3);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 76 to 100
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xf8) << 4);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 101 to 125
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)input[13] << 21) |
			((uint32_t)input[14] << 13) |
			((uint32_t)(input[15] & 0xfc) << 5);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 126 to 150
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)input[16] << 22) |
			((uint32_t)input[17] << 14) |
			((uint32_t)(input[18] & 0xfe) << 6);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 151 to 175
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)input[19] << 23) |
			((uint32_t)input[20] << 15) |
			((uint32_t)input[21] << 7);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 176 to 200
	value = ((uint32_t)input[22] << 24) |
			((uint32_t)input[23] << 16) |
			((uint32_t)input[24] << 8) |
			((uint32_t)(input[25] & 0x80));
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 201 to 225
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)input[26] << 17) |
			((uint32_t)input[27] << 9) |
			((uint32_t)(input[28] & 0xc0) << 1);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 226 to 250
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)input[29] << 18) |
			((uint32_t)input[30] << 10) |
			((uint32_t)(input[31] & 0xe0) << 2);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 251 to 275
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)input[32] << 19) |
			((uint32_t)input[33] << 11) |
			((uint32_t)(input[34] & 0xf0) << 3);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 276 to 300
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)input[35] << 20) |
			((uint32_t)input[36] << 12) |
			((uint32_t)(input[37] & 0xf8) << 4);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 301 to 325
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)input[38] << 21) |
			((uint32_t)input[39] << 13) |
			((uint32_t)(input[40] & 0xfc) << 5);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 326 to 350
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)input[41] << 22) |
			((uint32_t)input[42] << 14) |
			((uint32_t)(input[43] & 0xfe) << 6);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 351 to 375
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)input[44] << 23) |
			((uint32_t)input[45] << 15) |
			((uint32_t)input[46] << 7);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 376 to 400
	value = ((uint32_t)input[47] << 24) |
			((uint32_t)input[48] << 16) |
			((uint32_t)input[49] << 8) |
			((uint32_t)(input[50] & 0x80));
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 401 to 425
	value = ((uint32_t)(input[50] & 0x7f) << 25) |
			((uint32_t)input[51] << 17) |
			((uint32_t)input[52] << 9) |
			((uint32_t)(input[53] & 0xc0) << 1);
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 426 to 450
	value = ((uint32_t)(input[53] & 0x3f) << 26) |
			((uint32_t)input[54] << 18) |
			((uint32_t)input[55] << 10) |
			((uint32_t)(input[56] & 0xe0) << 2);
	output[17] = (double)(value >> 7);
}

static void unpack_18_25bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 18 values into output
	// Values are 25-bit signed
	// Skip 2 bits, read 450 bits of data.
	// Input must be at least 57 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 26
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)input[1] << 18) |
			((uint32_t)input[2] << 10) |
			((uint32_t)(input[3] & 0xe0) << 2);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 27 to 51
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xf0) << 3);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 52 to 76
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xf8) << 4);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 77 to 101
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)input[10] << 21) |
			((uint32_t)input[11] << 13) |
			((uint32_t)(input[12] & 0xfc) << 5);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 102 to 126
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)input[13] << 22) |
			((uint32_t)input[14] << 14) |
			((uint32_t)(input[15] & 0xfe) << 6);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 127 to 151
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)input[16] << 23) |
			((uint32_t)input[17] << 15) |
			((uint32_t)input[18] << 7);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 152 to 176
	value = ((uint32_t)input[19] << 24) |
			((uint32_t)input[20] << 16) |
			((uint32_t)input[21] << 8) |
			((uint32_t)(input[22] & 0x80));
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 177 to 201
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)input[23] << 17) |
			((uint32_t)input[24] << 9) |
			((uint32_t)(input[25] & 0xc0) << 1);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 202 to 226
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)input[26] << 18) |
			((uint32_t)input[27] << 10) |
			((uint32_t)(input[28] & 0xe0) << 2);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 227 to 251
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)input[29] << 19) |
			((uint32_t)input[30] << 11) |
			((uint32_t)(input[31] & 0xf0) << 3);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 252 to 276
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)input[32] << 20) |
			((uint32_t)input[33] << 12) |
			((uint32_t)(input[34] & 0xf8) << 4);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 277 to 301
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)input[35] << 21) |
			((uint32_t)input[36] << 13) |
			((uint32_t)(input[37] & 0xfc) << 5);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 302 to 326
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)input[38] << 22) |
			((uint32_t)input[39] << 14) |
			((uint32_t)(input[40] & 0xfe) << 6);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 327 to 351
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)input[41] << 23) |
			((uint32_t)input[42] << 15) |
			((uint32_t)input[43] << 7);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 352 to 376
	value = ((uint32_t)input[44] << 24) |
			((uint32_t)input[45] << 16) |
			((uint32_t)input[46] << 8) |
			((uint32_t)(input[47] & 0x80));
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 377 to 401
	value = ((uint32_t)(input[47] & 0x7f) << 25) |
			((uint32_t)input[48] << 17) |
			((uint32_t)input[49] << 9) |
			((uint32_t)(input[50] & 0xc0) << 1);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 402 to 426
	value = ((uint32_t)(input[50] & 0x3f) << 26) |
			((uint32_t)input[51] << 18) |
			((uint32_t)input[52] << 10) |
			((uint32_t)(input[53] & 0xe0) << 2);
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 427 to 451
	value = ((uint32_t)(input[53] & 0x1f) << 27) |
			((uint32_t)input[54] << 19) |
			((uint32_t)input[55] << 11) |
			((uint32_t)(input[56] & 0xf0) << 3);
	output[17] = (double)(value >> 7);
}

static void unpack_18_25bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 18 values into output
	// Values are 25-bit unsigned
	// Skip 2 bits, read 450 bits of data.
	// Input must be at least 57 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 26
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)input[1] << 18) |
			((uint32_t)input[2] << 10) |
			((uint32_t)(input[3] & 0xe0) << 2);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 27 to 51
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xf0) << 3);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 52 to 76
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xf8) << 4);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 77 to 101
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)input[10] << 21) |
			((uint32_t)input[11] << 13) |
			((uint32_t)(input[12] & 0xfc) << 5);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 102 to 126
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)input[13] << 22) |
			((uint32_t)input[14] << 14) |
			((uint32_t)(input[15] & 0xfe) << 6);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 127 to 151
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)input[16] << 23) |
			((uint32_t)input[17] << 15) |
			((uint32_t)input[18] << 7);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 152 to 176
	value = ((uint32_t)input[19] << 24) |
			((uint32_t)input[20] << 16) |
			((uint32_t)input[21] << 8) |
			((uint32_t)(input[22] & 0x80));
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 177 to 201
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)input[23] << 17) |
			((uint32_t)input[24] << 9) |
			((uint32_t)(input[25] & 0xc0) << 1);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 202 to 226
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)input[26] << 18) |
			((uint32_t)input[27] << 10) |
			((uint32_t)(input[28] & 0xe0) << 2);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 227 to 251
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)input[29] << 19) |
			((uint32_t)input[30] << 11) |
			((uint32_t)(input[31] & 0xf0) << 3);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 252 to 276
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)input[32] << 20) |
			((uint32_t)input[33] << 12) |
			((uint32_t)(input[34] & 0xf8) << 4);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 277 to 301
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)input[35] << 21) |
			((uint32_t)input[36] << 13) |
			((uint32_t)(input[37] & 0xfc) << 5);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 302 to 326
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)input[38] << 22) |
			((uint32_t)input[39] << 14) |
			((uint32_t)(input[40] & 0xfe) << 6);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 327 to 351
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)input[41] << 23) |
			((uint32_t)input[42] << 15) |
			((uint32_t)input[43] << 7);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 352 to 376
	value = ((uint32_t)input[44] << 24) |
			((uint32_t)input[45] << 16) |
			((uint32_t)input[46] << 8) |
			((uint32_t)(input[47] & 0x80));
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 377 to 401
	value = ((uint32_t)(input[47] & 0x7f) << 25) |
			((uint32_t)input[48] << 17) |
			((uint32_t)input[49] << 9) |
			((uint32_t)(input[50] & 0xc0) << 1);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 402 to 426
	value = ((uint32_t)(input[50] & 0x3f) << 26) |
			((uint32_t)input[51] << 18) |
			((uint32_t)input[52] << 10) |
			((uint32_t)(input[53] & 0xe0) << 2);
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 427 to 451
	value = ((uint32_t)(input[53] & 0x1f) << 27) |
			((uint32_t)input[54] << 19) |
			((uint32_t)input[55] << 11) |
			((uint32_t)(input[56] & 0xf0) << 3);
	output[17] = (double)(value >> 7);
}

static void unpack_18_25bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 18 values into output
	// Values are 25-bit signed
	// Skip 3 bits, read 450 bits of data.
	// Input must be at least 57 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 27
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)input[1] << 19) |
			((uint32_t)input[2] << 11) |
			((uint32_t)(input[3] & 0xf0) << 3);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 28 to 52
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xf8) << 4);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 53 to 77
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xfc) << 5);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 78 to 102
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)input[10] << 22) |
			((uint32_t)input[11] << 14) |
			((uint32_t)(input[12] & 0xfe) << 6);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 103 to 127
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)input[13] << 23) |
			((uint32_t)input[14] << 15) |
			((uint32_t)input[15] << 7);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 128 to 152
	value = ((uint32_t)input[16] << 24) |
			((uint32_t)input[17] << 16) |
			((uint32_t)input[18] << 8) |
			((uint32_t)(input[19] & 0x80));
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 153 to 177
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)input[20] << 17) |
			((uint32_t)input[21] << 9) |
			((uint32_t)(input[22] & 0xc0) << 1);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 178 to 202
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)input[23] << 18) |
			((uint32_t)input[24] << 10) |
			((uint32_t)(input[25] & 0xe0) << 2);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 203 to 227
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)input[26] << 19) |
			((uint32_t)input[27] << 11) |
			((uint32_t)(input[28] & 0xf0) << 3);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 228 to 252
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)input[29] << 20) |
			((uint32_t)input[30] << 12) |
			((uint32_t)(input[31] & 0xf8) << 4);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 253 to 277
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)input[32] << 21) |
			((uint32_t)input[33] << 13) |
			((uint32_t)(input[34] & 0xfc) << 5);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 278 to 302
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)input[35] << 22) |
			((uint32_t)input[36] << 14) |
			((uint32_t)(input[37] & 0xfe) << 6);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 303 to 327
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)input[38] << 23) |
			((uint32_t)input[39] << 15) |
			((uint32_t)input[40] << 7);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 328 to 352
	value = ((uint32_t)input[41] << 24) |
			((uint32_t)input[42] << 16) |
			((uint32_t)input[43] << 8) |
			((uint32_t)(input[44] & 0x80));
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 353 to 377
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)input[45] << 17) |
			((uint32_t)input[46] << 9) |
			((uint32_t)(input[47] & 0xc0) << 1);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 378 to 402
	value = ((uint32_t)(input[47] & 0x3f) << 26) |
			((uint32_t)input[48] << 18) |
			((uint32_t)input[49] << 10) |
			((uint32_t)(input[50] & 0xe0) << 2);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 403 to 427
	value = ((uint32_t)(input[50] & 0x1f) << 27) |
			((uint32_t)input[51] << 19) |
			((uint32_t)input[52] << 11) |
			((uint32_t)(input[53] & 0xf0) << 3);
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 428 to 452
	value = ((uint32_t)(input[53] & 0x0f) << 28) |
			((uint32_t)input[54] << 20) |
			((uint32_t)input[55] << 12) |
			((uint32_t)(input[56] & 0xf8) << 4);
	output[17] = (double)(value >> 7);
}

static void unpack_18_25bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 18 values into output
	// Values are 25-bit unsigned
	// Skip 3 bits, read 450 bits of data.
	// Input must be at least 57 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 27
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)input[1] << 19) |
			((uint32_t)input[2] << 11) |
			((uint32_t)(input[3] & 0xf0) << 3);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 28 to 52
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xf8) << 4);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 53 to 77
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xfc) << 5);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 78 to 102
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)input[10] << 22) |
			((uint32_t)input[11] << 14) |
			((uint32_t)(input[12] & 0xfe) << 6);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 103 to 127
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)input[13] << 23) |
			((uint32_t)input[14] << 15) |
			((uint32_t)input[15] << 7);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 128 to 152
	value = ((uint32_t)input[16] << 24) |
			((uint32_t)input[17] << 16) |
			((uint32_t)input[18] << 8) |
			((uint32_t)(input[19] & 0x80));
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 153 to 177
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)input[20] << 17) |
			((uint32_t)input[21] << 9) |
			((uint32_t)(input[22] & 0xc0) << 1);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 178 to 202
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)input[23] << 18) |
			((uint32_t)input[24] << 10) |
			((uint32_t)(input[25] & 0xe0) << 2);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 203 to 227
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)input[26] << 19) |
			((uint32_t)input[27] << 11) |
			((uint32_t)(input[28] & 0xf0) << 3);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 228 to 252
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)input[29] << 20) |
			((uint32_t)input[30] << 12) |
			((uint32_t)(input[31] & 0xf8) << 4);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 253 to 277
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)input[32] << 21) |
			((uint32_t)input[33] << 13) |
			((uint32_t)(input[34] & 0xfc) << 5);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 278 to 302
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)input[35] << 22) |
			((uint32_t)input[36] << 14) |
			((uint32_t)(input[37] & 0xfe) << 6);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 303 to 327
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)input[38] << 23) |
			((uint32_t)input[39] << 15) |
			((uint32_t)input[40] << 7);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 328 to 352
	value = ((uint32_t)input[41] << 24) |
			((uint32_t)input[42] << 16) |
			((uint32_t)input[43] << 8) |
			((uint32_t)(input[44] & 0x80));
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 353 to 377
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)input[45] << 17) |
			((uint32_t)input[46] << 9) |
			((uint32_t)(input[47] & 0xc0) << 1);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 378 to 402
	value = ((uint32_t)(input[47] & 0x3f) << 26) |
			((uint32_t)input[48] << 18) |
			((uint32_t)input[49] << 10) |
			((uint32_t)(input[50] & 0xe0) << 2);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 403 to 427
	value = ((uint32_t)(input[50] & 0x1f) << 27) |
			((uint32_t)input[51] << 19) |
			((uint32_t)input[52] << 11) |
			((uint32_t)(input[53] & 0xf0) << 3);
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 428 to 452
	value = ((uint32_t)(input[53] & 0x0f) << 28) |
			((uint32_t)input[54] << 20) |
			((uint32_t)input[55] << 12) |
			((uint32_t)(input[56] & 0xf8) << 4);
	output[17] = (double)(value >> 7);
}

static void unpack_18_25bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 18 values into output
	// Values are 25-bit signed
	// Skip 4 bits, read 450 bits of data.
	// Input must be at least 57 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 28
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)input[1] << 20) |
			((uint32_t)input[2] << 12) |
			((uint32_t)(input[3] & 0xf8) << 4);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 29 to 53
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xfc) << 5);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 54 to 78
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)input[7] << 22) |
			((uint32_t)input[8] << 14) |
			((uint32_t)(input[9] & 0xfe) << 6);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 79 to 103
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)input[10] << 23) |
			((uint32_t)input[11] << 15) |
			((uint32_t)input[12] << 7);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 104 to 128
	value = ((uint32_t)input[13] << 24) |
			((uint32_t)input[14] << 16) |
			((uint32_t)input[15] << 8) |
			((uint32_t)(input[16] & 0x80));
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 129 to 153
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)input[17] << 17) |
			((uint32_t)input[18] << 9) |
			((uint32_t)(input[19] & 0xc0) << 1);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 154 to 178
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)input[20] << 18) |
			((uint32_t)input[21] << 10) |
			((uint32_t)(input[22] & 0xe0) << 2);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 179 to 203
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)input[23] << 19) |
			((uint32_t)input[24] << 11) |
			((uint32_t)(input[25] & 0xf0) << 3);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 204 to 228
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)input[26] << 20) |
			((uint32_t)input[27] << 12) |
			((uint32_t)(input[28] & 0xf8) << 4);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 229 to 253
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)input[29] << 21) |
			((uint32_t)input[30] << 13) |
			((uint32_t)(input[31] & 0xfc) << 5);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 254 to 278
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)input[32] << 22) |
			((uint32_t)input[33] << 14) |
			((uint32_t)(input[34] & 0xfe) << 6);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 279 to 303
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)input[35] << 23) |
			((uint32_t)input[36] << 15) |
			((uint32_t)input[37] << 7);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 304 to 328
	value = ((uint32_t)input[38] << 24) |
			((uint32_t)input[39] << 16) |
			((uint32_t)input[40] << 8) |
			((uint32_t)(input[41] & 0x80));
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 329 to 353
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)input[42] << 17) |
			((uint32_t)input[43] << 9) |
			((uint32_t)(input[44] & 0xc0) << 1);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 354 to 378
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)input[45] << 18) |
			((uint32_t)input[46] << 10) |
			((uint32_t)(input[47] & 0xe0) << 2);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 379 to 403
	value = ((uint32_t)(input[47] & 0x1f) << 27) |
			((uint32_t)input[48] << 19) |
			((uint32_t)input[49] << 11) |
			((uint32_t)(input[50] & 0xf0) << 3);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 404 to 428
	value = ((uint32_t)(input[50] & 0x0f) << 28) |
			((uint32_t)input[51] << 20) |
			((uint32_t)input[52] << 12) |
			((uint32_t)(input[53] & 0xf8) << 4);
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 429 to 453
	value = ((uint32_t)(input[53] & 0x07) << 29) |
			((uint32_t)input[54] << 21) |
			((uint32_t)input[55] << 13) |
			((uint32_t)(input[56] & 0xfc) << 5);
	output[17] = (double)(value >> 7);
}

static void unpack_18_25bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 18 values into output
	// Values are 25-bit unsigned
	// Skip 4 bits, read 450 bits of data.
	// Input must be at least 57 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 28
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)input[1] << 20) |
			((uint32_t)input[2] << 12) |
			((uint32_t)(input[3] & 0xf8) << 4);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 29 to 53
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xfc) << 5);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 54 to 78
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)input[7] << 22) |
			((uint32_t)input[8] << 14) |
			((uint32_t)(input[9] & 0xfe) << 6);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 79 to 103
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)input[10] << 23) |
			((uint32_t)input[11] << 15) |
			((uint32_t)input[12] << 7);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 104 to 128
	value = ((uint32_t)input[13] << 24) |
			((uint32_t)input[14] << 16) |
			((uint32_t)input[15] << 8) |
			((uint32_t)(input[16] & 0x80));
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 129 to 153
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)input[17] << 17) |
			((uint32_t)input[18] << 9) |
			((uint32_t)(input[19] & 0xc0) << 1);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 154 to 178
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)input[20] << 18) |
			((uint32_t)input[21] << 10) |
			((uint32_t)(input[22] & 0xe0) << 2);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 179 to 203
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)input[23] << 19) |
			((uint32_t)input[24] << 11) |
			((uint32_t)(input[25] & 0xf0) << 3);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 204 to 228
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)input[26] << 20) |
			((uint32_t)input[27] << 12) |
			((uint32_t)(input[28] & 0xf8) << 4);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 229 to 253
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)input[29] << 21) |
			((uint32_t)input[30] << 13) |
			((uint32_t)(input[31] & 0xfc) << 5);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 254 to 278
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)input[32] << 22) |
			((uint32_t)input[33] << 14) |
			((uint32_t)(input[34] & 0xfe) << 6);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 279 to 303
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)input[35] << 23) |
			((uint32_t)input[36] << 15) |
			((uint32_t)input[37] << 7);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 304 to 328
	value = ((uint32_t)input[38] << 24) |
			((uint32_t)input[39] << 16) |
			((uint32_t)input[40] << 8) |
			((uint32_t)(input[41] & 0x80));
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 329 to 353
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)input[42] << 17) |
			((uint32_t)input[43] << 9) |
			((uint32_t)(input[44] & 0xc0) << 1);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 354 to 378
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)input[45] << 18) |
			((uint32_t)input[46] << 10) |
			((uint32_t)(input[47] & 0xe0) << 2);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 379 to 403
	value = ((uint32_t)(input[47] & 0x1f) << 27) |
			((uint32_t)input[48] << 19) |
			((uint32_t)input[49] << 11) |
			((uint32_t)(input[50] & 0xf0) << 3);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 404 to 428
	value = ((uint32_t)(input[50] & 0x0f) << 28) |
			((uint32_t)input[51] << 20) |
			((uint32_t)input[52] << 12) |
			((uint32_t)(input[53] & 0xf8) << 4);
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 429 to 453
	value = ((uint32_t)(input[53] & 0x07) << 29) |
			((uint32_t)input[54] << 21) |
			((uint32_t)input[55] << 13) |
			((uint32_t)(input[56] & 0xfc) << 5);
	output[17] = (double)(value >> 7);
}

static void unpack_18_25bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 18 values into output
	// Values are 25-bit signed
	// Skip 5 bits, read 450 bits of data.
	// Input must be at least 57 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 29
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)input[1] << 21) |
			((uint32_t)input[2] << 13) |
			((uint32_t)(input[3] & 0xfc) << 5);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 30 to 54
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xfe) << 6);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 55 to 79
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)input[7] << 23) |
			((uint32_t)input[8] << 15) |
			((uint32_t)input[9] << 7);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 80 to 104
	value = ((uint32_t)input[10] << 24) |
			((uint32_t)input[11] << 16) |
			((uint32_t)input[12] << 8) |
			((uint32_t)(input[13] & 0x80));
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 105 to 129
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)input[14] << 17) |
			((uint32_t)input[15] << 9) |
			((uint32_t)(input[16] & 0xc0) << 1);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 130 to 154
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)input[17] << 18) |
			((uint32_t)input[18] << 10) |
			((uint32_t)(input[19] & 0xe0) << 2);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 155 to 179
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)input[20] << 19) |
			((uint32_t)input[21] << 11) |
			((uint32_t)(input[22] & 0xf0) << 3);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 180 to 204
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)input[23] << 20) |
			((uint32_t)input[24] << 12) |
			((uint32_t)(input[25] & 0xf8) << 4);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 205 to 229
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)input[26] << 21) |
			((uint32_t)input[27] << 13) |
			((uint32_t)(input[28] & 0xfc) << 5);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 230 to 254
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)input[29] << 22) |
			((uint32_t)input[30] << 14) |
			((uint32_t)(input[31] & 0xfe) << 6);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 255 to 279
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)input[32] << 23) |
			((uint32_t)input[33] << 15) |
			((uint32_t)input[34] << 7);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 280 to 304
	value = ((uint32_t)input[35] << 24) |
			((uint32_t)input[36] << 16) |
			((uint32_t)input[37] << 8) |
			((uint32_t)(input[38] & 0x80));
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 305 to 329
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)input[39] << 17) |
			((uint32_t)input[40] << 9) |
			((uint32_t)(input[41] & 0xc0) << 1);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 330 to 354
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)input[42] << 18) |
			((uint32_t)input[43] << 10) |
			((uint32_t)(input[44] & 0xe0) << 2);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 355 to 379
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)input[45] << 19) |
			((uint32_t)input[46] << 11) |
			((uint32_t)(input[47] & 0xf0) << 3);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 380 to 404
	value = ((uint32_t)(input[47] & 0x0f) << 28) |
			((uint32_t)input[48] << 20) |
			((uint32_t)input[49] << 12) |
			((uint32_t)(input[50] & 0xf8) << 4);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 405 to 429
	value = ((uint32_t)(input[50] & 0x07) << 29) |
			((uint32_t)input[51] << 21) |
			((uint32_t)input[52] << 13) |
			((uint32_t)(input[53] & 0xfc) << 5);
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 430 to 454
	value = ((uint32_t)(input[53] & 0x03) << 30) |
			((uint32_t)input[54] << 22) |
			((uint32_t)input[55] << 14) |
			((uint32_t)(input[56] & 0xfe) << 6);
	output[17] = (double)(value >> 7);
}

static void unpack_18_25bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 18 values into output
	// Values are 25-bit unsigned
	// Skip 5 bits, read 450 bits of data.
	// Input must be at least 57 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 29
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)input[1] << 21) |
			((uint32_t)input[2] << 13) |
			((uint32_t)(input[3] & 0xfc) << 5);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 30 to 54
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xfe) << 6);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 55 to 79
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)input[7] << 23) |
			((uint32_t)input[8] << 15) |
			((uint32_t)input[9] << 7);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 80 to 104
	value = ((uint32_t)input[10] << 24) |
			((uint32_t)input[11] << 16) |
			((uint32_t)input[12] << 8) |
			((uint32_t)(input[13] & 0x80));
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 105 to 129
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)input[14] << 17) |
			((uint32_t)input[15] << 9) |
			((uint32_t)(input[16] & 0xc0) << 1);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 130 to 154
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)input[17] << 18) |
			((uint32_t)input[18] << 10) |
			((uint32_t)(input[19] & 0xe0) << 2);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 155 to 179
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)input[20] << 19) |
			((uint32_t)input[21] << 11) |
			((uint32_t)(input[22] & 0xf0) << 3);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 180 to 204
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)input[23] << 20) |
			((uint32_t)input[24] << 12) |
			((uint32_t)(input[25] & 0xf8) << 4);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 205 to 229
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)input[26] << 21) |
			((uint32_t)input[27] << 13) |
			((uint32_t)(input[28] & 0xfc) << 5);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 230 to 254
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)input[29] << 22) |
			((uint32_t)input[30] << 14) |
			((uint32_t)(input[31] & 0xfe) << 6);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 255 to 279
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)input[32] << 23) |
			((uint32_t)input[33] << 15) |
			((uint32_t)input[34] << 7);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 280 to 304
	value = ((uint32_t)input[35] << 24) |
			((uint32_t)input[36] << 16) |
			((uint32_t)input[37] << 8) |
			((uint32_t)(input[38] & 0x80));
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 305 to 329
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)input[39] << 17) |
			((uint32_t)input[40] << 9) |
			((uint32_t)(input[41] & 0xc0) << 1);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 330 to 354
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)input[42] << 18) |
			((uint32_t)input[43] << 10) |
			((uint32_t)(input[44] & 0xe0) << 2);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 355 to 379
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)input[45] << 19) |
			((uint32_t)input[46] << 11) |
			((uint32_t)(input[47] & 0xf0) << 3);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 380 to 404
	value = ((uint32_t)(input[47] & 0x0f) << 28) |
			((uint32_t)input[48] << 20) |
			((uint32_t)input[49] << 12) |
			((uint32_t)(input[50] & 0xf8) << 4);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 405 to 429
	value = ((uint32_t)(input[50] & 0x07) << 29) |
			((uint32_t)input[51] << 21) |
			((uint32_t)input[52] << 13) |
			((uint32_t)(input[53] & 0xfc) << 5);
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 430 to 454
	value = ((uint32_t)(input[53] & 0x03) << 30) |
			((uint32_t)input[54] << 22) |
			((uint32_t)input[55] << 14) |
			((uint32_t)(input[56] & 0xfe) << 6);
	output[17] = (double)(value >> 7);
}

static void unpack_18_25bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 18 values into output
	// Values are 25-bit signed
	// Skip 6 bits, read 450 bits of data.
	// Input must be at least 57 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 30
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)input[1] << 22) |
			((uint32_t)input[2] << 14) |
			((uint32_t)(input[3] & 0xfe) << 6);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 31 to 55
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)input[4] << 23) |
			((uint32_t)input[5] << 15) |
			((uint32_t)input[6] << 7);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 56 to 80
	value = ((uint32_t)input[7] << 24) |
			((uint32_t)input[8] << 16) |
			((uint32_t)input[9] << 8) |
			((uint32_t)(input[10] & 0x80));
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 81 to 105
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)input[11] << 17) |
			((uint32_t)input[12] << 9) |
			((uint32_t)(input[13] & 0xc0) << 1);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 106 to 130
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)input[14] << 18) |
			((uint32_t)input[15] << 10) |
			((uint32_t)(input[16] & 0xe0) << 2);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 131 to 155
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)input[17] << 19) |
			((uint32_t)input[18] << 11) |
			((uint32_t)(input[19] & 0xf0) << 3);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 156 to 180
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)input[20] << 20) |
			((uint32_t)input[21] << 12) |
			((uint32_t)(input[22] & 0xf8) << 4);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 181 to 205
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)input[23] << 21) |
			((uint32_t)input[24] << 13) |
			((uint32_t)(input[25] & 0xfc) << 5);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 206 to 230
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)input[26] << 22) |
			((uint32_t)input[27] << 14) |
			((uint32_t)(input[28] & 0xfe) << 6);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 231 to 255
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)input[29] << 23) |
			((uint32_t)input[30] << 15) |
			((uint32_t)input[31] << 7);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 256 to 280
	value = ((uint32_t)input[32] << 24) |
			((uint32_t)input[33] << 16) |
			((uint32_t)input[34] << 8) |
			((uint32_t)(input[35] & 0x80));
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 281 to 305
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)input[36] << 17) |
			((uint32_t)input[37] << 9) |
			((uint32_t)(input[38] & 0xc0) << 1);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 306 to 330
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)input[39] << 18) |
			((uint32_t)input[40] << 10) |
			((uint32_t)(input[41] & 0xe0) << 2);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 331 to 355
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)input[42] << 19) |
			((uint32_t)input[43] << 11) |
			((uint32_t)(input[44] & 0xf0) << 3);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 356 to 380
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)input[45] << 20) |
			((uint32_t)input[46] << 12) |
			((uint32_t)(input[47] & 0xf8) << 4);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 381 to 405
	value = ((uint32_t)(input[47] & 0x07) << 29) |
			((uint32_t)input[48] << 21) |
			((uint32_t)input[49] << 13) |
			((uint32_t)(input[50] & 0xfc) << 5);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 406 to 430
	value = ((uint32_t)(input[50] & 0x03) << 30) |
			((uint32_t)input[51] << 22) |
			((uint32_t)input[52] << 14) |
			((uint32_t)(input[53] & 0xfe) << 6);
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 431 to 455
	value = ((uint32_t)(input[53] & 0x01) << 31) |
			((uint32_t)input[54] << 23) |
			((uint32_t)input[55] << 15) |
			((uint32_t)input[56] << 7);
	output[17] = (double)(value >> 7);
}

static void unpack_18_25bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 18 values into output
	// Values are 25-bit unsigned
	// Skip 6 bits, read 450 bits of data.
	// Input must be at least 57 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 30
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)input[1] << 22) |
			((uint32_t)input[2] << 14) |
			((uint32_t)(input[3] & 0xfe) << 6);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 31 to 55
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)input[4] << 23) |
			((uint32_t)input[5] << 15) |
			((uint32_t)input[6] << 7);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 56 to 80
	value = ((uint32_t)input[7] << 24) |
			((uint32_t)input[8] << 16) |
			((uint32_t)input[9] << 8) |
			((uint32_t)(input[10] & 0x80));
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 81 to 105
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)input[11] << 17) |
			((uint32_t)input[12] << 9) |
			((uint32_t)(input[13] & 0xc0) << 1);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 106 to 130
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)input[14] << 18) |
			((uint32_t)input[15] << 10) |
			((uint32_t)(input[16] & 0xe0) << 2);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 131 to 155
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)input[17] << 19) |
			((uint32_t)input[18] << 11) |
			((uint32_t)(input[19] & 0xf0) << 3);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 156 to 180
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)input[20] << 20) |
			((uint32_t)input[21] << 12) |
			((uint32_t)(input[22] & 0xf8) << 4);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 181 to 205
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)input[23] << 21) |
			((uint32_t)input[24] << 13) |
			((uint32_t)(input[25] & 0xfc) << 5);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 206 to 230
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)input[26] << 22) |
			((uint32_t)input[27] << 14) |
			((uint32_t)(input[28] & 0xfe) << 6);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 231 to 255
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)input[29] << 23) |
			((uint32_t)input[30] << 15) |
			((uint32_t)input[31] << 7);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 256 to 280
	value = ((uint32_t)input[32] << 24) |
			((uint32_t)input[33] << 16) |
			((uint32_t)input[34] << 8) |
			((uint32_t)(input[35] & 0x80));
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 281 to 305
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)input[36] << 17) |
			((uint32_t)input[37] << 9) |
			((uint32_t)(input[38] & 0xc0) << 1);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 306 to 330
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)input[39] << 18) |
			((uint32_t)input[40] << 10) |
			((uint32_t)(input[41] & 0xe0) << 2);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 331 to 355
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)input[42] << 19) |
			((uint32_t)input[43] << 11) |
			((uint32_t)(input[44] & 0xf0) << 3);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 356 to 380
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)input[45] << 20) |
			((uint32_t)input[46] << 12) |
			((uint32_t)(input[47] & 0xf8) << 4);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 381 to 405
	value = ((uint32_t)(input[47] & 0x07) << 29) |
			((uint32_t)input[48] << 21) |
			((uint32_t)input[49] << 13) |
			((uint32_t)(input[50] & 0xfc) << 5);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 406 to 430
	value = ((uint32_t)(input[50] & 0x03) << 30) |
			((uint32_t)input[51] << 22) |
			((uint32_t)input[52] << 14) |
			((uint32_t)(input[53] & 0xfe) << 6);
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 431 to 455
	value = ((uint32_t)(input[53] & 0x01) << 31) |
			((uint32_t)input[54] << 23) |
			((uint32_t)input[55] << 15) |
			((uint32_t)input[56] << 7);
	output[17] = (double)(value >> 7);
}

static void unpack_18_25bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 18 values into output
	// Values are 25-bit signed
	// Skip 7 bits, read 450 bits of data.
	// Input must be at least 58 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 31
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)input[1] << 23) |
			((uint32_t)input[2] << 15) |
			((uint32_t)input[3] << 7);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 32 to 56
	value = ((uint32_t)input[4] << 24) |
			((uint32_t)input[5] << 16) |
			((uint32_t)input[6] << 8) |
			((uint32_t)(input[7] & 0x80));
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 57 to 81
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)input[8] << 17) |
			((uint32_t)input[9] << 9) |
			((uint32_t)(input[10] & 0xc0) << 1);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 82 to 106
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)input[11] << 18) |
			((uint32_t)input[12] << 10) |
			((uint32_t)(input[13] & 0xe0) << 2);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 107 to 131
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)input[14] << 19) |
			((uint32_t)input[15] << 11) |
			((uint32_t)(input[16] & 0xf0) << 3);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 132 to 156
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)input[17] << 20) |
			((uint32_t)input[18] << 12) |
			((uint32_t)(input[19] & 0xf8) << 4);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 157 to 181
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)input[20] << 21) |
			((uint32_t)input[21] << 13) |
			((uint32_t)(input[22] & 0xfc) << 5);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 182 to 206
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)input[23] << 22) |
			((uint32_t)input[24] << 14) |
			((uint32_t)(input[25] & 0xfe) << 6);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 207 to 231
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)input[28] << 7);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 232 to 256
	value = ((uint32_t)input[29] << 24) |
			((uint32_t)input[30] << 16) |
			((uint32_t)input[31] << 8) |
			((uint32_t)(input[32] & 0x80));
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 257 to 281
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)input[33] << 17) |
			((uint32_t)input[34] << 9) |
			((uint32_t)(input[35] & 0xc0) << 1);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 282 to 306
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)input[36] << 18) |
			((uint32_t)input[37] << 10) |
			((uint32_t)(input[38] & 0xe0) << 2);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 307 to 331
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)input[39] << 19) |
			((uint32_t)input[40] << 11) |
			((uint32_t)(input[41] & 0xf0) << 3);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 332 to 356
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)input[42] << 20) |
			((uint32_t)input[43] << 12) |
			((uint32_t)(input[44] & 0xf8) << 4);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 357 to 381
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)input[45] << 21) |
			((uint32_t)input[46] << 13) |
			((uint32_t)(input[47] & 0xfc) << 5);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 382 to 406
	value = ((uint32_t)(input[47] & 0x03) << 30) |
			((uint32_t)input[48] << 22) |
			((uint32_t)input[49] << 14) |
			((uint32_t)(input[50] & 0xfe) << 6);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 407 to 431
	value = ((uint32_t)(input[50] & 0x01) << 31) |
			((uint32_t)input[51] << 23) |
			((uint32_t)input[52] << 15) |
			((uint32_t)input[53] << 7);
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 432 to 456
	value = ((uint32_t)input[54] << 24) |
			((uint32_t)input[55] << 16) |
			((uint32_t)input[56] << 8) |
			((uint32_t)(input[57] & 0x80));
	output[17] = (double)(value >> 7);
}

static void unpack_18_25bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 18 values into output
	// Values are 25-bit unsigned
	// Skip 7 bits, read 450 bits of data.
	// Input must be at least 58 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 31
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)input[1] << 23) |
			((uint32_t)input[2] << 15) |
			((uint32_t)input[3] << 7);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 32 to 56
	value = ((uint32_t)input[4] << 24) |
			((uint32_t)input[5] << 16) |
			((uint32_t)input[6] << 8) |
			((uint32_t)(input[7] & 0x80));
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 57 to 81
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)input[8] << 17) |
			((uint32_t)input[9] << 9) |
			((uint32_t)(input[10] & 0xc0) << 1);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 82 to 106
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)input[11] << 18) |
			((uint32_t)input[12] << 10) |
			((uint32_t)(input[13] & 0xe0) << 2);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 107 to 131
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)input[14] << 19) |
			((uint32_t)input[15] << 11) |
			((uint32_t)(input[16] & 0xf0) << 3);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 132 to 156
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)input[17] << 20) |
			((uint32_t)input[18] << 12) |
			((uint32_t)(input[19] & 0xf8) << 4);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 157 to 181
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)input[20] << 21) |
			((uint32_t)input[21] << 13) |
			((uint32_t)(input[22] & 0xfc) << 5);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 182 to 206
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)input[23] << 22) |
			((uint32_t)input[24] << 14) |
			((uint32_t)(input[25] & 0xfe) << 6);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 207 to 231
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)input[28] << 7);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 232 to 256
	value = ((uint32_t)input[29] << 24) |
			((uint32_t)input[30] << 16) |
			((uint32_t)input[31] << 8) |
			((uint32_t)(input[32] & 0x80));
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 257 to 281
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)input[33] << 17) |
			((uint32_t)input[34] << 9) |
			((uint32_t)(input[35] & 0xc0) << 1);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 282 to 306
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)input[36] << 18) |
			((uint32_t)input[37] << 10) |
			((uint32_t)(input[38] & 0xe0) << 2);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 307 to 331
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)input[39] << 19) |
			((uint32_t)input[40] << 11) |
			((uint32_t)(input[41] & 0xf0) << 3);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 332 to 356
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)input[42] << 20) |
			((uint32_t)input[43] << 12) |
			((uint32_t)(input[44] & 0xf8) << 4);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 357 to 381
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)input[45] << 21) |
			((uint32_t)input[46] << 13) |
			((uint32_t)(input[47] & 0xfc) << 5);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 382 to 406
	value = ((uint32_t)(input[47] & 0x03) << 30) |
			((uint32_t)input[48] << 22) |
			((uint32_t)input[49] << 14) |
			((uint32_t)(input[50] & 0xfe) << 6);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 407 to 431
	value = ((uint32_t)(input[50] & 0x01) << 31) |
			((uint32_t)input[51] << 23) |
			((uint32_t)input[52] << 15) |
			((uint32_t)input[53] << 7);
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 432 to 456
	value = ((uint32_t)input[54] << 24) |
			((uint32_t)input[55] << 16) |
			((uint32_t)input[56] << 8) |
			((uint32_t)(input[57] & 0x80));
	output[17] = (double)(value >> 7);
}

static void unpack_19_25bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 25-bit signed
	// Skip 0 bits, read 475 bits of data.
	// Input must be at least 60 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 24
	value = ((uint32_t)input[0] << 24) |
			((uint32_t)input[1] << 16) |
			((uint32_t)input[2] << 8) |
			((uint32_t)(input[3] & 0x80));
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 25 to 49
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)input[4] << 17) |
			((uint32_t)input[5] << 9) |
			((uint32_t)(input[6] & 0xc0) << 1);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 50 to 74
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0xe0) << 2);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 75 to 99
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xf0) << 3);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 100 to 124
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)input[13] << 20) |
			((uint32_t)input[14] << 12) |
			((uint32_t)(input[15] & 0xf8) << 4);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 125 to 149
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)input[16] << 21) |
			((uint32_t)input[17] << 13) |
			((uint32_t)(input[18] & 0xfc) << 5);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 150 to 174
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)input[19] << 22) |
			((uint32_t)input[20] << 14) |
			((uint32_t)(input[21] & 0xfe) << 6);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 175 to 199
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)input[22] << 23) |
			((uint32_t)input[23] << 15) |
			((uint32_t)input[24] << 7);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 200 to 224
	value = ((uint32_t)input[25] << 24) |
			((uint32_t)input[26] << 16) |
			((uint32_t)input[27] << 8) |
			((uint32_t)(input[28] & 0x80));
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 225 to 249
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)input[29] << 17) |
			((uint32_t)input[30] << 9) |
			((uint32_t)(input[31] & 0xc0) << 1);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 250 to 274
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)input[32] << 18) |
			((uint32_t)input[33] << 10) |
			((uint32_t)(input[34] & 0xe0) << 2);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 275 to 299
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)input[35] << 19) |
			((uint32_t)input[36] << 11) |
			((uint32_t)(input[37] & 0xf0) << 3);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 300 to 324
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)input[38] << 20) |
			((uint32_t)input[39] << 12) |
			((uint32_t)(input[40] & 0xf8) << 4);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 325 to 349
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)input[41] << 21) |
			((uint32_t)input[42] << 13) |
			((uint32_t)(input[43] & 0xfc) << 5);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 350 to 374
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)input[44] << 22) |
			((uint32_t)input[45] << 14) |
			((uint32_t)(input[46] & 0xfe) << 6);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 375 to 399
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)input[47] << 23) |
			((uint32_t)input[48] << 15) |
			((uint32_t)input[49] << 7);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 400 to 424
	value = ((uint32_t)input[50] << 24) |
			((uint32_t)input[51] << 16) |
			((uint32_t)input[52] << 8) |
			((uint32_t)(input[53] & 0x80));
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 425 to 449
	value = ((uint32_t)(input[53] & 0x7f) << 25) |
			((uint32_t)input[54] << 17) |
			((uint32_t)input[55] << 9) |
			((uint32_t)(input[56] & 0xc0) << 1);
	output[17] = (double)(value >> 7);

	// read output[18]: from bit 450 to 474
	value = ((uint32_t)(input[56] & 0x3f) << 26) |
			((uint32_t)input[57] << 18) |
			((uint32_t)input[58] << 10) |
			((uint32_t)(input[59] & 0xe0) << 2);
	output[18] = (double)(value >> 7);
}

static void unpack_19_25bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 25-bit unsigned
	// Skip 0 bits, read 475 bits of data.
	// Input must be at least 60 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 24
	value = ((uint32_t)input[0] << 24) |
			((uint32_t)input[1] << 16) |
			((uint32_t)input[2] << 8) |
			((uint32_t)(input[3] & 0x80));
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 25 to 49
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)input[4] << 17) |
			((uint32_t)input[5] << 9) |
			((uint32_t)(input[6] & 0xc0) << 1);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 50 to 74
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0xe0) << 2);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 75 to 99
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xf0) << 3);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 100 to 124
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)input[13] << 20) |
			((uint32_t)input[14] << 12) |
			((uint32_t)(input[15] & 0xf8) << 4);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 125 to 149
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)input[16] << 21) |
			((uint32_t)input[17] << 13) |
			((uint32_t)(input[18] & 0xfc) << 5);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 150 to 174
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)input[19] << 22) |
			((uint32_t)input[20] << 14) |
			((uint32_t)(input[21] & 0xfe) << 6);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 175 to 199
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)input[22] << 23) |
			((uint32_t)input[23] << 15) |
			((uint32_t)input[24] << 7);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 200 to 224
	value = ((uint32_t)input[25] << 24) |
			((uint32_t)input[26] << 16) |
			((uint32_t)input[27] << 8) |
			((uint32_t)(input[28] & 0x80));
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 225 to 249
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)input[29] << 17) |
			((uint32_t)input[30] << 9) |
			((uint32_t)(input[31] & 0xc0) << 1);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 250 to 274
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)input[32] << 18) |
			((uint32_t)input[33] << 10) |
			((uint32_t)(input[34] & 0xe0) << 2);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 275 to 299
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)input[35] << 19) |
			((uint32_t)input[36] << 11) |
			((uint32_t)(input[37] & 0xf0) << 3);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 300 to 324
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)input[38] << 20) |
			((uint32_t)input[39] << 12) |
			((uint32_t)(input[40] & 0xf8) << 4);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 325 to 349
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)input[41] << 21) |
			((uint32_t)input[42] << 13) |
			((uint32_t)(input[43] & 0xfc) << 5);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 350 to 374
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)input[44] << 22) |
			((uint32_t)input[45] << 14) |
			((uint32_t)(input[46] & 0xfe) << 6);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 375 to 399
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)input[47] << 23) |
			((uint32_t)input[48] << 15) |
			((uint32_t)input[49] << 7);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 400 to 424
	value = ((uint32_t)input[50] << 24) |
			((uint32_t)input[51] << 16) |
			((uint32_t)input[52] << 8) |
			((uint32_t)(input[53] & 0x80));
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 425 to 449
	value = ((uint32_t)(input[53] & 0x7f) << 25) |
			((uint32_t)input[54] << 17) |
			((uint32_t)input[55] << 9) |
			((uint32_t)(input[56] & 0xc0) << 1);
	output[17] = (double)(value >> 7);

	// read output[18]: from bit 450 to 474
	value = ((uint32_t)(input[56] & 0x3f) << 26) |
			((uint32_t)input[57] << 18) |
			((uint32_t)input[58] << 10) |
			((uint32_t)(input[59] & 0xe0) << 2);
	output[18] = (double)(value >> 7);
}

static void unpack_19_25bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 25-bit signed
	// Skip 1 bits, read 475 bits of data.
	// Input must be at least 60 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 25
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)input[1] << 17) |
			((uint32_t)input[2] << 9) |
			((uint32_t)(input[3] & 0xc0) << 1);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 26 to 50
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0xe0) << 2);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 51 to 75
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xf0) << 3);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 76 to 100
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xf8) << 4);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 101 to 125
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)input[13] << 21) |
			((uint32_t)input[14] << 13) |
			((uint32_t)(input[15] & 0xfc) << 5);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 126 to 150
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)input[16] << 22) |
			((uint32_t)input[17] << 14) |
			((uint32_t)(input[18] & 0xfe) << 6);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 151 to 175
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)input[19] << 23) |
			((uint32_t)input[20] << 15) |
			((uint32_t)input[21] << 7);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 176 to 200
	value = ((uint32_t)input[22] << 24) |
			((uint32_t)input[23] << 16) |
			((uint32_t)input[24] << 8) |
			((uint32_t)(input[25] & 0x80));
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 201 to 225
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)input[26] << 17) |
			((uint32_t)input[27] << 9) |
			((uint32_t)(input[28] & 0xc0) << 1);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 226 to 250
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)input[29] << 18) |
			((uint32_t)input[30] << 10) |
			((uint32_t)(input[31] & 0xe0) << 2);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 251 to 275
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)input[32] << 19) |
			((uint32_t)input[33] << 11) |
			((uint32_t)(input[34] & 0xf0) << 3);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 276 to 300
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)input[35] << 20) |
			((uint32_t)input[36] << 12) |
			((uint32_t)(input[37] & 0xf8) << 4);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 301 to 325
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)input[38] << 21) |
			((uint32_t)input[39] << 13) |
			((uint32_t)(input[40] & 0xfc) << 5);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 326 to 350
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)input[41] << 22) |
			((uint32_t)input[42] << 14) |
			((uint32_t)(input[43] & 0xfe) << 6);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 351 to 375
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)input[44] << 23) |
			((uint32_t)input[45] << 15) |
			((uint32_t)input[46] << 7);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 376 to 400
	value = ((uint32_t)input[47] << 24) |
			((uint32_t)input[48] << 16) |
			((uint32_t)input[49] << 8) |
			((uint32_t)(input[50] & 0x80));
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 401 to 425
	value = ((uint32_t)(input[50] & 0x7f) << 25) |
			((uint32_t)input[51] << 17) |
			((uint32_t)input[52] << 9) |
			((uint32_t)(input[53] & 0xc0) << 1);
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 426 to 450
	value = ((uint32_t)(input[53] & 0x3f) << 26) |
			((uint32_t)input[54] << 18) |
			((uint32_t)input[55] << 10) |
			((uint32_t)(input[56] & 0xe0) << 2);
	output[17] = (double)(value >> 7);

	// read output[18]: from bit 451 to 475
	value = ((uint32_t)(input[56] & 0x1f) << 27) |
			((uint32_t)input[57] << 19) |
			((uint32_t)input[58] << 11) |
			((uint32_t)(input[59] & 0xf0) << 3);
	output[18] = (double)(value >> 7);
}

static void unpack_19_25bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 25-bit unsigned
	// Skip 1 bits, read 475 bits of data.
	// Input must be at least 60 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 25
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)input[1] << 17) |
			((uint32_t)input[2] << 9) |
			((uint32_t)(input[3] & 0xc0) << 1);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 26 to 50
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0xe0) << 2);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 51 to 75
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xf0) << 3);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 76 to 100
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xf8) << 4);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 101 to 125
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)input[13] << 21) |
			((uint32_t)input[14] << 13) |
			((uint32_t)(input[15] & 0xfc) << 5);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 126 to 150
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)input[16] << 22) |
			((uint32_t)input[17] << 14) |
			((uint32_t)(input[18] & 0xfe) << 6);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 151 to 175
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)input[19] << 23) |
			((uint32_t)input[20] << 15) |
			((uint32_t)input[21] << 7);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 176 to 200
	value = ((uint32_t)input[22] << 24) |
			((uint32_t)input[23] << 16) |
			((uint32_t)input[24] << 8) |
			((uint32_t)(input[25] & 0x80));
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 201 to 225
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)input[26] << 17) |
			((uint32_t)input[27] << 9) |
			((uint32_t)(input[28] & 0xc0) << 1);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 226 to 250
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)input[29] << 18) |
			((uint32_t)input[30] << 10) |
			((uint32_t)(input[31] & 0xe0) << 2);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 251 to 275
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)input[32] << 19) |
			((uint32_t)input[33] << 11) |
			((uint32_t)(input[34] & 0xf0) << 3);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 276 to 300
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)input[35] << 20) |
			((uint32_t)input[36] << 12) |
			((uint32_t)(input[37] & 0xf8) << 4);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 301 to 325
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)input[38] << 21) |
			((uint32_t)input[39] << 13) |
			((uint32_t)(input[40] & 0xfc) << 5);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 326 to 350
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)input[41] << 22) |
			((uint32_t)input[42] << 14) |
			((uint32_t)(input[43] & 0xfe) << 6);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 351 to 375
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)input[44] << 23) |
			((uint32_t)input[45] << 15) |
			((uint32_t)input[46] << 7);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 376 to 400
	value = ((uint32_t)input[47] << 24) |
			((uint32_t)input[48] << 16) |
			((uint32_t)input[49] << 8) |
			((uint32_t)(input[50] & 0x80));
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 401 to 425
	value = ((uint32_t)(input[50] & 0x7f) << 25) |
			((uint32_t)input[51] << 17) |
			((uint32_t)input[52] << 9) |
			((uint32_t)(input[53] & 0xc0) << 1);
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 426 to 450
	value = ((uint32_t)(input[53] & 0x3f) << 26) |
			((uint32_t)input[54] << 18) |
			((uint32_t)input[55] << 10) |
			((uint32_t)(input[56] & 0xe0) << 2);
	output[17] = (double)(value >> 7);

	// read output[18]: from bit 451 to 475
	value = ((uint32_t)(input[56] & 0x1f) << 27) |
			((uint32_t)input[57] << 19) |
			((uint32_t)input[58] << 11) |
			((uint32_t)(input[59] & 0xf0) << 3);
	output[18] = (double)(value >> 7);
}

static void unpack_19_25bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 25-bit signed
	// Skip 2 bits, read 475 bits of data.
	// Input must be at least 60 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 26
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)input[1] << 18) |
			((uint32_t)input[2] << 10) |
			((uint32_t)(input[3] & 0xe0) << 2);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 27 to 51
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xf0) << 3);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 52 to 76
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xf8) << 4);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 77 to 101
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)input[10] << 21) |
			((uint32_t)input[11] << 13) |
			((uint32_t)(input[12] & 0xfc) << 5);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 102 to 126
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)input[13] << 22) |
			((uint32_t)input[14] << 14) |
			((uint32_t)(input[15] & 0xfe) << 6);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 127 to 151
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)input[16] << 23) |
			((uint32_t)input[17] << 15) |
			((uint32_t)input[18] << 7);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 152 to 176
	value = ((uint32_t)input[19] << 24) |
			((uint32_t)input[20] << 16) |
			((uint32_t)input[21] << 8) |
			((uint32_t)(input[22] & 0x80));
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 177 to 201
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)input[23] << 17) |
			((uint32_t)input[24] << 9) |
			((uint32_t)(input[25] & 0xc0) << 1);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 202 to 226
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)input[26] << 18) |
			((uint32_t)input[27] << 10) |
			((uint32_t)(input[28] & 0xe0) << 2);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 227 to 251
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)input[29] << 19) |
			((uint32_t)input[30] << 11) |
			((uint32_t)(input[31] & 0xf0) << 3);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 252 to 276
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)input[32] << 20) |
			((uint32_t)input[33] << 12) |
			((uint32_t)(input[34] & 0xf8) << 4);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 277 to 301
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)input[35] << 21) |
			((uint32_t)input[36] << 13) |
			((uint32_t)(input[37] & 0xfc) << 5);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 302 to 326
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)input[38] << 22) |
			((uint32_t)input[39] << 14) |
			((uint32_t)(input[40] & 0xfe) << 6);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 327 to 351
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)input[41] << 23) |
			((uint32_t)input[42] << 15) |
			((uint32_t)input[43] << 7);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 352 to 376
	value = ((uint32_t)input[44] << 24) |
			((uint32_t)input[45] << 16) |
			((uint32_t)input[46] << 8) |
			((uint32_t)(input[47] & 0x80));
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 377 to 401
	value = ((uint32_t)(input[47] & 0x7f) << 25) |
			((uint32_t)input[48] << 17) |
			((uint32_t)input[49] << 9) |
			((uint32_t)(input[50] & 0xc0) << 1);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 402 to 426
	value = ((uint32_t)(input[50] & 0x3f) << 26) |
			((uint32_t)input[51] << 18) |
			((uint32_t)input[52] << 10) |
			((uint32_t)(input[53] & 0xe0) << 2);
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 427 to 451
	value = ((uint32_t)(input[53] & 0x1f) << 27) |
			((uint32_t)input[54] << 19) |
			((uint32_t)input[55] << 11) |
			((uint32_t)(input[56] & 0xf0) << 3);
	output[17] = (double)(value >> 7);

	// read output[18]: from bit 452 to 476
	value = ((uint32_t)(input[56] & 0x0f) << 28) |
			((uint32_t)input[57] << 20) |
			((uint32_t)input[58] << 12) |
			((uint32_t)(input[59] & 0xf8) << 4);
	output[18] = (double)(value >> 7);
}

static void unpack_19_25bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 25-bit unsigned
	// Skip 2 bits, read 475 bits of data.
	// Input must be at least 60 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 26
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)input[1] << 18) |
			((uint32_t)input[2] << 10) |
			((uint32_t)(input[3] & 0xe0) << 2);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 27 to 51
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xf0) << 3);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 52 to 76
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xf8) << 4);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 77 to 101
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)input[10] << 21) |
			((uint32_t)input[11] << 13) |
			((uint32_t)(input[12] & 0xfc) << 5);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 102 to 126
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)input[13] << 22) |
			((uint32_t)input[14] << 14) |
			((uint32_t)(input[15] & 0xfe) << 6);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 127 to 151
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)input[16] << 23) |
			((uint32_t)input[17] << 15) |
			((uint32_t)input[18] << 7);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 152 to 176
	value = ((uint32_t)input[19] << 24) |
			((uint32_t)input[20] << 16) |
			((uint32_t)input[21] << 8) |
			((uint32_t)(input[22] & 0x80));
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 177 to 201
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)input[23] << 17) |
			((uint32_t)input[24] << 9) |
			((uint32_t)(input[25] & 0xc0) << 1);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 202 to 226
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)input[26] << 18) |
			((uint32_t)input[27] << 10) |
			((uint32_t)(input[28] & 0xe0) << 2);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 227 to 251
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)input[29] << 19) |
			((uint32_t)input[30] << 11) |
			((uint32_t)(input[31] & 0xf0) << 3);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 252 to 276
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)input[32] << 20) |
			((uint32_t)input[33] << 12) |
			((uint32_t)(input[34] & 0xf8) << 4);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 277 to 301
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)input[35] << 21) |
			((uint32_t)input[36] << 13) |
			((uint32_t)(input[37] & 0xfc) << 5);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 302 to 326
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)input[38] << 22) |
			((uint32_t)input[39] << 14) |
			((uint32_t)(input[40] & 0xfe) << 6);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 327 to 351
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)input[41] << 23) |
			((uint32_t)input[42] << 15) |
			((uint32_t)input[43] << 7);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 352 to 376
	value = ((uint32_t)input[44] << 24) |
			((uint32_t)input[45] << 16) |
			((uint32_t)input[46] << 8) |
			((uint32_t)(input[47] & 0x80));
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 377 to 401
	value = ((uint32_t)(input[47] & 0x7f) << 25) |
			((uint32_t)input[48] << 17) |
			((uint32_t)input[49] << 9) |
			((uint32_t)(input[50] & 0xc0) << 1);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 402 to 426
	value = ((uint32_t)(input[50] & 0x3f) << 26) |
			((uint32_t)input[51] << 18) |
			((uint32_t)input[52] << 10) |
			((uint32_t)(input[53] & 0xe0) << 2);
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 427 to 451
	value = ((uint32_t)(input[53] & 0x1f) << 27) |
			((uint32_t)input[54] << 19) |
			((uint32_t)input[55] << 11) |
			((uint32_t)(input[56] & 0xf0) << 3);
	output[17] = (double)(value >> 7);

	// read output[18]: from bit 452 to 476
	value = ((uint32_t)(input[56] & 0x0f) << 28) |
			((uint32_t)input[57] << 20) |
			((uint32_t)input[58] << 12) |
			((uint32_t)(input[59] & 0xf8) << 4);
	output[18] = (double)(value >> 7);
}

static void unpack_19_25bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 25-bit signed
	// Skip 3 bits, read 475 bits of data.
	// Input must be at least 60 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 27
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)input[1] << 19) |
			((uint32_t)input[2] << 11) |
			((uint32_t)(input[3] & 0xf0) << 3);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 28 to 52
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xf8) << 4);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 53 to 77
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xfc) << 5);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 78 to 102
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)input[10] << 22) |
			((uint32_t)input[11] << 14) |
			((uint32_t)(input[12] & 0xfe) << 6);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 103 to 127
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)input[13] << 23) |
			((uint32_t)input[14] << 15) |
			((uint32_t)input[15] << 7);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 128 to 152
	value = ((uint32_t)input[16] << 24) |
			((uint32_t)input[17] << 16) |
			((uint32_t)input[18] << 8) |
			((uint32_t)(input[19] & 0x80));
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 153 to 177
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)input[20] << 17) |
			((uint32_t)input[21] << 9) |
			((uint32_t)(input[22] & 0xc0) << 1);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 178 to 202
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)input[23] << 18) |
			((uint32_t)input[24] << 10) |
			((uint32_t)(input[25] & 0xe0) << 2);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 203 to 227
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)input[26] << 19) |
			((uint32_t)input[27] << 11) |
			((uint32_t)(input[28] & 0xf0) << 3);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 228 to 252
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)input[29] << 20) |
			((uint32_t)input[30] << 12) |
			((uint32_t)(input[31] & 0xf8) << 4);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 253 to 277
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)input[32] << 21) |
			((uint32_t)input[33] << 13) |
			((uint32_t)(input[34] & 0xfc) << 5);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 278 to 302
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)input[35] << 22) |
			((uint32_t)input[36] << 14) |
			((uint32_t)(input[37] & 0xfe) << 6);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 303 to 327
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)input[38] << 23) |
			((uint32_t)input[39] << 15) |
			((uint32_t)input[40] << 7);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 328 to 352
	value = ((uint32_t)input[41] << 24) |
			((uint32_t)input[42] << 16) |
			((uint32_t)input[43] << 8) |
			((uint32_t)(input[44] & 0x80));
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 353 to 377
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)input[45] << 17) |
			((uint32_t)input[46] << 9) |
			((uint32_t)(input[47] & 0xc0) << 1);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 378 to 402
	value = ((uint32_t)(input[47] & 0x3f) << 26) |
			((uint32_t)input[48] << 18) |
			((uint32_t)input[49] << 10) |
			((uint32_t)(input[50] & 0xe0) << 2);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 403 to 427
	value = ((uint32_t)(input[50] & 0x1f) << 27) |
			((uint32_t)input[51] << 19) |
			((uint32_t)input[52] << 11) |
			((uint32_t)(input[53] & 0xf0) << 3);
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 428 to 452
	value = ((uint32_t)(input[53] & 0x0f) << 28) |
			((uint32_t)input[54] << 20) |
			((uint32_t)input[55] << 12) |
			((uint32_t)(input[56] & 0xf8) << 4);
	output[17] = (double)(value >> 7);

	// read output[18]: from bit 453 to 477
	value = ((uint32_t)(input[56] & 0x07) << 29) |
			((uint32_t)input[57] << 21) |
			((uint32_t)input[58] << 13) |
			((uint32_t)(input[59] & 0xfc) << 5);
	output[18] = (double)(value >> 7);
}

static void unpack_19_25bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 25-bit unsigned
	// Skip 3 bits, read 475 bits of data.
	// Input must be at least 60 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 27
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)input[1] << 19) |
			((uint32_t)input[2] << 11) |
			((uint32_t)(input[3] & 0xf0) << 3);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 28 to 52
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xf8) << 4);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 53 to 77
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xfc) << 5);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 78 to 102
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)input[10] << 22) |
			((uint32_t)input[11] << 14) |
			((uint32_t)(input[12] & 0xfe) << 6);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 103 to 127
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)input[13] << 23) |
			((uint32_t)input[14] << 15) |
			((uint32_t)input[15] << 7);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 128 to 152
	value = ((uint32_t)input[16] << 24) |
			((uint32_t)input[17] << 16) |
			((uint32_t)input[18] << 8) |
			((uint32_t)(input[19] & 0x80));
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 153 to 177
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)input[20] << 17) |
			((uint32_t)input[21] << 9) |
			((uint32_t)(input[22] & 0xc0) << 1);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 178 to 202
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)input[23] << 18) |
			((uint32_t)input[24] << 10) |
			((uint32_t)(input[25] & 0xe0) << 2);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 203 to 227
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)input[26] << 19) |
			((uint32_t)input[27] << 11) |
			((uint32_t)(input[28] & 0xf0) << 3);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 228 to 252
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)input[29] << 20) |
			((uint32_t)input[30] << 12) |
			((uint32_t)(input[31] & 0xf8) << 4);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 253 to 277
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)input[32] << 21) |
			((uint32_t)input[33] << 13) |
			((uint32_t)(input[34] & 0xfc) << 5);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 278 to 302
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)input[35] << 22) |
			((uint32_t)input[36] << 14) |
			((uint32_t)(input[37] & 0xfe) << 6);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 303 to 327
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)input[38] << 23) |
			((uint32_t)input[39] << 15) |
			((uint32_t)input[40] << 7);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 328 to 352
	value = ((uint32_t)input[41] << 24) |
			((uint32_t)input[42] << 16) |
			((uint32_t)input[43] << 8) |
			((uint32_t)(input[44] & 0x80));
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 353 to 377
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)input[45] << 17) |
			((uint32_t)input[46] << 9) |
			((uint32_t)(input[47] & 0xc0) << 1);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 378 to 402
	value = ((uint32_t)(input[47] & 0x3f) << 26) |
			((uint32_t)input[48] << 18) |
			((uint32_t)input[49] << 10) |
			((uint32_t)(input[50] & 0xe0) << 2);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 403 to 427
	value = ((uint32_t)(input[50] & 0x1f) << 27) |
			((uint32_t)input[51] << 19) |
			((uint32_t)input[52] << 11) |
			((uint32_t)(input[53] & 0xf0) << 3);
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 428 to 452
	value = ((uint32_t)(input[53] & 0x0f) << 28) |
			((uint32_t)input[54] << 20) |
			((uint32_t)input[55] << 12) |
			((uint32_t)(input[56] & 0xf8) << 4);
	output[17] = (double)(value >> 7);

	// read output[18]: from bit 453 to 477
	value = ((uint32_t)(input[56] & 0x07) << 29) |
			((uint32_t)input[57] << 21) |
			((uint32_t)input[58] << 13) |
			((uint32_t)(input[59] & 0xfc) << 5);
	output[18] = (double)(value >> 7);
}

static void unpack_19_25bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 25-bit signed
	// Skip 4 bits, read 475 bits of data.
	// Input must be at least 60 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 28
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)input[1] << 20) |
			((uint32_t)input[2] << 12) |
			((uint32_t)(input[3] & 0xf8) << 4);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 29 to 53
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xfc) << 5);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 54 to 78
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)input[7] << 22) |
			((uint32_t)input[8] << 14) |
			((uint32_t)(input[9] & 0xfe) << 6);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 79 to 103
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)input[10] << 23) |
			((uint32_t)input[11] << 15) |
			((uint32_t)input[12] << 7);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 104 to 128
	value = ((uint32_t)input[13] << 24) |
			((uint32_t)input[14] << 16) |
			((uint32_t)input[15] << 8) |
			((uint32_t)(input[16] & 0x80));
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 129 to 153
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)input[17] << 17) |
			((uint32_t)input[18] << 9) |
			((uint32_t)(input[19] & 0xc0) << 1);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 154 to 178
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)input[20] << 18) |
			((uint32_t)input[21] << 10) |
			((uint32_t)(input[22] & 0xe0) << 2);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 179 to 203
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)input[23] << 19) |
			((uint32_t)input[24] << 11) |
			((uint32_t)(input[25] & 0xf0) << 3);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 204 to 228
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)input[26] << 20) |
			((uint32_t)input[27] << 12) |
			((uint32_t)(input[28] & 0xf8) << 4);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 229 to 253
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)input[29] << 21) |
			((uint32_t)input[30] << 13) |
			((uint32_t)(input[31] & 0xfc) << 5);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 254 to 278
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)input[32] << 22) |
			((uint32_t)input[33] << 14) |
			((uint32_t)(input[34] & 0xfe) << 6);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 279 to 303
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)input[35] << 23) |
			((uint32_t)input[36] << 15) |
			((uint32_t)input[37] << 7);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 304 to 328
	value = ((uint32_t)input[38] << 24) |
			((uint32_t)input[39] << 16) |
			((uint32_t)input[40] << 8) |
			((uint32_t)(input[41] & 0x80));
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 329 to 353
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)input[42] << 17) |
			((uint32_t)input[43] << 9) |
			((uint32_t)(input[44] & 0xc0) << 1);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 354 to 378
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)input[45] << 18) |
			((uint32_t)input[46] << 10) |
			((uint32_t)(input[47] & 0xe0) << 2);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 379 to 403
	value = ((uint32_t)(input[47] & 0x1f) << 27) |
			((uint32_t)input[48] << 19) |
			((uint32_t)input[49] << 11) |
			((uint32_t)(input[50] & 0xf0) << 3);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 404 to 428
	value = ((uint32_t)(input[50] & 0x0f) << 28) |
			((uint32_t)input[51] << 20) |
			((uint32_t)input[52] << 12) |
			((uint32_t)(input[53] & 0xf8) << 4);
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 429 to 453
	value = ((uint32_t)(input[53] & 0x07) << 29) |
			((uint32_t)input[54] << 21) |
			((uint32_t)input[55] << 13) |
			((uint32_t)(input[56] & 0xfc) << 5);
	output[17] = (double)(value >> 7);

	// read output[18]: from bit 454 to 478
	value = ((uint32_t)(input[56] & 0x03) << 30) |
			((uint32_t)input[57] << 22) |
			((uint32_t)input[58] << 14) |
			((uint32_t)(input[59] & 0xfe) << 6);
	output[18] = (double)(value >> 7);
}

static void unpack_19_25bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 25-bit unsigned
	// Skip 4 bits, read 475 bits of data.
	// Input must be at least 60 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 28
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)input[1] << 20) |
			((uint32_t)input[2] << 12) |
			((uint32_t)(input[3] & 0xf8) << 4);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 29 to 53
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xfc) << 5);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 54 to 78
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)input[7] << 22) |
			((uint32_t)input[8] << 14) |
			((uint32_t)(input[9] & 0xfe) << 6);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 79 to 103
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)input[10] << 23) |
			((uint32_t)input[11] << 15) |
			((uint32_t)input[12] << 7);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 104 to 128
	value = ((uint32_t)input[13] << 24) |
			((uint32_t)input[14] << 16) |
			((uint32_t)input[15] << 8) |
			((uint32_t)(input[16] & 0x80));
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 129 to 153
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)input[17] << 17) |
			((uint32_t)input[18] << 9) |
			((uint32_t)(input[19] & 0xc0) << 1);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 154 to 178
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)input[20] << 18) |
			((uint32_t)input[21] << 10) |
			((uint32_t)(input[22] & 0xe0) << 2);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 179 to 203
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)input[23] << 19) |
			((uint32_t)input[24] << 11) |
			((uint32_t)(input[25] & 0xf0) << 3);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 204 to 228
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)input[26] << 20) |
			((uint32_t)input[27] << 12) |
			((uint32_t)(input[28] & 0xf8) << 4);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 229 to 253
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)input[29] << 21) |
			((uint32_t)input[30] << 13) |
			((uint32_t)(input[31] & 0xfc) << 5);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 254 to 278
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)input[32] << 22) |
			((uint32_t)input[33] << 14) |
			((uint32_t)(input[34] & 0xfe) << 6);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 279 to 303
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)input[35] << 23) |
			((uint32_t)input[36] << 15) |
			((uint32_t)input[37] << 7);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 304 to 328
	value = ((uint32_t)input[38] << 24) |
			((uint32_t)input[39] << 16) |
			((uint32_t)input[40] << 8) |
			((uint32_t)(input[41] & 0x80));
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 329 to 353
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)input[42] << 17) |
			((uint32_t)input[43] << 9) |
			((uint32_t)(input[44] & 0xc0) << 1);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 354 to 378
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)input[45] << 18) |
			((uint32_t)input[46] << 10) |
			((uint32_t)(input[47] & 0xe0) << 2);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 379 to 403
	value = ((uint32_t)(input[47] & 0x1f) << 27) |
			((uint32_t)input[48] << 19) |
			((uint32_t)input[49] << 11) |
			((uint32_t)(input[50] & 0xf0) << 3);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 404 to 428
	value = ((uint32_t)(input[50] & 0x0f) << 28) |
			((uint32_t)input[51] << 20) |
			((uint32_t)input[52] << 12) |
			((uint32_t)(input[53] & 0xf8) << 4);
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 429 to 453
	value = ((uint32_t)(input[53] & 0x07) << 29) |
			((uint32_t)input[54] << 21) |
			((uint32_t)input[55] << 13) |
			((uint32_t)(input[56] & 0xfc) << 5);
	output[17] = (double)(value >> 7);

	// read output[18]: from bit 454 to 478
	value = ((uint32_t)(input[56] & 0x03) << 30) |
			((uint32_t)input[57] << 22) |
			((uint32_t)input[58] << 14) |
			((uint32_t)(input[59] & 0xfe) << 6);
	output[18] = (double)(value >> 7);
}

static void unpack_19_25bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 25-bit signed
	// Skip 5 bits, read 475 bits of data.
	// Input must be at least 60 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 29
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)input[1] << 21) |
			((uint32_t)input[2] << 13) |
			((uint32_t)(input[3] & 0xfc) << 5);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 30 to 54
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xfe) << 6);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 55 to 79
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)input[7] << 23) |
			((uint32_t)input[8] << 15) |
			((uint32_t)input[9] << 7);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 80 to 104
	value = ((uint32_t)input[10] << 24) |
			((uint32_t)input[11] << 16) |
			((uint32_t)input[12] << 8) |
			((uint32_t)(input[13] & 0x80));
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 105 to 129
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)input[14] << 17) |
			((uint32_t)input[15] << 9) |
			((uint32_t)(input[16] & 0xc0) << 1);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 130 to 154
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)input[17] << 18) |
			((uint32_t)input[18] << 10) |
			((uint32_t)(input[19] & 0xe0) << 2);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 155 to 179
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)input[20] << 19) |
			((uint32_t)input[21] << 11) |
			((uint32_t)(input[22] & 0xf0) << 3);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 180 to 204
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)input[23] << 20) |
			((uint32_t)input[24] << 12) |
			((uint32_t)(input[25] & 0xf8) << 4);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 205 to 229
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)input[26] << 21) |
			((uint32_t)input[27] << 13) |
			((uint32_t)(input[28] & 0xfc) << 5);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 230 to 254
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)input[29] << 22) |
			((uint32_t)input[30] << 14) |
			((uint32_t)(input[31] & 0xfe) << 6);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 255 to 279
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)input[32] << 23) |
			((uint32_t)input[33] << 15) |
			((uint32_t)input[34] << 7);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 280 to 304
	value = ((uint32_t)input[35] << 24) |
			((uint32_t)input[36] << 16) |
			((uint32_t)input[37] << 8) |
			((uint32_t)(input[38] & 0x80));
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 305 to 329
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)input[39] << 17) |
			((uint32_t)input[40] << 9) |
			((uint32_t)(input[41] & 0xc0) << 1);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 330 to 354
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)input[42] << 18) |
			((uint32_t)input[43] << 10) |
			((uint32_t)(input[44] & 0xe0) << 2);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 355 to 379
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)input[45] << 19) |
			((uint32_t)input[46] << 11) |
			((uint32_t)(input[47] & 0xf0) << 3);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 380 to 404
	value = ((uint32_t)(input[47] & 0x0f) << 28) |
			((uint32_t)input[48] << 20) |
			((uint32_t)input[49] << 12) |
			((uint32_t)(input[50] & 0xf8) << 4);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 405 to 429
	value = ((uint32_t)(input[50] & 0x07) << 29) |
			((uint32_t)input[51] << 21) |
			((uint32_t)input[52] << 13) |
			((uint32_t)(input[53] & 0xfc) << 5);
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 430 to 454
	value = ((uint32_t)(input[53] & 0x03) << 30) |
			((uint32_t)input[54] << 22) |
			((uint32_t)input[55] << 14) |
			((uint32_t)(input[56] & 0xfe) << 6);
	output[17] = (double)(value >> 7);

	// read output[18]: from bit 455 to 479
	value = ((uint32_t)(input[56] & 0x01) << 31) |
			((uint32_t)input[57] << 23) |
			((uint32_t)input[58] << 15) |
			((uint32_t)input[59] << 7);
	output[18] = (double)(value >> 7);
}

static void unpack_19_25bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 25-bit unsigned
	// Skip 5 bits, read 475 bits of data.
	// Input must be at least 60 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 29
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)input[1] << 21) |
			((uint32_t)input[2] << 13) |
			((uint32_t)(input[3] & 0xfc) << 5);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 30 to 54
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xfe) << 6);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 55 to 79
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)input[7] << 23) |
			((uint32_t)input[8] << 15) |
			((uint32_t)input[9] << 7);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 80 to 104
	value = ((uint32_t)input[10] << 24) |
			((uint32_t)input[11] << 16) |
			((uint32_t)input[12] << 8) |
			((uint32_t)(input[13] & 0x80));
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 105 to 129
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)input[14] << 17) |
			((uint32_t)input[15] << 9) |
			((uint32_t)(input[16] & 0xc0) << 1);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 130 to 154
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)input[17] << 18) |
			((uint32_t)input[18] << 10) |
			((uint32_t)(input[19] & 0xe0) << 2);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 155 to 179
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)input[20] << 19) |
			((uint32_t)input[21] << 11) |
			((uint32_t)(input[22] & 0xf0) << 3);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 180 to 204
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)input[23] << 20) |
			((uint32_t)input[24] << 12) |
			((uint32_t)(input[25] & 0xf8) << 4);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 205 to 229
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)input[26] << 21) |
			((uint32_t)input[27] << 13) |
			((uint32_t)(input[28] & 0xfc) << 5);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 230 to 254
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)input[29] << 22) |
			((uint32_t)input[30] << 14) |
			((uint32_t)(input[31] & 0xfe) << 6);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 255 to 279
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)input[32] << 23) |
			((uint32_t)input[33] << 15) |
			((uint32_t)input[34] << 7);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 280 to 304
	value = ((uint32_t)input[35] << 24) |
			((uint32_t)input[36] << 16) |
			((uint32_t)input[37] << 8) |
			((uint32_t)(input[38] & 0x80));
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 305 to 329
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)input[39] << 17) |
			((uint32_t)input[40] << 9) |
			((uint32_t)(input[41] & 0xc0) << 1);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 330 to 354
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)input[42] << 18) |
			((uint32_t)input[43] << 10) |
			((uint32_t)(input[44] & 0xe0) << 2);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 355 to 379
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)input[45] << 19) |
			((uint32_t)input[46] << 11) |
			((uint32_t)(input[47] & 0xf0) << 3);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 380 to 404
	value = ((uint32_t)(input[47] & 0x0f) << 28) |
			((uint32_t)input[48] << 20) |
			((uint32_t)input[49] << 12) |
			((uint32_t)(input[50] & 0xf8) << 4);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 405 to 429
	value = ((uint32_t)(input[50] & 0x07) << 29) |
			((uint32_t)input[51] << 21) |
			((uint32_t)input[52] << 13) |
			((uint32_t)(input[53] & 0xfc) << 5);
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 430 to 454
	value = ((uint32_t)(input[53] & 0x03) << 30) |
			((uint32_t)input[54] << 22) |
			((uint32_t)input[55] << 14) |
			((uint32_t)(input[56] & 0xfe) << 6);
	output[17] = (double)(value >> 7);

	// read output[18]: from bit 455 to 479
	value = ((uint32_t)(input[56] & 0x01) << 31) |
			((uint32_t)input[57] << 23) |
			((uint32_t)input[58] << 15) |
			((uint32_t)input[59] << 7);
	output[18] = (double)(value >> 7);
}

static void unpack_19_25bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 25-bit signed
	// Skip 6 bits, read 475 bits of data.
	// Input must be at least 61 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 30
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)input[1] << 22) |
			((uint32_t)input[2] << 14) |
			((uint32_t)(input[3] & 0xfe) << 6);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 31 to 55
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)input[4] << 23) |
			((uint32_t)input[5] << 15) |
			((uint32_t)input[6] << 7);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 56 to 80
	value = ((uint32_t)input[7] << 24) |
			((uint32_t)input[8] << 16) |
			((uint32_t)input[9] << 8) |
			((uint32_t)(input[10] & 0x80));
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 81 to 105
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)input[11] << 17) |
			((uint32_t)input[12] << 9) |
			((uint32_t)(input[13] & 0xc0) << 1);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 106 to 130
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)input[14] << 18) |
			((uint32_t)input[15] << 10) |
			((uint32_t)(input[16] & 0xe0) << 2);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 131 to 155
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)input[17] << 19) |
			((uint32_t)input[18] << 11) |
			((uint32_t)(input[19] & 0xf0) << 3);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 156 to 180
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)input[20] << 20) |
			((uint32_t)input[21] << 12) |
			((uint32_t)(input[22] & 0xf8) << 4);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 181 to 205
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)input[23] << 21) |
			((uint32_t)input[24] << 13) |
			((uint32_t)(input[25] & 0xfc) << 5);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 206 to 230
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)input[26] << 22) |
			((uint32_t)input[27] << 14) |
			((uint32_t)(input[28] & 0xfe) << 6);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 231 to 255
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)input[29] << 23) |
			((uint32_t)input[30] << 15) |
			((uint32_t)input[31] << 7);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 256 to 280
	value = ((uint32_t)input[32] << 24) |
			((uint32_t)input[33] << 16) |
			((uint32_t)input[34] << 8) |
			((uint32_t)(input[35] & 0x80));
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 281 to 305
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)input[36] << 17) |
			((uint32_t)input[37] << 9) |
			((uint32_t)(input[38] & 0xc0) << 1);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 306 to 330
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)input[39] << 18) |
			((uint32_t)input[40] << 10) |
			((uint32_t)(input[41] & 0xe0) << 2);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 331 to 355
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)input[42] << 19) |
			((uint32_t)input[43] << 11) |
			((uint32_t)(input[44] & 0xf0) << 3);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 356 to 380
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)input[45] << 20) |
			((uint32_t)input[46] << 12) |
			((uint32_t)(input[47] & 0xf8) << 4);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 381 to 405
	value = ((uint32_t)(input[47] & 0x07) << 29) |
			((uint32_t)input[48] << 21) |
			((uint32_t)input[49] << 13) |
			((uint32_t)(input[50] & 0xfc) << 5);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 406 to 430
	value = ((uint32_t)(input[50] & 0x03) << 30) |
			((uint32_t)input[51] << 22) |
			((uint32_t)input[52] << 14) |
			((uint32_t)(input[53] & 0xfe) << 6);
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 431 to 455
	value = ((uint32_t)(input[53] & 0x01) << 31) |
			((uint32_t)input[54] << 23) |
			((uint32_t)input[55] << 15) |
			((uint32_t)input[56] << 7);
	output[17] = (double)(value >> 7);

	// read output[18]: from bit 456 to 480
	value = ((uint32_t)input[57] << 24) |
			((uint32_t)input[58] << 16) |
			((uint32_t)input[59] << 8) |
			((uint32_t)(input[60] & 0x80));
	output[18] = (double)(value >> 7);
}

static void unpack_19_25bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 25-bit unsigned
	// Skip 6 bits, read 475 bits of data.
	// Input must be at least 61 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 30
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)input[1] << 22) |
			((uint32_t)input[2] << 14) |
			((uint32_t)(input[3] & 0xfe) << 6);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 31 to 55
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)input[4] << 23) |
			((uint32_t)input[5] << 15) |
			((uint32_t)input[6] << 7);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 56 to 80
	value = ((uint32_t)input[7] << 24) |
			((uint32_t)input[8] << 16) |
			((uint32_t)input[9] << 8) |
			((uint32_t)(input[10] & 0x80));
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 81 to 105
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)input[11] << 17) |
			((uint32_t)input[12] << 9) |
			((uint32_t)(input[13] & 0xc0) << 1);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 106 to 130
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)input[14] << 18) |
			((uint32_t)input[15] << 10) |
			((uint32_t)(input[16] & 0xe0) << 2);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 131 to 155
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)input[17] << 19) |
			((uint32_t)input[18] << 11) |
			((uint32_t)(input[19] & 0xf0) << 3);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 156 to 180
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)input[20] << 20) |
			((uint32_t)input[21] << 12) |
			((uint32_t)(input[22] & 0xf8) << 4);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 181 to 205
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)input[23] << 21) |
			((uint32_t)input[24] << 13) |
			((uint32_t)(input[25] & 0xfc) << 5);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 206 to 230
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)input[26] << 22) |
			((uint32_t)input[27] << 14) |
			((uint32_t)(input[28] & 0xfe) << 6);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 231 to 255
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)input[29] << 23) |
			((uint32_t)input[30] << 15) |
			((uint32_t)input[31] << 7);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 256 to 280
	value = ((uint32_t)input[32] << 24) |
			((uint32_t)input[33] << 16) |
			((uint32_t)input[34] << 8) |
			((uint32_t)(input[35] & 0x80));
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 281 to 305
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)input[36] << 17) |
			((uint32_t)input[37] << 9) |
			((uint32_t)(input[38] & 0xc0) << 1);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 306 to 330
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)input[39] << 18) |
			((uint32_t)input[40] << 10) |
			((uint32_t)(input[41] & 0xe0) << 2);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 331 to 355
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)input[42] << 19) |
			((uint32_t)input[43] << 11) |
			((uint32_t)(input[44] & 0xf0) << 3);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 356 to 380
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)input[45] << 20) |
			((uint32_t)input[46] << 12) |
			((uint32_t)(input[47] & 0xf8) << 4);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 381 to 405
	value = ((uint32_t)(input[47] & 0x07) << 29) |
			((uint32_t)input[48] << 21) |
			((uint32_t)input[49] << 13) |
			((uint32_t)(input[50] & 0xfc) << 5);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 406 to 430
	value = ((uint32_t)(input[50] & 0x03) << 30) |
			((uint32_t)input[51] << 22) |
			((uint32_t)input[52] << 14) |
			((uint32_t)(input[53] & 0xfe) << 6);
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 431 to 455
	value = ((uint32_t)(input[53] & 0x01) << 31) |
			((uint32_t)input[54] << 23) |
			((uint32_t)input[55] << 15) |
			((uint32_t)input[56] << 7);
	output[17] = (double)(value >> 7);

	// read output[18]: from bit 456 to 480
	value = ((uint32_t)input[57] << 24) |
			((uint32_t)input[58] << 16) |
			((uint32_t)input[59] << 8) |
			((uint32_t)(input[60] & 0x80));
	output[18] = (double)(value >> 7);
}

static void unpack_19_25bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 25-bit signed
	// Skip 7 bits, read 475 bits of data.
	// Input must be at least 61 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 31
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)input[1] << 23) |
			((uint32_t)input[2] << 15) |
			((uint32_t)input[3] << 7);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 32 to 56
	value = ((uint32_t)input[4] << 24) |
			((uint32_t)input[5] << 16) |
			((uint32_t)input[6] << 8) |
			((uint32_t)(input[7] & 0x80));
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 57 to 81
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)input[8] << 17) |
			((uint32_t)input[9] << 9) |
			((uint32_t)(input[10] & 0xc0) << 1);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 82 to 106
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)input[11] << 18) |
			((uint32_t)input[12] << 10) |
			((uint32_t)(input[13] & 0xe0) << 2);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 107 to 131
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)input[14] << 19) |
			((uint32_t)input[15] << 11) |
			((uint32_t)(input[16] & 0xf0) << 3);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 132 to 156
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)input[17] << 20) |
			((uint32_t)input[18] << 12) |
			((uint32_t)(input[19] & 0xf8) << 4);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 157 to 181
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)input[20] << 21) |
			((uint32_t)input[21] << 13) |
			((uint32_t)(input[22] & 0xfc) << 5);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 182 to 206
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)input[23] << 22) |
			((uint32_t)input[24] << 14) |
			((uint32_t)(input[25] & 0xfe) << 6);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 207 to 231
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)input[28] << 7);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 232 to 256
	value = ((uint32_t)input[29] << 24) |
			((uint32_t)input[30] << 16) |
			((uint32_t)input[31] << 8) |
			((uint32_t)(input[32] & 0x80));
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 257 to 281
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)input[33] << 17) |
			((uint32_t)input[34] << 9) |
			((uint32_t)(input[35] & 0xc0) << 1);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 282 to 306
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)input[36] << 18) |
			((uint32_t)input[37] << 10) |
			((uint32_t)(input[38] & 0xe0) << 2);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 307 to 331
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)input[39] << 19) |
			((uint32_t)input[40] << 11) |
			((uint32_t)(input[41] & 0xf0) << 3);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 332 to 356
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)input[42] << 20) |
			((uint32_t)input[43] << 12) |
			((uint32_t)(input[44] & 0xf8) << 4);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 357 to 381
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)input[45] << 21) |
			((uint32_t)input[46] << 13) |
			((uint32_t)(input[47] & 0xfc) << 5);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 382 to 406
	value = ((uint32_t)(input[47] & 0x03) << 30) |
			((uint32_t)input[48] << 22) |
			((uint32_t)input[49] << 14) |
			((uint32_t)(input[50] & 0xfe) << 6);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 407 to 431
	value = ((uint32_t)(input[50] & 0x01) << 31) |
			((uint32_t)input[51] << 23) |
			((uint32_t)input[52] << 15) |
			((uint32_t)input[53] << 7);
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 432 to 456
	value = ((uint32_t)input[54] << 24) |
			((uint32_t)input[55] << 16) |
			((uint32_t)input[56] << 8) |
			((uint32_t)(input[57] & 0x80));
	output[17] = (double)(value >> 7);

	// read output[18]: from bit 457 to 481
	value = ((uint32_t)(input[57] & 0x7f) << 25) |
			((uint32_t)input[58] << 17) |
			((uint32_t)input[59] << 9) |
			((uint32_t)(input[60] & 0xc0) << 1);
	output[18] = (double)(value >> 7);
}

static void unpack_19_25bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 25-bit unsigned
	// Skip 7 bits, read 475 bits of data.
	// Input must be at least 61 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 31
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)input[1] << 23) |
			((uint32_t)input[2] << 15) |
			((uint32_t)input[3] << 7);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 32 to 56
	value = ((uint32_t)input[4] << 24) |
			((uint32_t)input[5] << 16) |
			((uint32_t)input[6] << 8) |
			((uint32_t)(input[7] & 0x80));
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 57 to 81
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)input[8] << 17) |
			((uint32_t)input[9] << 9) |
			((uint32_t)(input[10] & 0xc0) << 1);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 82 to 106
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)input[11] << 18) |
			((uint32_t)input[12] << 10) |
			((uint32_t)(input[13] & 0xe0) << 2);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 107 to 131
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)input[14] << 19) |
			((uint32_t)input[15] << 11) |
			((uint32_t)(input[16] & 0xf0) << 3);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 132 to 156
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)input[17] << 20) |
			((uint32_t)input[18] << 12) |
			((uint32_t)(input[19] & 0xf8) << 4);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 157 to 181
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)input[20] << 21) |
			((uint32_t)input[21] << 13) |
			((uint32_t)(input[22] & 0xfc) << 5);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 182 to 206
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)input[23] << 22) |
			((uint32_t)input[24] << 14) |
			((uint32_t)(input[25] & 0xfe) << 6);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 207 to 231
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)input[28] << 7);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 232 to 256
	value = ((uint32_t)input[29] << 24) |
			((uint32_t)input[30] << 16) |
			((uint32_t)input[31] << 8) |
			((uint32_t)(input[32] & 0x80));
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 257 to 281
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)input[33] << 17) |
			((uint32_t)input[34] << 9) |
			((uint32_t)(input[35] & 0xc0) << 1);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 282 to 306
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)input[36] << 18) |
			((uint32_t)input[37] << 10) |
			((uint32_t)(input[38] & 0xe0) << 2);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 307 to 331
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)input[39] << 19) |
			((uint32_t)input[40] << 11) |
			((uint32_t)(input[41] & 0xf0) << 3);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 332 to 356
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)input[42] << 20) |
			((uint32_t)input[43] << 12) |
			((uint32_t)(input[44] & 0xf8) << 4);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 357 to 381
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)input[45] << 21) |
			((uint32_t)input[46] << 13) |
			((uint32_t)(input[47] & 0xfc) << 5);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 382 to 406
	value = ((uint32_t)(input[47] & 0x03) << 30) |
			((uint32_t)input[48] << 22) |
			((uint32_t)input[49] << 14) |
			((uint32_t)(input[50] & 0xfe) << 6);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 407 to 431
	value = ((uint32_t)(input[50] & 0x01) << 31) |
			((uint32_t)input[51] << 23) |
			((uint32_t)input[52] << 15) |
			((uint32_t)input[53] << 7);
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 432 to 456
	value = ((uint32_t)input[54] << 24) |
			((uint32_t)input[55] << 16) |
			((uint32_t)input[56] << 8) |
			((uint32_t)(input[57] & 0x80));
	output[17] = (double)(value >> 7);

	// read output[18]: from bit 457 to 481
	value = ((uint32_t)(input[57] & 0x7f) << 25) |
			((uint32_t)input[58] << 17) |
			((uint32_t)input[59] << 9) |
			((uint32_t)(input[60] & 0xc0) << 1);
	output[18] = (double)(value >> 7);
}

static void unpack_20_25bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 25-bit signed
	// Skip 0 bits, read 500 bits of data.
	// Input must be at least 63 bytes long

	int32_t value;

	// read output[0]: from bit 0 to 24
	value = ((uint32_t)input[0] << 24) |
			((uint32_t)input[1] << 16) |
			((uint32_t)input[2] << 8) |
			((uint32_t)(input[3] & 0x80));
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 25 to 49
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)input[4] << 17) |
			((uint32_t)input[5] << 9) |
			((uint32_t)(input[6] & 0xc0) << 1);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 50 to 74
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0xe0) << 2);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 75 to 99
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xf0) << 3);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 100 to 124
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)input[13] << 20) |
			((uint32_t)input[14] << 12) |
			((uint32_t)(input[15] & 0xf8) << 4);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 125 to 149
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)input[16] << 21) |
			((uint32_t)input[17] << 13) |
			((uint32_t)(input[18] & 0xfc) << 5);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 150 to 174
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)input[19] << 22) |
			((uint32_t)input[20] << 14) |
			((uint32_t)(input[21] & 0xfe) << 6);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 175 to 199
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)input[22] << 23) |
			((uint32_t)input[23] << 15) |
			((uint32_t)input[24] << 7);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 200 to 224
	value = ((uint32_t)input[25] << 24) |
			((uint32_t)input[26] << 16) |
			((uint32_t)input[27] << 8) |
			((uint32_t)(input[28] & 0x80));
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 225 to 249
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)input[29] << 17) |
			((uint32_t)input[30] << 9) |
			((uint32_t)(input[31] & 0xc0) << 1);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 250 to 274
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)input[32] << 18) |
			((uint32_t)input[33] << 10) |
			((uint32_t)(input[34] & 0xe0) << 2);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 275 to 299
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)input[35] << 19) |
			((uint32_t)input[36] << 11) |
			((uint32_t)(input[37] & 0xf0) << 3);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 300 to 324
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)input[38] << 20) |
			((uint32_t)input[39] << 12) |
			((uint32_t)(input[40] & 0xf8) << 4);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 325 to 349
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)input[41] << 21) |
			((uint32_t)input[42] << 13) |
			((uint32_t)(input[43] & 0xfc) << 5);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 350 to 374
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)input[44] << 22) |
			((uint32_t)input[45] << 14) |
			((uint32_t)(input[46] & 0xfe) << 6);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 375 to 399
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)input[47] << 23) |
			((uint32_t)input[48] << 15) |
			((uint32_t)input[49] << 7);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 400 to 424
	value = ((uint32_t)input[50] << 24) |
			((uint32_t)input[51] << 16) |
			((uint32_t)input[52] << 8) |
			((uint32_t)(input[53] & 0x80));
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 425 to 449
	value = ((uint32_t)(input[53] & 0x7f) << 25) |
			((uint32_t)input[54] << 17) |
			((uint32_t)input[55] << 9) |
			((uint32_t)(input[56] & 0xc0) << 1);
	output[17] = (double)(value >> 7);

	// read output[18]: from bit 450 to 474
	value = ((uint32_t)(input[56] & 0x3f) << 26) |
			((uint32_t)input[57] << 18) |
			((uint32_t)input[58] << 10) |
			((uint32_t)(input[59] & 0xe0) << 2);
	output[18] = (double)(value >> 7);

	// read output[19]: from bit 475 to 499
	value = ((uint32_t)(input[59] & 0x1f) << 27) |
			((uint32_t)input[60] << 19) |
			((uint32_t)input[61] << 11) |
			((uint32_t)(input[62] & 0xf0) << 3);
	output[19] = (double)(value >> 7);
}

static void unpack_20_25bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 25-bit unsigned
	// Skip 0 bits, read 500 bits of data.
	// Input must be at least 63 bytes long

	uint32_t value;

	// read output[0]: from bit 0 to 24
	value = ((uint32_t)input[0] << 24) |
			((uint32_t)input[1] << 16) |
			((uint32_t)input[2] << 8) |
			((uint32_t)(input[3] & 0x80));
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 25 to 49
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)input[4] << 17) |
			((uint32_t)input[5] << 9) |
			((uint32_t)(input[6] & 0xc0) << 1);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 50 to 74
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0xe0) << 2);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 75 to 99
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xf0) << 3);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 100 to 124
	value = ((uint32_t)(input[12] & 0x0f) << 28) |
			((uint32_t)input[13] << 20) |
			((uint32_t)input[14] << 12) |
			((uint32_t)(input[15] & 0xf8) << 4);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 125 to 149
	value = ((uint32_t)(input[15] & 0x07) << 29) |
			((uint32_t)input[16] << 21) |
			((uint32_t)input[17] << 13) |
			((uint32_t)(input[18] & 0xfc) << 5);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 150 to 174
	value = ((uint32_t)(input[18] & 0x03) << 30) |
			((uint32_t)input[19] << 22) |
			((uint32_t)input[20] << 14) |
			((uint32_t)(input[21] & 0xfe) << 6);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 175 to 199
	value = ((uint32_t)(input[21] & 0x01) << 31) |
			((uint32_t)input[22] << 23) |
			((uint32_t)input[23] << 15) |
			((uint32_t)input[24] << 7);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 200 to 224
	value = ((uint32_t)input[25] << 24) |
			((uint32_t)input[26] << 16) |
			((uint32_t)input[27] << 8) |
			((uint32_t)(input[28] & 0x80));
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 225 to 249
	value = ((uint32_t)(input[28] & 0x7f) << 25) |
			((uint32_t)input[29] << 17) |
			((uint32_t)input[30] << 9) |
			((uint32_t)(input[31] & 0xc0) << 1);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 250 to 274
	value = ((uint32_t)(input[31] & 0x3f) << 26) |
			((uint32_t)input[32] << 18) |
			((uint32_t)input[33] << 10) |
			((uint32_t)(input[34] & 0xe0) << 2);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 275 to 299
	value = ((uint32_t)(input[34] & 0x1f) << 27) |
			((uint32_t)input[35] << 19) |
			((uint32_t)input[36] << 11) |
			((uint32_t)(input[37] & 0xf0) << 3);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 300 to 324
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)input[38] << 20) |
			((uint32_t)input[39] << 12) |
			((uint32_t)(input[40] & 0xf8) << 4);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 325 to 349
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)input[41] << 21) |
			((uint32_t)input[42] << 13) |
			((uint32_t)(input[43] & 0xfc) << 5);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 350 to 374
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)input[44] << 22) |
			((uint32_t)input[45] << 14) |
			((uint32_t)(input[46] & 0xfe) << 6);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 375 to 399
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)input[47] << 23) |
			((uint32_t)input[48] << 15) |
			((uint32_t)input[49] << 7);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 400 to 424
	value = ((uint32_t)input[50] << 24) |
			((uint32_t)input[51] << 16) |
			((uint32_t)input[52] << 8) |
			((uint32_t)(input[53] & 0x80));
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 425 to 449
	value = ((uint32_t)(input[53] & 0x7f) << 25) |
			((uint32_t)input[54] << 17) |
			((uint32_t)input[55] << 9) |
			((uint32_t)(input[56] & 0xc0) << 1);
	output[17] = (double)(value >> 7);

	// read output[18]: from bit 450 to 474
	value = ((uint32_t)(input[56] & 0x3f) << 26) |
			((uint32_t)input[57] << 18) |
			((uint32_t)input[58] << 10) |
			((uint32_t)(input[59] & 0xe0) << 2);
	output[18] = (double)(value >> 7);

	// read output[19]: from bit 475 to 499
	value = ((uint32_t)(input[59] & 0x1f) << 27) |
			((uint32_t)input[60] << 19) |
			((uint32_t)input[61] << 11) |
			((uint32_t)(input[62] & 0xf0) << 3);
	output[19] = (double)(value >> 7);
}

static void unpack_20_25bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 25-bit signed
	// Skip 1 bits, read 500 bits of data.
	// Input must be at least 63 bytes long

	int32_t value;

	// read output[0]: from bit 1 to 25
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)input[1] << 17) |
			((uint32_t)input[2] << 9) |
			((uint32_t)(input[3] & 0xc0) << 1);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 26 to 50
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0xe0) << 2);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 51 to 75
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xf0) << 3);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 76 to 100
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xf8) << 4);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 101 to 125
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)input[13] << 21) |
			((uint32_t)input[14] << 13) |
			((uint32_t)(input[15] & 0xfc) << 5);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 126 to 150
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)input[16] << 22) |
			((uint32_t)input[17] << 14) |
			((uint32_t)(input[18] & 0xfe) << 6);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 151 to 175
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)input[19] << 23) |
			((uint32_t)input[20] << 15) |
			((uint32_t)input[21] << 7);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 176 to 200
	value = ((uint32_t)input[22] << 24) |
			((uint32_t)input[23] << 16) |
			((uint32_t)input[24] << 8) |
			((uint32_t)(input[25] & 0x80));
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 201 to 225
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)input[26] << 17) |
			((uint32_t)input[27] << 9) |
			((uint32_t)(input[28] & 0xc0) << 1);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 226 to 250
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)input[29] << 18) |
			((uint32_t)input[30] << 10) |
			((uint32_t)(input[31] & 0xe0) << 2);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 251 to 275
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)input[32] << 19) |
			((uint32_t)input[33] << 11) |
			((uint32_t)(input[34] & 0xf0) << 3);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 276 to 300
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)input[35] << 20) |
			((uint32_t)input[36] << 12) |
			((uint32_t)(input[37] & 0xf8) << 4);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 301 to 325
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)input[38] << 21) |
			((uint32_t)input[39] << 13) |
			((uint32_t)(input[40] & 0xfc) << 5);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 326 to 350
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)input[41] << 22) |
			((uint32_t)input[42] << 14) |
			((uint32_t)(input[43] & 0xfe) << 6);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 351 to 375
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)input[44] << 23) |
			((uint32_t)input[45] << 15) |
			((uint32_t)input[46] << 7);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 376 to 400
	value = ((uint32_t)input[47] << 24) |
			((uint32_t)input[48] << 16) |
			((uint32_t)input[49] << 8) |
			((uint32_t)(input[50] & 0x80));
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 401 to 425
	value = ((uint32_t)(input[50] & 0x7f) << 25) |
			((uint32_t)input[51] << 17) |
			((uint32_t)input[52] << 9) |
			((uint32_t)(input[53] & 0xc0) << 1);
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 426 to 450
	value = ((uint32_t)(input[53] & 0x3f) << 26) |
			((uint32_t)input[54] << 18) |
			((uint32_t)input[55] << 10) |
			((uint32_t)(input[56] & 0xe0) << 2);
	output[17] = (double)(value >> 7);

	// read output[18]: from bit 451 to 475
	value = ((uint32_t)(input[56] & 0x1f) << 27) |
			((uint32_t)input[57] << 19) |
			((uint32_t)input[58] << 11) |
			((uint32_t)(input[59] & 0xf0) << 3);
	output[18] = (double)(value >> 7);

	// read output[19]: from bit 476 to 500
	value = ((uint32_t)(input[59] & 0x0f) << 28) |
			((uint32_t)input[60] << 20) |
			((uint32_t)input[61] << 12) |
			((uint32_t)(input[62] & 0xf8) << 4);
	output[19] = (double)(value >> 7);
}

static void unpack_20_25bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 25-bit unsigned
	// Skip 1 bits, read 500 bits of data.
	// Input must be at least 63 bytes long

	uint32_t value;

	// read output[0]: from bit 1 to 25
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)input[1] << 17) |
			((uint32_t)input[2] << 9) |
			((uint32_t)(input[3] & 0xc0) << 1);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 26 to 50
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0xe0) << 2);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 51 to 75
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xf0) << 3);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 76 to 100
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xf8) << 4);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 101 to 125
	value = ((uint32_t)(input[12] & 0x07) << 29) |
			((uint32_t)input[13] << 21) |
			((uint32_t)input[14] << 13) |
			((uint32_t)(input[15] & 0xfc) << 5);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 126 to 150
	value = ((uint32_t)(input[15] & 0x03) << 30) |
			((uint32_t)input[16] << 22) |
			((uint32_t)input[17] << 14) |
			((uint32_t)(input[18] & 0xfe) << 6);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 151 to 175
	value = ((uint32_t)(input[18] & 0x01) << 31) |
			((uint32_t)input[19] << 23) |
			((uint32_t)input[20] << 15) |
			((uint32_t)input[21] << 7);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 176 to 200
	value = ((uint32_t)input[22] << 24) |
			((uint32_t)input[23] << 16) |
			((uint32_t)input[24] << 8) |
			((uint32_t)(input[25] & 0x80));
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 201 to 225
	value = ((uint32_t)(input[25] & 0x7f) << 25) |
			((uint32_t)input[26] << 17) |
			((uint32_t)input[27] << 9) |
			((uint32_t)(input[28] & 0xc0) << 1);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 226 to 250
	value = ((uint32_t)(input[28] & 0x3f) << 26) |
			((uint32_t)input[29] << 18) |
			((uint32_t)input[30] << 10) |
			((uint32_t)(input[31] & 0xe0) << 2);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 251 to 275
	value = ((uint32_t)(input[31] & 0x1f) << 27) |
			((uint32_t)input[32] << 19) |
			((uint32_t)input[33] << 11) |
			((uint32_t)(input[34] & 0xf0) << 3);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 276 to 300
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)input[35] << 20) |
			((uint32_t)input[36] << 12) |
			((uint32_t)(input[37] & 0xf8) << 4);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 301 to 325
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)input[38] << 21) |
			((uint32_t)input[39] << 13) |
			((uint32_t)(input[40] & 0xfc) << 5);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 326 to 350
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)input[41] << 22) |
			((uint32_t)input[42] << 14) |
			((uint32_t)(input[43] & 0xfe) << 6);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 351 to 375
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)input[44] << 23) |
			((uint32_t)input[45] << 15) |
			((uint32_t)input[46] << 7);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 376 to 400
	value = ((uint32_t)input[47] << 24) |
			((uint32_t)input[48] << 16) |
			((uint32_t)input[49] << 8) |
			((uint32_t)(input[50] & 0x80));
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 401 to 425
	value = ((uint32_t)(input[50] & 0x7f) << 25) |
			((uint32_t)input[51] << 17) |
			((uint32_t)input[52] << 9) |
			((uint32_t)(input[53] & 0xc0) << 1);
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 426 to 450
	value = ((uint32_t)(input[53] & 0x3f) << 26) |
			((uint32_t)input[54] << 18) |
			((uint32_t)input[55] << 10) |
			((uint32_t)(input[56] & 0xe0) << 2);
	output[17] = (double)(value >> 7);

	// read output[18]: from bit 451 to 475
	value = ((uint32_t)(input[56] & 0x1f) << 27) |
			((uint32_t)input[57] << 19) |
			((uint32_t)input[58] << 11) |
			((uint32_t)(input[59] & 0xf0) << 3);
	output[18] = (double)(value >> 7);

	// read output[19]: from bit 476 to 500
	value = ((uint32_t)(input[59] & 0x0f) << 28) |
			((uint32_t)input[60] << 20) |
			((uint32_t)input[61] << 12) |
			((uint32_t)(input[62] & 0xf8) << 4);
	output[19] = (double)(value >> 7);
}

static void unpack_20_25bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 25-bit signed
	// Skip 2 bits, read 500 bits of data.
	// Input must be at least 63 bytes long

	int32_t value;

	// read output[0]: from bit 2 to 26
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)input[1] << 18) |
			((uint32_t)input[2] << 10) |
			((uint32_t)(input[3] & 0xe0) << 2);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 27 to 51
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xf0) << 3);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 52 to 76
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xf8) << 4);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 77 to 101
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)input[10] << 21) |
			((uint32_t)input[11] << 13) |
			((uint32_t)(input[12] & 0xfc) << 5);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 102 to 126
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)input[13] << 22) |
			((uint32_t)input[14] << 14) |
			((uint32_t)(input[15] & 0xfe) << 6);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 127 to 151
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)input[16] << 23) |
			((uint32_t)input[17] << 15) |
			((uint32_t)input[18] << 7);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 152 to 176
	value = ((uint32_t)input[19] << 24) |
			((uint32_t)input[20] << 16) |
			((uint32_t)input[21] << 8) |
			((uint32_t)(input[22] & 0x80));
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 177 to 201
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)input[23] << 17) |
			((uint32_t)input[24] << 9) |
			((uint32_t)(input[25] & 0xc0) << 1);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 202 to 226
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)input[26] << 18) |
			((uint32_t)input[27] << 10) |
			((uint32_t)(input[28] & 0xe0) << 2);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 227 to 251
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)input[29] << 19) |
			((uint32_t)input[30] << 11) |
			((uint32_t)(input[31] & 0xf0) << 3);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 252 to 276
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)input[32] << 20) |
			((uint32_t)input[33] << 12) |
			((uint32_t)(input[34] & 0xf8) << 4);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 277 to 301
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)input[35] << 21) |
			((uint32_t)input[36] << 13) |
			((uint32_t)(input[37] & 0xfc) << 5);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 302 to 326
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)input[38] << 22) |
			((uint32_t)input[39] << 14) |
			((uint32_t)(input[40] & 0xfe) << 6);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 327 to 351
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)input[41] << 23) |
			((uint32_t)input[42] << 15) |
			((uint32_t)input[43] << 7);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 352 to 376
	value = ((uint32_t)input[44] << 24) |
			((uint32_t)input[45] << 16) |
			((uint32_t)input[46] << 8) |
			((uint32_t)(input[47] & 0x80));
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 377 to 401
	value = ((uint32_t)(input[47] & 0x7f) << 25) |
			((uint32_t)input[48] << 17) |
			((uint32_t)input[49] << 9) |
			((uint32_t)(input[50] & 0xc0) << 1);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 402 to 426
	value = ((uint32_t)(input[50] & 0x3f) << 26) |
			((uint32_t)input[51] << 18) |
			((uint32_t)input[52] << 10) |
			((uint32_t)(input[53] & 0xe0) << 2);
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 427 to 451
	value = ((uint32_t)(input[53] & 0x1f) << 27) |
			((uint32_t)input[54] << 19) |
			((uint32_t)input[55] << 11) |
			((uint32_t)(input[56] & 0xf0) << 3);
	output[17] = (double)(value >> 7);

	// read output[18]: from bit 452 to 476
	value = ((uint32_t)(input[56] & 0x0f) << 28) |
			((uint32_t)input[57] << 20) |
			((uint32_t)input[58] << 12) |
			((uint32_t)(input[59] & 0xf8) << 4);
	output[18] = (double)(value >> 7);

	// read output[19]: from bit 477 to 501
	value = ((uint32_t)(input[59] & 0x07) << 29) |
			((uint32_t)input[60] << 21) |
			((uint32_t)input[61] << 13) |
			((uint32_t)(input[62] & 0xfc) << 5);
	output[19] = (double)(value >> 7);
}

static void unpack_20_25bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 25-bit unsigned
	// Skip 2 bits, read 500 bits of data.
	// Input must be at least 63 bytes long

	uint32_t value;

	// read output[0]: from bit 2 to 26
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)input[1] << 18) |
			((uint32_t)input[2] << 10) |
			((uint32_t)(input[3] & 0xe0) << 2);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 27 to 51
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xf0) << 3);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 52 to 76
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xf8) << 4);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 77 to 101
	value = ((uint32_t)(input[9] & 0x07) << 29) |
			((uint32_t)input[10] << 21) |
			((uint32_t)input[11] << 13) |
			((uint32_t)(input[12] & 0xfc) << 5);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 102 to 126
	value = ((uint32_t)(input[12] & 0x03) << 30) |
			((uint32_t)input[13] << 22) |
			((uint32_t)input[14] << 14) |
			((uint32_t)(input[15] & 0xfe) << 6);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 127 to 151
	value = ((uint32_t)(input[15] & 0x01) << 31) |
			((uint32_t)input[16] << 23) |
			((uint32_t)input[17] << 15) |
			((uint32_t)input[18] << 7);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 152 to 176
	value = ((uint32_t)input[19] << 24) |
			((uint32_t)input[20] << 16) |
			((uint32_t)input[21] << 8) |
			((uint32_t)(input[22] & 0x80));
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 177 to 201
	value = ((uint32_t)(input[22] & 0x7f) << 25) |
			((uint32_t)input[23] << 17) |
			((uint32_t)input[24] << 9) |
			((uint32_t)(input[25] & 0xc0) << 1);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 202 to 226
	value = ((uint32_t)(input[25] & 0x3f) << 26) |
			((uint32_t)input[26] << 18) |
			((uint32_t)input[27] << 10) |
			((uint32_t)(input[28] & 0xe0) << 2);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 227 to 251
	value = ((uint32_t)(input[28] & 0x1f) << 27) |
			((uint32_t)input[29] << 19) |
			((uint32_t)input[30] << 11) |
			((uint32_t)(input[31] & 0xf0) << 3);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 252 to 276
	value = ((uint32_t)(input[31] & 0x0f) << 28) |
			((uint32_t)input[32] << 20) |
			((uint32_t)input[33] << 12) |
			((uint32_t)(input[34] & 0xf8) << 4);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 277 to 301
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)input[35] << 21) |
			((uint32_t)input[36] << 13) |
			((uint32_t)(input[37] & 0xfc) << 5);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 302 to 326
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)input[38] << 22) |
			((uint32_t)input[39] << 14) |
			((uint32_t)(input[40] & 0xfe) << 6);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 327 to 351
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)input[41] << 23) |
			((uint32_t)input[42] << 15) |
			((uint32_t)input[43] << 7);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 352 to 376
	value = ((uint32_t)input[44] << 24) |
			((uint32_t)input[45] << 16) |
			((uint32_t)input[46] << 8) |
			((uint32_t)(input[47] & 0x80));
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 377 to 401
	value = ((uint32_t)(input[47] & 0x7f) << 25) |
			((uint32_t)input[48] << 17) |
			((uint32_t)input[49] << 9) |
			((uint32_t)(input[50] & 0xc0) << 1);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 402 to 426
	value = ((uint32_t)(input[50] & 0x3f) << 26) |
			((uint32_t)input[51] << 18) |
			((uint32_t)input[52] << 10) |
			((uint32_t)(input[53] & 0xe0) << 2);
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 427 to 451
	value = ((uint32_t)(input[53] & 0x1f) << 27) |
			((uint32_t)input[54] << 19) |
			((uint32_t)input[55] << 11) |
			((uint32_t)(input[56] & 0xf0) << 3);
	output[17] = (double)(value >> 7);

	// read output[18]: from bit 452 to 476
	value = ((uint32_t)(input[56] & 0x0f) << 28) |
			((uint32_t)input[57] << 20) |
			((uint32_t)input[58] << 12) |
			((uint32_t)(input[59] & 0xf8) << 4);
	output[18] = (double)(value >> 7);

	// read output[19]: from bit 477 to 501
	value = ((uint32_t)(input[59] & 0x07) << 29) |
			((uint32_t)input[60] << 21) |
			((uint32_t)input[61] << 13) |
			((uint32_t)(input[62] & 0xfc) << 5);
	output[19] = (double)(value >> 7);
}

static void unpack_20_25bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 25-bit signed
	// Skip 3 bits, read 500 bits of data.
	// Input must be at least 63 bytes long

	int32_t value;

	// read output[0]: from bit 3 to 27
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)input[1] << 19) |
			((uint32_t)input[2] << 11) |
			((uint32_t)(input[3] & 0xf0) << 3);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 28 to 52
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xf8) << 4);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 53 to 77
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xfc) << 5);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 78 to 102
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)input[10] << 22) |
			((uint32_t)input[11] << 14) |
			((uint32_t)(input[12] & 0xfe) << 6);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 103 to 127
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)input[13] << 23) |
			((uint32_t)input[14] << 15) |
			((uint32_t)input[15] << 7);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 128 to 152
	value = ((uint32_t)input[16] << 24) |
			((uint32_t)input[17] << 16) |
			((uint32_t)input[18] << 8) |
			((uint32_t)(input[19] & 0x80));
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 153 to 177
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)input[20] << 17) |
			((uint32_t)input[21] << 9) |
			((uint32_t)(input[22] & 0xc0) << 1);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 178 to 202
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)input[23] << 18) |
			((uint32_t)input[24] << 10) |
			((uint32_t)(input[25] & 0xe0) << 2);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 203 to 227
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)input[26] << 19) |
			((uint32_t)input[27] << 11) |
			((uint32_t)(input[28] & 0xf0) << 3);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 228 to 252
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)input[29] << 20) |
			((uint32_t)input[30] << 12) |
			((uint32_t)(input[31] & 0xf8) << 4);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 253 to 277
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)input[32] << 21) |
			((uint32_t)input[33] << 13) |
			((uint32_t)(input[34] & 0xfc) << 5);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 278 to 302
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)input[35] << 22) |
			((uint32_t)input[36] << 14) |
			((uint32_t)(input[37] & 0xfe) << 6);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 303 to 327
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)input[38] << 23) |
			((uint32_t)input[39] << 15) |
			((uint32_t)input[40] << 7);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 328 to 352
	value = ((uint32_t)input[41] << 24) |
			((uint32_t)input[42] << 16) |
			((uint32_t)input[43] << 8) |
			((uint32_t)(input[44] & 0x80));
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 353 to 377
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)input[45] << 17) |
			((uint32_t)input[46] << 9) |
			((uint32_t)(input[47] & 0xc0) << 1);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 378 to 402
	value = ((uint32_t)(input[47] & 0x3f) << 26) |
			((uint32_t)input[48] << 18) |
			((uint32_t)input[49] << 10) |
			((uint32_t)(input[50] & 0xe0) << 2);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 403 to 427
	value = ((uint32_t)(input[50] & 0x1f) << 27) |
			((uint32_t)input[51] << 19) |
			((uint32_t)input[52] << 11) |
			((uint32_t)(input[53] & 0xf0) << 3);
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 428 to 452
	value = ((uint32_t)(input[53] & 0x0f) << 28) |
			((uint32_t)input[54] << 20) |
			((uint32_t)input[55] << 12) |
			((uint32_t)(input[56] & 0xf8) << 4);
	output[17] = (double)(value >> 7);

	// read output[18]: from bit 453 to 477
	value = ((uint32_t)(input[56] & 0x07) << 29) |
			((uint32_t)input[57] << 21) |
			((uint32_t)input[58] << 13) |
			((uint32_t)(input[59] & 0xfc) << 5);
	output[18] = (double)(value >> 7);

	// read output[19]: from bit 478 to 502
	value = ((uint32_t)(input[59] & 0x03) << 30) |
			((uint32_t)input[60] << 22) |
			((uint32_t)input[61] << 14) |
			((uint32_t)(input[62] & 0xfe) << 6);
	output[19] = (double)(value >> 7);
}

static void unpack_20_25bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 25-bit unsigned
	// Skip 3 bits, read 500 bits of data.
	// Input must be at least 63 bytes long

	uint32_t value;

	// read output[0]: from bit 3 to 27
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)input[1] << 19) |
			((uint32_t)input[2] << 11) |
			((uint32_t)(input[3] & 0xf0) << 3);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 28 to 52
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xf8) << 4);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 53 to 77
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xfc) << 5);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 78 to 102
	value = ((uint32_t)(input[9] & 0x03) << 30) |
			((uint32_t)input[10] << 22) |
			((uint32_t)input[11] << 14) |
			((uint32_t)(input[12] & 0xfe) << 6);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 103 to 127
	value = ((uint32_t)(input[12] & 0x01) << 31) |
			((uint32_t)input[13] << 23) |
			((uint32_t)input[14] << 15) |
			((uint32_t)input[15] << 7);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 128 to 152
	value = ((uint32_t)input[16] << 24) |
			((uint32_t)input[17] << 16) |
			((uint32_t)input[18] << 8) |
			((uint32_t)(input[19] & 0x80));
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 153 to 177
	value = ((uint32_t)(input[19] & 0x7f) << 25) |
			((uint32_t)input[20] << 17) |
			((uint32_t)input[21] << 9) |
			((uint32_t)(input[22] & 0xc0) << 1);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 178 to 202
	value = ((uint32_t)(input[22] & 0x3f) << 26) |
			((uint32_t)input[23] << 18) |
			((uint32_t)input[24] << 10) |
			((uint32_t)(input[25] & 0xe0) << 2);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 203 to 227
	value = ((uint32_t)(input[25] & 0x1f) << 27) |
			((uint32_t)input[26] << 19) |
			((uint32_t)input[27] << 11) |
			((uint32_t)(input[28] & 0xf0) << 3);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 228 to 252
	value = ((uint32_t)(input[28] & 0x0f) << 28) |
			((uint32_t)input[29] << 20) |
			((uint32_t)input[30] << 12) |
			((uint32_t)(input[31] & 0xf8) << 4);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 253 to 277
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)input[32] << 21) |
			((uint32_t)input[33] << 13) |
			((uint32_t)(input[34] & 0xfc) << 5);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 278 to 302
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)input[35] << 22) |
			((uint32_t)input[36] << 14) |
			((uint32_t)(input[37] & 0xfe) << 6);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 303 to 327
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)input[38] << 23) |
			((uint32_t)input[39] << 15) |
			((uint32_t)input[40] << 7);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 328 to 352
	value = ((uint32_t)input[41] << 24) |
			((uint32_t)input[42] << 16) |
			((uint32_t)input[43] << 8) |
			((uint32_t)(input[44] & 0x80));
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 353 to 377
	value = ((uint32_t)(input[44] & 0x7f) << 25) |
			((uint32_t)input[45] << 17) |
			((uint32_t)input[46] << 9) |
			((uint32_t)(input[47] & 0xc0) << 1);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 378 to 402
	value = ((uint32_t)(input[47] & 0x3f) << 26) |
			((uint32_t)input[48] << 18) |
			((uint32_t)input[49] << 10) |
			((uint32_t)(input[50] & 0xe0) << 2);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 403 to 427
	value = ((uint32_t)(input[50] & 0x1f) << 27) |
			((uint32_t)input[51] << 19) |
			((uint32_t)input[52] << 11) |
			((uint32_t)(input[53] & 0xf0) << 3);
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 428 to 452
	value = ((uint32_t)(input[53] & 0x0f) << 28) |
			((uint32_t)input[54] << 20) |
			((uint32_t)input[55] << 12) |
			((uint32_t)(input[56] & 0xf8) << 4);
	output[17] = (double)(value >> 7);

	// read output[18]: from bit 453 to 477
	value = ((uint32_t)(input[56] & 0x07) << 29) |
			((uint32_t)input[57] << 21) |
			((uint32_t)input[58] << 13) |
			((uint32_t)(input[59] & 0xfc) << 5);
	output[18] = (double)(value >> 7);

	// read output[19]: from bit 478 to 502
	value = ((uint32_t)(input[59] & 0x03) << 30) |
			((uint32_t)input[60] << 22) |
			((uint32_t)input[61] << 14) |
			((uint32_t)(input[62] & 0xfe) << 6);
	output[19] = (double)(value >> 7);
}

static void unpack_20_25bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 25-bit signed
	// Skip 4 bits, read 500 bits of data.
	// Input must be at least 63 bytes long

	int32_t value;

	// read output[0]: from bit 4 to 28
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)input[1] << 20) |
			((uint32_t)input[2] << 12) |
			((uint32_t)(input[3] & 0xf8) << 4);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 29 to 53
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xfc) << 5);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 54 to 78
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)input[7] << 22) |
			((uint32_t)input[8] << 14) |
			((uint32_t)(input[9] & 0xfe) << 6);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 79 to 103
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)input[10] << 23) |
			((uint32_t)input[11] << 15) |
			((uint32_t)input[12] << 7);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 104 to 128
	value = ((uint32_t)input[13] << 24) |
			((uint32_t)input[14] << 16) |
			((uint32_t)input[15] << 8) |
			((uint32_t)(input[16] & 0x80));
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 129 to 153
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)input[17] << 17) |
			((uint32_t)input[18] << 9) |
			((uint32_t)(input[19] & 0xc0) << 1);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 154 to 178
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)input[20] << 18) |
			((uint32_t)input[21] << 10) |
			((uint32_t)(input[22] & 0xe0) << 2);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 179 to 203
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)input[23] << 19) |
			((uint32_t)input[24] << 11) |
			((uint32_t)(input[25] & 0xf0) << 3);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 204 to 228
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)input[26] << 20) |
			((uint32_t)input[27] << 12) |
			((uint32_t)(input[28] & 0xf8) << 4);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 229 to 253
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)input[29] << 21) |
			((uint32_t)input[30] << 13) |
			((uint32_t)(input[31] & 0xfc) << 5);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 254 to 278
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)input[32] << 22) |
			((uint32_t)input[33] << 14) |
			((uint32_t)(input[34] & 0xfe) << 6);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 279 to 303
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)input[35] << 23) |
			((uint32_t)input[36] << 15) |
			((uint32_t)input[37] << 7);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 304 to 328
	value = ((uint32_t)input[38] << 24) |
			((uint32_t)input[39] << 16) |
			((uint32_t)input[40] << 8) |
			((uint32_t)(input[41] & 0x80));
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 329 to 353
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)input[42] << 17) |
			((uint32_t)input[43] << 9) |
			((uint32_t)(input[44] & 0xc0) << 1);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 354 to 378
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)input[45] << 18) |
			((uint32_t)input[46] << 10) |
			((uint32_t)(input[47] & 0xe0) << 2);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 379 to 403
	value = ((uint32_t)(input[47] & 0x1f) << 27) |
			((uint32_t)input[48] << 19) |
			((uint32_t)input[49] << 11) |
			((uint32_t)(input[50] & 0xf0) << 3);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 404 to 428
	value = ((uint32_t)(input[50] & 0x0f) << 28) |
			((uint32_t)input[51] << 20) |
			((uint32_t)input[52] << 12) |
			((uint32_t)(input[53] & 0xf8) << 4);
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 429 to 453
	value = ((uint32_t)(input[53] & 0x07) << 29) |
			((uint32_t)input[54] << 21) |
			((uint32_t)input[55] << 13) |
			((uint32_t)(input[56] & 0xfc) << 5);
	output[17] = (double)(value >> 7);

	// read output[18]: from bit 454 to 478
	value = ((uint32_t)(input[56] & 0x03) << 30) |
			((uint32_t)input[57] << 22) |
			((uint32_t)input[58] << 14) |
			((uint32_t)(input[59] & 0xfe) << 6);
	output[18] = (double)(value >> 7);

	// read output[19]: from bit 479 to 503
	value = ((uint32_t)(input[59] & 0x01) << 31) |
			((uint32_t)input[60] << 23) |
			((uint32_t)input[61] << 15) |
			((uint32_t)input[62] << 7);
	output[19] = (double)(value >> 7);
}

static void unpack_20_25bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 25-bit unsigned
	// Skip 4 bits, read 500 bits of data.
	// Input must be at least 63 bytes long

	uint32_t value;

	// read output[0]: from bit 4 to 28
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)input[1] << 20) |
			((uint32_t)input[2] << 12) |
			((uint32_t)(input[3] & 0xf8) << 4);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 29 to 53
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xfc) << 5);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 54 to 78
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)input[7] << 22) |
			((uint32_t)input[8] << 14) |
			((uint32_t)(input[9] & 0xfe) << 6);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 79 to 103
	value = ((uint32_t)(input[9] & 0x01) << 31) |
			((uint32_t)input[10] << 23) |
			((uint32_t)input[11] << 15) |
			((uint32_t)input[12] << 7);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 104 to 128
	value = ((uint32_t)input[13] << 24) |
			((uint32_t)input[14] << 16) |
			((uint32_t)input[15] << 8) |
			((uint32_t)(input[16] & 0x80));
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 129 to 153
	value = ((uint32_t)(input[16] & 0x7f) << 25) |
			((uint32_t)input[17] << 17) |
			((uint32_t)input[18] << 9) |
			((uint32_t)(input[19] & 0xc0) << 1);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 154 to 178
	value = ((uint32_t)(input[19] & 0x3f) << 26) |
			((uint32_t)input[20] << 18) |
			((uint32_t)input[21] << 10) |
			((uint32_t)(input[22] & 0xe0) << 2);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 179 to 203
	value = ((uint32_t)(input[22] & 0x1f) << 27) |
			((uint32_t)input[23] << 19) |
			((uint32_t)input[24] << 11) |
			((uint32_t)(input[25] & 0xf0) << 3);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 204 to 228
	value = ((uint32_t)(input[25] & 0x0f) << 28) |
			((uint32_t)input[26] << 20) |
			((uint32_t)input[27] << 12) |
			((uint32_t)(input[28] & 0xf8) << 4);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 229 to 253
	value = ((uint32_t)(input[28] & 0x07) << 29) |
			((uint32_t)input[29] << 21) |
			((uint32_t)input[30] << 13) |
			((uint32_t)(input[31] & 0xfc) << 5);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 254 to 278
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)input[32] << 22) |
			((uint32_t)input[33] << 14) |
			((uint32_t)(input[34] & 0xfe) << 6);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 279 to 303
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)input[35] << 23) |
			((uint32_t)input[36] << 15) |
			((uint32_t)input[37] << 7);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 304 to 328
	value = ((uint32_t)input[38] << 24) |
			((uint32_t)input[39] << 16) |
			((uint32_t)input[40] << 8) |
			((uint32_t)(input[41] & 0x80));
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 329 to 353
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)input[42] << 17) |
			((uint32_t)input[43] << 9) |
			((uint32_t)(input[44] & 0xc0) << 1);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 354 to 378
	value = ((uint32_t)(input[44] & 0x3f) << 26) |
			((uint32_t)input[45] << 18) |
			((uint32_t)input[46] << 10) |
			((uint32_t)(input[47] & 0xe0) << 2);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 379 to 403
	value = ((uint32_t)(input[47] & 0x1f) << 27) |
			((uint32_t)input[48] << 19) |
			((uint32_t)input[49] << 11) |
			((uint32_t)(input[50] & 0xf0) << 3);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 404 to 428
	value = ((uint32_t)(input[50] & 0x0f) << 28) |
			((uint32_t)input[51] << 20) |
			((uint32_t)input[52] << 12) |
			((uint32_t)(input[53] & 0xf8) << 4);
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 429 to 453
	value = ((uint32_t)(input[53] & 0x07) << 29) |
			((uint32_t)input[54] << 21) |
			((uint32_t)input[55] << 13) |
			((uint32_t)(input[56] & 0xfc) << 5);
	output[17] = (double)(value >> 7);

	// read output[18]: from bit 454 to 478
	value = ((uint32_t)(input[56] & 0x03) << 30) |
			((uint32_t)input[57] << 22) |
			((uint32_t)input[58] << 14) |
			((uint32_t)(input[59] & 0xfe) << 6);
	output[18] = (double)(value >> 7);

	// read output[19]: from bit 479 to 503
	value = ((uint32_t)(input[59] & 0x01) << 31) |
			((uint32_t)input[60] << 23) |
			((uint32_t)input[61] << 15) |
			((uint32_t)input[62] << 7);
	output[19] = (double)(value >> 7);
}

static void unpack_20_25bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 25-bit signed
	// Skip 5 bits, read 500 bits of data.
	// Input must be at least 64 bytes long

	int32_t value;

	// read output[0]: from bit 5 to 29
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)input[1] << 21) |
			((uint32_t)input[2] << 13) |
			((uint32_t)(input[3] & 0xfc) << 5);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 30 to 54
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xfe) << 6);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 55 to 79
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)input[7] << 23) |
			((uint32_t)input[8] << 15) |
			((uint32_t)input[9] << 7);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 80 to 104
	value = ((uint32_t)input[10] << 24) |
			((uint32_t)input[11] << 16) |
			((uint32_t)input[12] << 8) |
			((uint32_t)(input[13] & 0x80));
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 105 to 129
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)input[14] << 17) |
			((uint32_t)input[15] << 9) |
			((uint32_t)(input[16] & 0xc0) << 1);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 130 to 154
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)input[17] << 18) |
			((uint32_t)input[18] << 10) |
			((uint32_t)(input[19] & 0xe0) << 2);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 155 to 179
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)input[20] << 19) |
			((uint32_t)input[21] << 11) |
			((uint32_t)(input[22] & 0xf0) << 3);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 180 to 204
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)input[23] << 20) |
			((uint32_t)input[24] << 12) |
			((uint32_t)(input[25] & 0xf8) << 4);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 205 to 229
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)input[26] << 21) |
			((uint32_t)input[27] << 13) |
			((uint32_t)(input[28] & 0xfc) << 5);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 230 to 254
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)input[29] << 22) |
			((uint32_t)input[30] << 14) |
			((uint32_t)(input[31] & 0xfe) << 6);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 255 to 279
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)input[32] << 23) |
			((uint32_t)input[33] << 15) |
			((uint32_t)input[34] << 7);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 280 to 304
	value = ((uint32_t)input[35] << 24) |
			((uint32_t)input[36] << 16) |
			((uint32_t)input[37] << 8) |
			((uint32_t)(input[38] & 0x80));
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 305 to 329
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)input[39] << 17) |
			((uint32_t)input[40] << 9) |
			((uint32_t)(input[41] & 0xc0) << 1);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 330 to 354
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)input[42] << 18) |
			((uint32_t)input[43] << 10) |
			((uint32_t)(input[44] & 0xe0) << 2);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 355 to 379
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)input[45] << 19) |
			((uint32_t)input[46] << 11) |
			((uint32_t)(input[47] & 0xf0) << 3);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 380 to 404
	value = ((uint32_t)(input[47] & 0x0f) << 28) |
			((uint32_t)input[48] << 20) |
			((uint32_t)input[49] << 12) |
			((uint32_t)(input[50] & 0xf8) << 4);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 405 to 429
	value = ((uint32_t)(input[50] & 0x07) << 29) |
			((uint32_t)input[51] << 21) |
			((uint32_t)input[52] << 13) |
			((uint32_t)(input[53] & 0xfc) << 5);
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 430 to 454
	value = ((uint32_t)(input[53] & 0x03) << 30) |
			((uint32_t)input[54] << 22) |
			((uint32_t)input[55] << 14) |
			((uint32_t)(input[56] & 0xfe) << 6);
	output[17] = (double)(value >> 7);

	// read output[18]: from bit 455 to 479
	value = ((uint32_t)(input[56] & 0x01) << 31) |
			((uint32_t)input[57] << 23) |
			((uint32_t)input[58] << 15) |
			((uint32_t)input[59] << 7);
	output[18] = (double)(value >> 7);

	// read output[19]: from bit 480 to 504
	value = ((uint32_t)input[60] << 24) |
			((uint32_t)input[61] << 16) |
			((uint32_t)input[62] << 8) |
			((uint32_t)(input[63] & 0x80));
	output[19] = (double)(value >> 7);
}

static void unpack_20_25bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 25-bit unsigned
	// Skip 5 bits, read 500 bits of data.
	// Input must be at least 64 bytes long

	uint32_t value;

	// read output[0]: from bit 5 to 29
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)input[1] << 21) |
			((uint32_t)input[2] << 13) |
			((uint32_t)(input[3] & 0xfc) << 5);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 30 to 54
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xfe) << 6);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 55 to 79
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)input[7] << 23) |
			((uint32_t)input[8] << 15) |
			((uint32_t)input[9] << 7);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 80 to 104
	value = ((uint32_t)input[10] << 24) |
			((uint32_t)input[11] << 16) |
			((uint32_t)input[12] << 8) |
			((uint32_t)(input[13] & 0x80));
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 105 to 129
	value = ((uint32_t)(input[13] & 0x7f) << 25) |
			((uint32_t)input[14] << 17) |
			((uint32_t)input[15] << 9) |
			((uint32_t)(input[16] & 0xc0) << 1);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 130 to 154
	value = ((uint32_t)(input[16] & 0x3f) << 26) |
			((uint32_t)input[17] << 18) |
			((uint32_t)input[18] << 10) |
			((uint32_t)(input[19] & 0xe0) << 2);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 155 to 179
	value = ((uint32_t)(input[19] & 0x1f) << 27) |
			((uint32_t)input[20] << 19) |
			((uint32_t)input[21] << 11) |
			((uint32_t)(input[22] & 0xf0) << 3);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 180 to 204
	value = ((uint32_t)(input[22] & 0x0f) << 28) |
			((uint32_t)input[23] << 20) |
			((uint32_t)input[24] << 12) |
			((uint32_t)(input[25] & 0xf8) << 4);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 205 to 229
	value = ((uint32_t)(input[25] & 0x07) << 29) |
			((uint32_t)input[26] << 21) |
			((uint32_t)input[27] << 13) |
			((uint32_t)(input[28] & 0xfc) << 5);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 230 to 254
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)input[29] << 22) |
			((uint32_t)input[30] << 14) |
			((uint32_t)(input[31] & 0xfe) << 6);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 255 to 279
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)input[32] << 23) |
			((uint32_t)input[33] << 15) |
			((uint32_t)input[34] << 7);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 280 to 304
	value = ((uint32_t)input[35] << 24) |
			((uint32_t)input[36] << 16) |
			((uint32_t)input[37] << 8) |
			((uint32_t)(input[38] & 0x80));
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 305 to 329
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)input[39] << 17) |
			((uint32_t)input[40] << 9) |
			((uint32_t)(input[41] & 0xc0) << 1);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 330 to 354
	value = ((uint32_t)(input[41] & 0x3f) << 26) |
			((uint32_t)input[42] << 18) |
			((uint32_t)input[43] << 10) |
			((uint32_t)(input[44] & 0xe0) << 2);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 355 to 379
	value = ((uint32_t)(input[44] & 0x1f) << 27) |
			((uint32_t)input[45] << 19) |
			((uint32_t)input[46] << 11) |
			((uint32_t)(input[47] & 0xf0) << 3);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 380 to 404
	value = ((uint32_t)(input[47] & 0x0f) << 28) |
			((uint32_t)input[48] << 20) |
			((uint32_t)input[49] << 12) |
			((uint32_t)(input[50] & 0xf8) << 4);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 405 to 429
	value = ((uint32_t)(input[50] & 0x07) << 29) |
			((uint32_t)input[51] << 21) |
			((uint32_t)input[52] << 13) |
			((uint32_t)(input[53] & 0xfc) << 5);
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 430 to 454
	value = ((uint32_t)(input[53] & 0x03) << 30) |
			((uint32_t)input[54] << 22) |
			((uint32_t)input[55] << 14) |
			((uint32_t)(input[56] & 0xfe) << 6);
	output[17] = (double)(value >> 7);

	// read output[18]: from bit 455 to 479
	value = ((uint32_t)(input[56] & 0x01) << 31) |
			((uint32_t)input[57] << 23) |
			((uint32_t)input[58] << 15) |
			((uint32_t)input[59] << 7);
	output[18] = (double)(value >> 7);

	// read output[19]: from bit 480 to 504
	value = ((uint32_t)input[60] << 24) |
			((uint32_t)input[61] << 16) |
			((uint32_t)input[62] << 8) |
			((uint32_t)(input[63] & 0x80));
	output[19] = (double)(value >> 7);
}

static void unpack_20_25bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 25-bit signed
	// Skip 6 bits, read 500 bits of data.
	// Input must be at least 64 bytes long

	int32_t value;

	// read output[0]: from bit 6 to 30
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)input[1] << 22) |
			((uint32_t)input[2] << 14) |
			((uint32_t)(input[3] & 0xfe) << 6);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 31 to 55
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)input[4] << 23) |
			((uint32_t)input[5] << 15) |
			((uint32_t)input[6] << 7);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 56 to 80
	value = ((uint32_t)input[7] << 24) |
			((uint32_t)input[8] << 16) |
			((uint32_t)input[9] << 8) |
			((uint32_t)(input[10] & 0x80));
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 81 to 105
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)input[11] << 17) |
			((uint32_t)input[12] << 9) |
			((uint32_t)(input[13] & 0xc0) << 1);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 106 to 130
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)input[14] << 18) |
			((uint32_t)input[15] << 10) |
			((uint32_t)(input[16] & 0xe0) << 2);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 131 to 155
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)input[17] << 19) |
			((uint32_t)input[18] << 11) |
			((uint32_t)(input[19] & 0xf0) << 3);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 156 to 180
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)input[20] << 20) |
			((uint32_t)input[21] << 12) |
			((uint32_t)(input[22] & 0xf8) << 4);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 181 to 205
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)input[23] << 21) |
			((uint32_t)input[24] << 13) |
			((uint32_t)(input[25] & 0xfc) << 5);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 206 to 230
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)input[26] << 22) |
			((uint32_t)input[27] << 14) |
			((uint32_t)(input[28] & 0xfe) << 6);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 231 to 255
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)input[29] << 23) |
			((uint32_t)input[30] << 15) |
			((uint32_t)input[31] << 7);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 256 to 280
	value = ((uint32_t)input[32] << 24) |
			((uint32_t)input[33] << 16) |
			((uint32_t)input[34] << 8) |
			((uint32_t)(input[35] & 0x80));
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 281 to 305
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)input[36] << 17) |
			((uint32_t)input[37] << 9) |
			((uint32_t)(input[38] & 0xc0) << 1);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 306 to 330
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)input[39] << 18) |
			((uint32_t)input[40] << 10) |
			((uint32_t)(input[41] & 0xe0) << 2);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 331 to 355
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)input[42] << 19) |
			((uint32_t)input[43] << 11) |
			((uint32_t)(input[44] & 0xf0) << 3);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 356 to 380
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)input[45] << 20) |
			((uint32_t)input[46] << 12) |
			((uint32_t)(input[47] & 0xf8) << 4);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 381 to 405
	value = ((uint32_t)(input[47] & 0x07) << 29) |
			((uint32_t)input[48] << 21) |
			((uint32_t)input[49] << 13) |
			((uint32_t)(input[50] & 0xfc) << 5);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 406 to 430
	value = ((uint32_t)(input[50] & 0x03) << 30) |
			((uint32_t)input[51] << 22) |
			((uint32_t)input[52] << 14) |
			((uint32_t)(input[53] & 0xfe) << 6);
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 431 to 455
	value = ((uint32_t)(input[53] & 0x01) << 31) |
			((uint32_t)input[54] << 23) |
			((uint32_t)input[55] << 15) |
			((uint32_t)input[56] << 7);
	output[17] = (double)(value >> 7);

	// read output[18]: from bit 456 to 480
	value = ((uint32_t)input[57] << 24) |
			((uint32_t)input[58] << 16) |
			((uint32_t)input[59] << 8) |
			((uint32_t)(input[60] & 0x80));
	output[18] = (double)(value >> 7);

	// read output[19]: from bit 481 to 505
	value = ((uint32_t)(input[60] & 0x7f) << 25) |
			((uint32_t)input[61] << 17) |
			((uint32_t)input[62] << 9) |
			((uint32_t)(input[63] & 0xc0) << 1);
	output[19] = (double)(value >> 7);
}

static void unpack_20_25bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 25-bit unsigned
	// Skip 6 bits, read 500 bits of data.
	// Input must be at least 64 bytes long

	uint32_t value;

	// read output[0]: from bit 6 to 30
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)input[1] << 22) |
			((uint32_t)input[2] << 14) |
			((uint32_t)(input[3] & 0xfe) << 6);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 31 to 55
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)input[4] << 23) |
			((uint32_t)input[5] << 15) |
			((uint32_t)input[6] << 7);
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 56 to 80
	value = ((uint32_t)input[7] << 24) |
			((uint32_t)input[8] << 16) |
			((uint32_t)input[9] << 8) |
			((uint32_t)(input[10] & 0x80));
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 81 to 105
	value = ((uint32_t)(input[10] & 0x7f) << 25) |
			((uint32_t)input[11] << 17) |
			((uint32_t)input[12] << 9) |
			((uint32_t)(input[13] & 0xc0) << 1);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 106 to 130
	value = ((uint32_t)(input[13] & 0x3f) << 26) |
			((uint32_t)input[14] << 18) |
			((uint32_t)input[15] << 10) |
			((uint32_t)(input[16] & 0xe0) << 2);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 131 to 155
	value = ((uint32_t)(input[16] & 0x1f) << 27) |
			((uint32_t)input[17] << 19) |
			((uint32_t)input[18] << 11) |
			((uint32_t)(input[19] & 0xf0) << 3);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 156 to 180
	value = ((uint32_t)(input[19] & 0x0f) << 28) |
			((uint32_t)input[20] << 20) |
			((uint32_t)input[21] << 12) |
			((uint32_t)(input[22] & 0xf8) << 4);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 181 to 205
	value = ((uint32_t)(input[22] & 0x07) << 29) |
			((uint32_t)input[23] << 21) |
			((uint32_t)input[24] << 13) |
			((uint32_t)(input[25] & 0xfc) << 5);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 206 to 230
	value = ((uint32_t)(input[25] & 0x03) << 30) |
			((uint32_t)input[26] << 22) |
			((uint32_t)input[27] << 14) |
			((uint32_t)(input[28] & 0xfe) << 6);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 231 to 255
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)input[29] << 23) |
			((uint32_t)input[30] << 15) |
			((uint32_t)input[31] << 7);
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 256 to 280
	value = ((uint32_t)input[32] << 24) |
			((uint32_t)input[33] << 16) |
			((uint32_t)input[34] << 8) |
			((uint32_t)(input[35] & 0x80));
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 281 to 305
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)input[36] << 17) |
			((uint32_t)input[37] << 9) |
			((uint32_t)(input[38] & 0xc0) << 1);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 306 to 330
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)input[39] << 18) |
			((uint32_t)input[40] << 10) |
			((uint32_t)(input[41] & 0xe0) << 2);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 331 to 355
	value = ((uint32_t)(input[41] & 0x1f) << 27) |
			((uint32_t)input[42] << 19) |
			((uint32_t)input[43] << 11) |
			((uint32_t)(input[44] & 0xf0) << 3);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 356 to 380
	value = ((uint32_t)(input[44] & 0x0f) << 28) |
			((uint32_t)input[45] << 20) |
			((uint32_t)input[46] << 12) |
			((uint32_t)(input[47] & 0xf8) << 4);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 381 to 405
	value = ((uint32_t)(input[47] & 0x07) << 29) |
			((uint32_t)input[48] << 21) |
			((uint32_t)input[49] << 13) |
			((uint32_t)(input[50] & 0xfc) << 5);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 406 to 430
	value = ((uint32_t)(input[50] & 0x03) << 30) |
			((uint32_t)input[51] << 22) |
			((uint32_t)input[52] << 14) |
			((uint32_t)(input[53] & 0xfe) << 6);
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 431 to 455
	value = ((uint32_t)(input[53] & 0x01) << 31) |
			((uint32_t)input[54] << 23) |
			((uint32_t)input[55] << 15) |
			((uint32_t)input[56] << 7);
	output[17] = (double)(value >> 7);

	// read output[18]: from bit 456 to 480
	value = ((uint32_t)input[57] << 24) |
			((uint32_t)input[58] << 16) |
			((uint32_t)input[59] << 8) |
			((uint32_t)(input[60] & 0x80));
	output[18] = (double)(value >> 7);

	// read output[19]: from bit 481 to 505
	value = ((uint32_t)(input[60] & 0x7f) << 25) |
			((uint32_t)input[61] << 17) |
			((uint32_t)input[62] << 9) |
			((uint32_t)(input[63] & 0xc0) << 1);
	output[19] = (double)(value >> 7);
}

static void unpack_20_25bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 25-bit signed
	// Skip 7 bits, read 500 bits of data.
	// Input must be at least 64 bytes long

	int32_t value;

	// read output[0]: from bit 7 to 31
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)input[1] << 23) |
			((uint32_t)input[2] << 15) |
			((uint32_t)input[3] << 7);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 32 to 56
	value = ((uint32_t)input[4] << 24) |
			((uint32_t)input[5] << 16) |
			((uint32_t)input[6] << 8) |
			((uint32_t)(input[7] & 0x80));
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 57 to 81
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)input[8] << 17) |
			((uint32_t)input[9] << 9) |
			((uint32_t)(input[10] & 0xc0) << 1);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 82 to 106
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)input[11] << 18) |
			((uint32_t)input[12] << 10) |
			((uint32_t)(input[13] & 0xe0) << 2);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 107 to 131
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)input[14] << 19) |
			((uint32_t)input[15] << 11) |
			((uint32_t)(input[16] & 0xf0) << 3);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 132 to 156
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)input[17] << 20) |
			((uint32_t)input[18] << 12) |
			((uint32_t)(input[19] & 0xf8) << 4);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 157 to 181
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)input[20] << 21) |
			((uint32_t)input[21] << 13) |
			((uint32_t)(input[22] & 0xfc) << 5);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 182 to 206
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)input[23] << 22) |
			((uint32_t)input[24] << 14) |
			((uint32_t)(input[25] & 0xfe) << 6);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 207 to 231
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)input[28] << 7);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 232 to 256
	value = ((uint32_t)input[29] << 24) |
			((uint32_t)input[30] << 16) |
			((uint32_t)input[31] << 8) |
			((uint32_t)(input[32] & 0x80));
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 257 to 281
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)input[33] << 17) |
			((uint32_t)input[34] << 9) |
			((uint32_t)(input[35] & 0xc0) << 1);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 282 to 306
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)input[36] << 18) |
			((uint32_t)input[37] << 10) |
			((uint32_t)(input[38] & 0xe0) << 2);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 307 to 331
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)input[39] << 19) |
			((uint32_t)input[40] << 11) |
			((uint32_t)(input[41] & 0xf0) << 3);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 332 to 356
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)input[42] << 20) |
			((uint32_t)input[43] << 12) |
			((uint32_t)(input[44] & 0xf8) << 4);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 357 to 381
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)input[45] << 21) |
			((uint32_t)input[46] << 13) |
			((uint32_t)(input[47] & 0xfc) << 5);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 382 to 406
	value = ((uint32_t)(input[47] & 0x03) << 30) |
			((uint32_t)input[48] << 22) |
			((uint32_t)input[49] << 14) |
			((uint32_t)(input[50] & 0xfe) << 6);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 407 to 431
	value = ((uint32_t)(input[50] & 0x01) << 31) |
			((uint32_t)input[51] << 23) |
			((uint32_t)input[52] << 15) |
			((uint32_t)input[53] << 7);
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 432 to 456
	value = ((uint32_t)input[54] << 24) |
			((uint32_t)input[55] << 16) |
			((uint32_t)input[56] << 8) |
			((uint32_t)(input[57] & 0x80));
	output[17] = (double)(value >> 7);

	// read output[18]: from bit 457 to 481
	value = ((uint32_t)(input[57] & 0x7f) << 25) |
			((uint32_t)input[58] << 17) |
			((uint32_t)input[59] << 9) |
			((uint32_t)(input[60] & 0xc0) << 1);
	output[18] = (double)(value >> 7);

	// read output[19]: from bit 482 to 506
	value = ((uint32_t)(input[60] & 0x3f) << 26) |
			((uint32_t)input[61] << 18) |
			((uint32_t)input[62] << 10) |
			((uint32_t)(input[63] & 0xe0) << 2);
	output[19] = (double)(value >> 7);
}

static void unpack_20_25bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 25-bit unsigned
	// Skip 7 bits, read 500 bits of data.
	// Input must be at least 64 bytes long

	uint32_t value;

	// read output[0]: from bit 7 to 31
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)input[1] << 23) |
			((uint32_t)input[2] << 15) |
			((uint32_t)input[3] << 7);
	output[0] = (double)(value >> 7);

	// read output[1]: from bit 32 to 56
	value = ((uint32_t)input[4] << 24) |
			((uint32_t)input[5] << 16) |
			((uint32_t)input[6] << 8) |
			((uint32_t)(input[7] & 0x80));
	output[1] = (double)(value >> 7);

	// read output[2]: from bit 57 to 81
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)input[8] << 17) |
			((uint32_t)input[9] << 9) |
			((uint32_t)(input[10] & 0xc0) << 1);
	output[2] = (double)(value >> 7);

	// read output[3]: from bit 82 to 106
	value = ((uint32_t)(input[10] & 0x3f) << 26) |
			((uint32_t)input[11] << 18) |
			((uint32_t)input[12] << 10) |
			((uint32_t)(input[13] & 0xe0) << 2);
	output[3] = (double)(value >> 7);

	// read output[4]: from bit 107 to 131
	value = ((uint32_t)(input[13] & 0x1f) << 27) |
			((uint32_t)input[14] << 19) |
			((uint32_t)input[15] << 11) |
			((uint32_t)(input[16] & 0xf0) << 3);
	output[4] = (double)(value >> 7);

	// read output[5]: from bit 132 to 156
	value = ((uint32_t)(input[16] & 0x0f) << 28) |
			((uint32_t)input[17] << 20) |
			((uint32_t)input[18] << 12) |
			((uint32_t)(input[19] & 0xf8) << 4);
	output[5] = (double)(value >> 7);

	// read output[6]: from bit 157 to 181
	value = ((uint32_t)(input[19] & 0x07) << 29) |
			((uint32_t)input[20] << 21) |
			((uint32_t)input[21] << 13) |
			((uint32_t)(input[22] & 0xfc) << 5);
	output[6] = (double)(value >> 7);

	// read output[7]: from bit 182 to 206
	value = ((uint32_t)(input[22] & 0x03) << 30) |
			((uint32_t)input[23] << 22) |
			((uint32_t)input[24] << 14) |
			((uint32_t)(input[25] & 0xfe) << 6);
	output[7] = (double)(value >> 7);

	// read output[8]: from bit 207 to 231
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)input[28] << 7);
	output[8] = (double)(value >> 7);

	// read output[9]: from bit 232 to 256
	value = ((uint32_t)input[29] << 24) |
			((uint32_t)input[30] << 16) |
			((uint32_t)input[31] << 8) |
			((uint32_t)(input[32] & 0x80));
	output[9] = (double)(value >> 7);

	// read output[10]: from bit 257 to 281
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)input[33] << 17) |
			((uint32_t)input[34] << 9) |
			((uint32_t)(input[35] & 0xc0) << 1);
	output[10] = (double)(value >> 7);

	// read output[11]: from bit 282 to 306
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)input[36] << 18) |
			((uint32_t)input[37] << 10) |
			((uint32_t)(input[38] & 0xe0) << 2);
	output[11] = (double)(value >> 7);

	// read output[12]: from bit 307 to 331
	value = ((uint32_t)(input[38] & 0x1f) << 27) |
			((uint32_t)input[39] << 19) |
			((uint32_t)input[40] << 11) |
			((uint32_t)(input[41] & 0xf0) << 3);
	output[12] = (double)(value >> 7);

	// read output[13]: from bit 332 to 356
	value = ((uint32_t)(input[41] & 0x0f) << 28) |
			((uint32_t)input[42] << 20) |
			((uint32_t)input[43] << 12) |
			((uint32_t)(input[44] & 0xf8) << 4);
	output[13] = (double)(value >> 7);

	// read output[14]: from bit 357 to 381
	value = ((uint32_t)(input[44] & 0x07) << 29) |
			((uint32_t)input[45] << 21) |
			((uint32_t)input[46] << 13) |
			((uint32_t)(input[47] & 0xfc) << 5);
	output[14] = (double)(value >> 7);

	// read output[15]: from bit 382 to 406
	value = ((uint32_t)(input[47] & 0x03) << 30) |
			((uint32_t)input[48] << 22) |
			((uint32_t)input[49] << 14) |
			((uint32_t)(input[50] & 0xfe) << 6);
	output[15] = (double)(value >> 7);

	// read output[16]: from bit 407 to 431
	value = ((uint32_t)(input[50] & 0x01) << 31) |
			((uint32_t)input[51] << 23) |
			((uint32_t)input[52] << 15) |
			((uint32_t)input[53] << 7);
	output[16] = (double)(value >> 7);

	// read output[17]: from bit 432 to 456
	value = ((uint32_t)input[54] << 24) |
			((uint32_t)input[55] << 16) |
			((uint32_t)input[56] << 8) |
			((uint32_t)(input[57] & 0x80));
	output[17] = (double)(value >> 7);

	// read output[18]: from bit 457 to 481
	value = ((uint32_t)(input[57] & 0x7f) << 25) |
			((uint32_t)input[58] << 17) |
			((uint32_t)input[59] << 9) |
			((uint32_t)(input[60] & 0xc0) << 1);
	output[18] = (double)(value >> 7);

	// read output[19]: from bit 482 to 506
	value = ((uint32_t)(input[60] & 0x3f) << 26) |
			((uint32_t)input[61] << 18) |
			((uint32_t)input[62] << 10) |
			((uint32_t)(input[63] & 0xe0) << 2);
	output[19] = (double)(value >> 7);
}


unpack_func_t unpack_25bit[UNPACK_25BIT_MAX_COUNT][8][2] = {
	{
		{
			unpack_1_25bit_unsigned_0off,
			unpack_1_25bit_signed_0off,
		},
		{
			unpack_1_25bit_unsigned_1off,
			unpack_1_25bit_signed_1off,
		},
		{
			unpack_1_25bit_unsigned_2off,
			unpack_1_25bit_signed_2off,
		},
		{
			unpack_1_25bit_unsigned_3off,
			unpack_1_25bit_signed_3off,
		},
		{
			unpack_1_25bit_unsigned_4off,
			unpack_1_25bit_signed_4off,
		},
		{
			unpack_1_25bit_unsigned_5off,
			unpack_1_25bit_signed_5off,
		},
		{
			unpack_1_25bit_unsigned_6off,
			unpack_1_25bit_signed_6off,
		},
		{
			unpack_1_25bit_unsigned_7off,
			unpack_1_25bit_signed_7off,
		},
	},
	{
		{
			unpack_2_25bit_unsigned_0off,
			unpack_2_25bit_signed_0off,
		},
		{
			unpack_2_25bit_unsigned_1off,
			unpack_2_25bit_signed_1off,
		},
		{
			unpack_2_25bit_unsigned_2off,
			unpack_2_25bit_signed_2off,
		},
		{
			unpack_2_25bit_unsigned_3off,
			unpack_2_25bit_signed_3off,
		},
		{
			unpack_2_25bit_unsigned_4off,
			unpack_2_25bit_signed_4off,
		},
		{
			unpack_2_25bit_unsigned_5off,
			unpack_2_25bit_signed_5off,
		},
		{
			unpack_2_25bit_unsigned_6off,
			unpack_2_25bit_signed_6off,
		},
		{
			unpack_2_25bit_unsigned_7off,
			unpack_2_25bit_signed_7off,
		},
	},
	{
		{
			unpack_3_25bit_unsigned_0off,
			unpack_3_25bit_signed_0off,
		},
		{
			unpack_3_25bit_unsigned_1off,
			unpack_3_25bit_signed_1off,
		},
		{
			unpack_3_25bit_unsigned_2off,
			unpack_3_25bit_signed_2off,
		},
		{
			unpack_3_25bit_unsigned_3off,
			unpack_3_25bit_signed_3off,
		},
		{
			unpack_3_25bit_unsigned_4off,
			unpack_3_25bit_signed_4off,
		},
		{
			unpack_3_25bit_unsigned_5off,
			unpack_3_25bit_signed_5off,
		},
		{
			unpack_3_25bit_unsigned_6off,
			unpack_3_25bit_signed_6off,
		},
		{
			unpack_3_25bit_unsigned_7off,
			unpack_3_25bit_signed_7off,
		},
	},
	{
		{
			unpack_4_25bit_unsigned_0off,
			unpack_4_25bit_signed_0off,
		},
		{
			unpack_4_25bit_unsigned_1off,
			unpack_4_25bit_signed_1off,
		},
		{
			unpack_4_25bit_unsigned_2off,
			unpack_4_25bit_signed_2off,
		},
		{
			unpack_4_25bit_unsigned_3off,
			unpack_4_25bit_signed_3off,
		},
		{
			unpack_4_25bit_unsigned_4off,
			unpack_4_25bit_signed_4off,
		},
		{
			unpack_4_25bit_unsigned_5off,
			unpack_4_25bit_signed_5off,
		},
		{
			unpack_4_25bit_unsigned_6off,
			unpack_4_25bit_signed_6off,
		},
		{
			unpack_4_25bit_unsigned_7off,
			unpack_4_25bit_signed_7off,
		},
	},
	{
		{
			unpack_5_25bit_unsigned_0off,
			unpack_5_25bit_signed_0off,
		},
		{
			unpack_5_25bit_unsigned_1off,
			unpack_5_25bit_signed_1off,
		},
		{
			unpack_5_25bit_unsigned_2off,
			unpack_5_25bit_signed_2off,
		},
		{
			unpack_5_25bit_unsigned_3off,
			unpack_5_25bit_signed_3off,
		},
		{
			unpack_5_25bit_unsigned_4off,
			unpack_5_25bit_signed_4off,
		},
		{
			unpack_5_25bit_unsigned_5off,
			unpack_5_25bit_signed_5off,
		},
		{
			unpack_5_25bit_unsigned_6off,
			unpack_5_25bit_signed_6off,
		},
		{
			unpack_5_25bit_unsigned_7off,
			unpack_5_25bit_signed_7off,
		},
	},
	{
		{
			unpack_6_25bit_unsigned_0off,
			unpack_6_25bit_signed_0off,
		},
		{
			unpack_6_25bit_unsigned_1off,
			unpack_6_25bit_signed_1off,
		},
		{
			unpack_6_25bit_unsigned_2off,
			unpack_6_25bit_signed_2off,
		},
		{
			unpack_6_25bit_unsigned_3off,
			unpack_6_25bit_signed_3off,
		},
		{
			unpack_6_25bit_unsigned_4off,
			unpack_6_25bit_signed_4off,
		},
		{
			unpack_6_25bit_unsigned_5off,
			unpack_6_25bit_signed_5off,
		},
		{
			unpack_6_25bit_unsigned_6off,
			unpack_6_25bit_signed_6off,
		},
		{
			unpack_6_25bit_unsigned_7off,
			unpack_6_25bit_signed_7off,
		},
	},
	{
		{
			unpack_7_25bit_unsigned_0off,
			unpack_7_25bit_signed_0off,
		},
		{
			unpack_7_25bit_unsigned_1off,
			unpack_7_25bit_signed_1off,
		},
		{
			unpack_7_25bit_unsigned_2off,
			unpack_7_25bit_signed_2off,
		},
		{
			unpack_7_25bit_unsigned_3off,
			unpack_7_25bit_signed_3off,
		},
		{
			unpack_7_25bit_unsigned_4off,
			unpack_7_25bit_signed_4off,
		},
		{
			unpack_7_25bit_unsigned_5off,
			unpack_7_25bit_signed_5off,
		},
		{
			unpack_7_25bit_unsigned_6off,
			unpack_7_25bit_signed_6off,
		},
		{
			unpack_7_25bit_unsigned_7off,
			unpack_7_25bit_signed_7off,
		},
	},
	{
		{
			unpack_8_25bit_unsigned_0off,
			unpack_8_25bit_signed_0off,
		},
		{
			unpack_8_25bit_unsigned_1off,
			unpack_8_25bit_signed_1off,
		},
		{
			unpack_8_25bit_unsigned_2off,
			unpack_8_25bit_signed_2off,
		},
		{
			unpack_8_25bit_unsigned_3off,
			unpack_8_25bit_signed_3off,
		},
		{
			unpack_8_25bit_unsigned_4off,
			unpack_8_25bit_signed_4off,
		},
		{
			unpack_8_25bit_unsigned_5off,
			unpack_8_25bit_signed_5off,
		},
		{
			unpack_8_25bit_unsigned_6off,
			unpack_8_25bit_signed_6off,
		},
		{
			unpack_8_25bit_unsigned_7off,
			unpack_8_25bit_signed_7off,
		},
	},
	{
		{
			unpack_9_25bit_unsigned_0off,
			unpack_9_25bit_signed_0off,
		},
		{
			unpack_9_25bit_unsigned_1off,
			unpack_9_25bit_signed_1off,
		},
		{
			unpack_9_25bit_unsigned_2off,
			unpack_9_25bit_signed_2off,
		},
		{
			unpack_9_25bit_unsigned_3off,
			unpack_9_25bit_signed_3off,
		},
		{
			unpack_9_25bit_unsigned_4off,
			unpack_9_25bit_signed_4off,
		},
		{
			unpack_9_25bit_unsigned_5off,
			unpack_9_25bit_signed_5off,
		},
		{
			unpack_9_25bit_unsigned_6off,
			unpack_9_25bit_signed_6off,
		},
		{
			unpack_9_25bit_unsigned_7off,
			unpack_9_25bit_signed_7off,
		},
	},
	{
		{
			unpack_10_25bit_unsigned_0off,
			unpack_10_25bit_signed_0off,
		},
		{
			unpack_10_25bit_unsigned_1off,
			unpack_10_25bit_signed_1off,
		},
		{
			unpack_10_25bit_unsigned_2off,
			unpack_10_25bit_signed_2off,
		},
		{
			unpack_10_25bit_unsigned_3off,
			unpack_10_25bit_signed_3off,
		},
		{
			unpack_10_25bit_unsigned_4off,
			unpack_10_25bit_signed_4off,
		},
		{
			unpack_10_25bit_unsigned_5off,
			unpack_10_25bit_signed_5off,
		},
		{
			unpack_10_25bit_unsigned_6off,
			unpack_10_25bit_signed_6off,
		},
		{
			unpack_10_25bit_unsigned_7off,
			unpack_10_25bit_signed_7off,
		},
	},
	{
		{
			unpack_11_25bit_unsigned_0off,
			unpack_11_25bit_signed_0off,
		},
		{
			unpack_11_25bit_unsigned_1off,
			unpack_11_25bit_signed_1off,
		},
		{
			unpack_11_25bit_unsigned_2off,
			unpack_11_25bit_signed_2off,
		},
		{
			unpack_11_25bit_unsigned_3off,
			unpack_11_25bit_signed_3off,
		},
		{
			unpack_11_25bit_unsigned_4off,
			unpack_11_25bit_signed_4off,
		},
		{
			unpack_11_25bit_unsigned_5off,
			unpack_11_25bit_signed_5off,
		},
		{
			unpack_11_25bit_unsigned_6off,
			unpack_11_25bit_signed_6off,
		},
		{
			unpack_11_25bit_unsigned_7off,
			unpack_11_25bit_signed_7off,
		},
	},
	{
		{
			unpack_12_25bit_unsigned_0off,
			unpack_12_25bit_signed_0off,
		},
		{
			unpack_12_25bit_unsigned_1off,
			unpack_12_25bit_signed_1off,
		},
		{
			unpack_12_25bit_unsigned_2off,
			unpack_12_25bit_signed_2off,
		},
		{
			unpack_12_25bit_unsigned_3off,
			unpack_12_25bit_signed_3off,
		},
		{
			unpack_12_25bit_unsigned_4off,
			unpack_12_25bit_signed_4off,
		},
		{
			unpack_12_25bit_unsigned_5off,
			unpack_12_25bit_signed_5off,
		},
		{
			unpack_12_25bit_unsigned_6off,
			unpack_12_25bit_signed_6off,
		},
		{
			unpack_12_25bit_unsigned_7off,
			unpack_12_25bit_signed_7off,
		},
	},
	{
		{
			unpack_13_25bit_unsigned_0off,
			unpack_13_25bit_signed_0off,
		},
		{
			unpack_13_25bit_unsigned_1off,
			unpack_13_25bit_signed_1off,
		},
		{
			unpack_13_25bit_unsigned_2off,
			unpack_13_25bit_signed_2off,
		},
		{
			unpack_13_25bit_unsigned_3off,
			unpack_13_25bit_signed_3off,
		},
		{
			unpack_13_25bit_unsigned_4off,
			unpack_13_25bit_signed_4off,
		},
		{
			unpack_13_25bit_unsigned_5off,
			unpack_13_25bit_signed_5off,
		},
		{
			unpack_13_25bit_unsigned_6off,
			unpack_13_25bit_signed_6off,
		},
		{
			unpack_13_25bit_unsigned_7off,
			unpack_13_25bit_signed_7off,
		},
	},
	{
		{
			unpack_14_25bit_unsigned_0off,
			unpack_14_25bit_signed_0off,
		},
		{
			unpack_14_25bit_unsigned_1off,
			unpack_14_25bit_signed_1off,
		},
		{
			unpack_14_25bit_unsigned_2off,
			unpack_14_25bit_signed_2off,
		},
		{
			unpack_14_25bit_unsigned_3off,
			unpack_14_25bit_signed_3off,
		},
		{
			unpack_14_25bit_unsigned_4off,
			unpack_14_25bit_signed_4off,
		},
		{
			unpack_14_25bit_unsigned_5off,
			unpack_14_25bit_signed_5off,
		},
		{
			unpack_14_25bit_unsigned_6off,
			unpack_14_25bit_signed_6off,
		},
		{
			unpack_14_25bit_unsigned_7off,
			unpack_14_25bit_signed_7off,
		},
	},
	{
		{
			unpack_15_25bit_unsigned_0off,
			unpack_15_25bit_signed_0off,
		},
		{
			unpack_15_25bit_unsigned_1off,
			unpack_15_25bit_signed_1off,
		},
		{
			unpack_15_25bit_unsigned_2off,
			unpack_15_25bit_signed_2off,
		},
		{
			unpack_15_25bit_unsigned_3off,
			unpack_15_25bit_signed_3off,
		},
		{
			unpack_15_25bit_unsigned_4off,
			unpack_15_25bit_signed_4off,
		},
		{
			unpack_15_25bit_unsigned_5off,
			unpack_15_25bit_signed_5off,
		},
		{
			unpack_15_25bit_unsigned_6off,
			unpack_15_25bit_signed_6off,
		},
		{
			unpack_15_25bit_unsigned_7off,
			unpack_15_25bit_signed_7off,
		},
	},
	{
		{
			unpack_16_25bit_unsigned_0off,
			unpack_16_25bit_signed_0off,
		},
		{
			unpack_16_25bit_unsigned_1off,
			unpack_16_25bit_signed_1off,
		},
		{
			unpack_16_25bit_unsigned_2off,
			unpack_16_25bit_signed_2off,
		},
		{
			unpack_16_25bit_unsigned_3off,
			unpack_16_25bit_signed_3off,
		},
		{
			unpack_16_25bit_unsigned_4off,
			unpack_16_25bit_signed_4off,
		},
		{
			unpack_16_25bit_unsigned_5off,
			unpack_16_25bit_signed_5off,
		},
		{
			unpack_16_25bit_unsigned_6off,
			unpack_16_25bit_signed_6off,
		},
		{
			unpack_16_25bit_unsigned_7off,
			unpack_16_25bit_signed_7off,
		},
	},
	{
		{
			unpack_17_25bit_unsigned_0off,
			unpack_17_25bit_signed_0off,
		},
		{
			unpack_17_25bit_unsigned_1off,
			unpack_17_25bit_signed_1off,
		},
		{
			unpack_17_25bit_unsigned_2off,
			unpack_17_25bit_signed_2off,
		},
		{
			unpack_17_25bit_unsigned_3off,
			unpack_17_25bit_signed_3off,
		},
		{
			unpack_17_25bit_unsigned_4off,
			unpack_17_25bit_signed_4off,
		},
		{
			unpack_17_25bit_unsigned_5off,
			unpack_17_25bit_signed_5off,
		},
		{
			unpack_17_25bit_unsigned_6off,
			unpack_17_25bit_signed_6off,
		},
		{
			unpack_17_25bit_unsigned_7off,
			unpack_17_25bit_signed_7off,
		},
	},
	{
		{
			unpack_18_25bit_unsigned_0off,
			unpack_18_25bit_signed_0off,
		},
		{
			unpack_18_25bit_unsigned_1off,
			unpack_18_25bit_signed_1off,
		},
		{
			unpack_18_25bit_unsigned_2off,
			unpack_18_25bit_signed_2off,
		},
		{
			unpack_18_25bit_unsigned_3off,
			unpack_18_25bit_signed_3off,
		},
		{
			unpack_18_25bit_unsigned_4off,
			unpack_18_25bit_signed_4off,
		},
		{
			unpack_18_25bit_unsigned_5off,
			unpack_18_25bit_signed_5off,
		},
		{
			unpack_18_25bit_unsigned_6off,
			unpack_18_25bit_signed_6off,
		},
		{
			unpack_18_25bit_unsigned_7off,
			unpack_18_25bit_signed_7off,
		},
	},
	{
		{
			unpack_19_25bit_unsigned_0off,
			unpack_19_25bit_signed_0off,
		},
		{
			unpack_19_25bit_unsigned_1off,
			unpack_19_25bit_signed_1off,
		},
		{
			unpack_19_25bit_unsigned_2off,
			unpack_19_25bit_signed_2off,
		},
		{
			unpack_19_25bit_unsigned_3off,
			unpack_19_25bit_signed_3off,
		},
		{
			unpack_19_25bit_unsigned_4off,
			unpack_19_25bit_signed_4off,
		},
		{
			unpack_19_25bit_unsigned_5off,
			unpack_19_25bit_signed_5off,
		},
		{
			unpack_19_25bit_unsigned_6off,
			unpack_19_25bit_signed_6off,
		},
		{
			unpack_19_25bit_unsigned_7off,
			unpack_19_25bit_signed_7off,
		},
	},
	{
		{
			unpack_20_25bit_unsigned_0off,
			unpack_20_25bit_signed_0off,
		},
		{
			unpack_20_25bit_unsigned_1off,
			unpack_20_25bit_signed_1off,
		},
		{
			unpack_20_25bit_unsigned_2off,
			unpack_20_25bit_signed_2off,
		},
		{
			unpack_20_25bit_unsigned_3off,
			unpack_20_25bit_signed_3off,
		},
		{
			unpack_20_25bit_unsigned_4off,
			unpack_20_25bit_signed_4off,
		},
		{
			unpack_20_25bit_unsigned_5off,
			unpack_20_25bit_signed_5off,
		},
		{
			unpack_20_25bit_unsigned_6off,
			unpack_20_25bit_signed_6off,
		},
		{
			unpack_20_25bit_unsigned_7off,
			unpack_20_25bit_signed_7off,
		},
	},
};
