// AUTOGENERATED FILE. DO NOT MODIFY.

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

#include "unpack1.h"



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

	uint32_t value;

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

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

	uint32_t value;

	// read output[0]: from bit 1 to 1
	value = ((uint32_t)(input[0] & 0x40) << 25);
	output[0] = (double)(value >> 31);
}

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

	uint32_t value;

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

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

	uint32_t value;

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

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

	uint32_t value;

	// read output[0]: from bit 4 to 4
	value = ((uint32_t)(input[0] & 0x08) << 28);
	output[0] = (double)(value >> 31);
}

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

	uint32_t value;

	// read output[0]: from bit 5 to 5
	value = ((uint32_t)(input[0] & 0x04) << 29);
	output[0] = (double)(value >> 31);
}

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

	uint32_t value;

	// read output[0]: from bit 6 to 6
	value = ((uint32_t)(input[0] & 0x02) << 30);
	output[0] = (double)(value >> 31);
}

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

	uint32_t value;

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

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

	uint32_t value;

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

	// read output[1]: from bit 1 to 1
	value = ((uint32_t)(input[0] & 0x40) << 25);
	output[1] = (double)(value >> 31);
}

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

	uint32_t value;

	// read output[0]: from bit 1 to 1
	value = ((uint32_t)(input[0] & 0x40) << 25);
	output[0] = (double)(value >> 31);

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

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

	uint32_t value;

	// read output[0]: from bit 2 to 2
	value = ((uint32_t)(input[0] & 0x20) << 26);
	output[0] = (double)(value >> 31);

	// read output[1]: from bit 3 to 3
	value = ((uint32_t)(input[0] & 0x10) << 27);
	output[1] = (double)(value >> 31);
}

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

	uint32_t value;

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

	// read output[1]: from bit 4 to 4
	value = ((uint32_t)(input[0] & 0x08) << 28);
	output[1] = (double)(value >> 31);
}

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

	uint32_t value;

	// read output[0]: from bit 4 to 4
	value = ((uint32_t)(input[0] & 0x08) << 28);
	output[0] = (double)(value >> 31);

	// read output[1]: from bit 5 to 5
	value = ((uint32_t)(input[0] & 0x04) << 29);
	output[1] = (double)(value >> 31);
}

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

	uint32_t value;

	// read output[0]: from bit 5 to 5
	value = ((uint32_t)(input[0] & 0x04) << 29);
	output[0] = (double)(value >> 31);

	// read output[1]: from bit 6 to 6
	value = ((uint32_t)(input[0] & 0x02) << 30);
	output[1] = (double)(value >> 31);
}

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

	uint32_t value;

	// read output[0]: from bit 6 to 6
	value = ((uint32_t)(input[0] & 0x02) << 30);
	output[0] = (double)(value >> 31);

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

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

	uint32_t value;

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

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

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

	uint32_t value;

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

	// read output[1]: from bit 1 to 1
	value = ((uint32_t)(input[0] & 0x40) << 25);
	output[1] = (double)(value >> 31);

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

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

	uint32_t value;

	// read output[0]: from bit 1 to 1
	value = ((uint32_t)(input[0] & 0x40) << 25);
	output[0] = (double)(value >> 31);

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

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

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

	uint32_t value;

	// read output[0]: from bit 2 to 2
	value = ((uint32_t)(input[0] & 0x20) << 26);
	output[0] = (double)(value >> 31);

	// read output[1]: from bit 3 to 3
	value = ((uint32_t)(input[0] & 0x10) << 27);
	output[1] = (double)(value >> 31);

	// read output[2]: from bit 4 to 4
	value = ((uint32_t)(input[0] & 0x08) << 28);
	output[2] = (double)(value >> 31);
}

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

	uint32_t value;

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

	// read output[1]: from bit 4 to 4
	value = ((uint32_t)(input[0] & 0x08) << 28);
	output[1] = (double)(value >> 31);

	// read output[2]: from bit 5 to 5
	value = ((uint32_t)(input[0] & 0x04) << 29);
	output[2] = (double)(value >> 31);
}

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

	uint32_t value;

	// read output[0]: from bit 4 to 4
	value = ((uint32_t)(input[0] & 0x08) << 28);
	output[0] = (double)(value >> 31);

	// read output[1]: from bit 5 to 5
	value = ((uint32_t)(input[0] & 0x04) << 29);
	output[1] = (double)(value >> 31);

	// read output[2]: from bit 6 to 6
	value = ((uint32_t)(input[0] & 0x02) << 30);
	output[2] = (double)(value >> 31);
}

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

	uint32_t value;

	// read output[0]: from bit 5 to 5
	value = ((uint32_t)(input[0] & 0x04) << 29);
	output[0] = (double)(value >> 31);

	// read output[1]: from bit 6 to 6
	value = ((uint32_t)(input[0] & 0x02) << 30);
	output[1] = (double)(value >> 31);

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

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

	uint32_t value;

	// read output[0]: from bit 6 to 6
	value = ((uint32_t)(input[0] & 0x02) << 30);
	output[0] = (double)(value >> 31);

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

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

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

	uint32_t value;

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

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

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

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

	uint32_t value;

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

	// read output[1]: from bit 1 to 1
	value = ((uint32_t)(input[0] & 0x40) << 25);
	output[1] = (double)(value >> 31);

	// read output[2]: from bit 2 to 2
	value = ((uint32_t)(input[0] & 0x20) << 26);
	output[2] = (double)(value >> 31);

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

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

	uint32_t value;

	// read output[0]: from bit 1 to 1
	value = ((uint32_t)(input[0] & 0x40) << 25);
	output[0] = (double)(value >> 31);

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

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

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

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

	uint32_t value;

	// read output[0]: from bit 2 to 2
	value = ((uint32_t)(input[0] & 0x20) << 26);
	output[0] = (double)(value >> 31);

	// read output[1]: from bit 3 to 3
	value = ((uint32_t)(input[0] & 0x10) << 27);
	output[1] = (double)(value >> 31);

	// read output[2]: from bit 4 to 4
	value = ((uint32_t)(input[0] & 0x08) << 28);
	output[2] = (double)(value >> 31);

	// read output[3]: from bit 5 to 5
	value = ((uint32_t)(input[0] & 0x04) << 29);
	output[3] = (double)(value >> 31);
}

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

	uint32_t value;

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

	// read output[1]: from bit 4 to 4
	value = ((uint32_t)(input[0] & 0x08) << 28);
	output[1] = (double)(value >> 31);

	// read output[2]: from bit 5 to 5
	value = ((uint32_t)(input[0] & 0x04) << 29);
	output[2] = (double)(value >> 31);

	// read output[3]: from bit 6 to 6
	value = ((uint32_t)(input[0] & 0x02) << 30);
	output[3] = (double)(value >> 31);
}

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

	uint32_t value;

	// read output[0]: from bit 4 to 4
	value = ((uint32_t)(input[0] & 0x08) << 28);
	output[0] = (double)(value >> 31);

	// read output[1]: from bit 5 to 5
	value = ((uint32_t)(input[0] & 0x04) << 29);
	output[1] = (double)(value >> 31);

	// read output[2]: from bit 6 to 6
	value = ((uint32_t)(input[0] & 0x02) << 30);
	output[2] = (double)(value >> 31);

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

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

	uint32_t value;

	// read output[0]: from bit 5 to 5
	value = ((uint32_t)(input[0] & 0x04) << 29);
	output[0] = (double)(value >> 31);

	// read output[1]: from bit 6 to 6
	value = ((uint32_t)(input[0] & 0x02) << 30);
	output[1] = (double)(value >> 31);

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

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

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

	uint32_t value;

	// read output[0]: from bit 6 to 6
	value = ((uint32_t)(input[0] & 0x02) << 30);
	output[0] = (double)(value >> 31);

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

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

	// read output[3]: from bit 9 to 9
	value = ((uint32_t)(input[1] & 0x40) << 25);
	output[3] = (double)(value >> 31);
}

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

	uint32_t value;

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

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

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

	// read output[3]: from bit 10 to 10
	value = ((uint32_t)(input[1] & 0x20) << 26);
	output[3] = (double)(value >> 31);
}

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

	uint32_t value;

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

	// read output[1]: from bit 1 to 1
	value = ((uint32_t)(input[0] & 0x40) << 25);
	output[1] = (double)(value >> 31);

	// read output[2]: from bit 2 to 2
	value = ((uint32_t)(input[0] & 0x20) << 26);
	output[2] = (double)(value >> 31);

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

	// read output[4]: from bit 4 to 4
	value = ((uint32_t)(input[0] & 0x08) << 28);
	output[4] = (double)(value >> 31);
}

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

	uint32_t value;

	// read output[0]: from bit 1 to 1
	value = ((uint32_t)(input[0] & 0x40) << 25);
	output[0] = (double)(value >> 31);

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

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

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

	// read output[4]: from bit 5 to 5
	value = ((uint32_t)(input[0] & 0x04) << 29);
	output[4] = (double)(value >> 31);
}

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

	uint32_t value;

	// read output[0]: from bit 2 to 2
	value = ((uint32_t)(input[0] & 0x20) << 26);
	output[0] = (double)(value >> 31);

	// read output[1]: from bit 3 to 3
	value = ((uint32_t)(input[0] & 0x10) << 27);
	output[1] = (double)(value >> 31);

	// read output[2]: from bit 4 to 4
	value = ((uint32_t)(input[0] & 0x08) << 28);
	output[2] = (double)(value >> 31);

	// read output[3]: from bit 5 to 5
	value = ((uint32_t)(input[0] & 0x04) << 29);
	output[3] = (double)(value >> 31);

	// read output[4]: from bit 6 to 6
	value = ((uint32_t)(input[0] & 0x02) << 30);
	output[4] = (double)(value >> 31);
}

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

	uint32_t value;

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

	// read output[1]: from bit 4 to 4
	value = ((uint32_t)(input[0] & 0x08) << 28);
	output[1] = (double)(value >> 31);

	// read output[2]: from bit 5 to 5
	value = ((uint32_t)(input[0] & 0x04) << 29);
	output[2] = (double)(value >> 31);

	// read output[3]: from bit 6 to 6
	value = ((uint32_t)(input[0] & 0x02) << 30);
	output[3] = (double)(value >> 31);

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

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

	uint32_t value;

	// read output[0]: from bit 4 to 4
	value = ((uint32_t)(input[0] & 0x08) << 28);
	output[0] = (double)(value >> 31);

	// read output[1]: from bit 5 to 5
	value = ((uint32_t)(input[0] & 0x04) << 29);
	output[1] = (double)(value >> 31);

	// read output[2]: from bit 6 to 6
	value = ((uint32_t)(input[0] & 0x02) << 30);
	output[2] = (double)(value >> 31);

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

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

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

	uint32_t value;

	// read output[0]: from bit 5 to 5
	value = ((uint32_t)(input[0] & 0x04) << 29);
	output[0] = (double)(value >> 31);

	// read output[1]: from bit 6 to 6
	value = ((uint32_t)(input[0] & 0x02) << 30);
	output[1] = (double)(value >> 31);

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

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

	// read output[4]: from bit 9 to 9
	value = ((uint32_t)(input[1] & 0x40) << 25);
	output[4] = (double)(value >> 31);
}

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

	uint32_t value;

	// read output[0]: from bit 6 to 6
	value = ((uint32_t)(input[0] & 0x02) << 30);
	output[0] = (double)(value >> 31);

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

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

	// read output[3]: from bit 9 to 9
	value = ((uint32_t)(input[1] & 0x40) << 25);
	output[3] = (double)(value >> 31);

	// read output[4]: from bit 10 to 10
	value = ((uint32_t)(input[1] & 0x20) << 26);
	output[4] = (double)(value >> 31);
}

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

	uint32_t value;

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

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

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

	// read output[3]: from bit 10 to 10
	value = ((uint32_t)(input[1] & 0x20) << 26);
	output[3] = (double)(value >> 31);

	// read output[4]: from bit 11 to 11
	value = ((uint32_t)(input[1] & 0x10) << 27);
	output[4] = (double)(value >> 31);
}

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

	uint32_t value;

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

	// read output[1]: from bit 1 to 1
	value = ((uint32_t)(input[0] & 0x40) << 25);
	output[1] = (double)(value >> 31);

	// read output[2]: from bit 2 to 2
	value = ((uint32_t)(input[0] & 0x20) << 26);
	output[2] = (double)(value >> 31);

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

	// read output[4]: from bit 4 to 4
	value = ((uint32_t)(input[0] & 0x08) << 28);
	output[4] = (double)(value >> 31);

	// read output[5]: from bit 5 to 5
	value = ((uint32_t)(input[0] & 0x04) << 29);
	output[5] = (double)(value >> 31);
}

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

	uint32_t value;

	// read output[0]: from bit 1 to 1
	value = ((uint32_t)(input[0] & 0x40) << 25);
	output[0] = (double)(value >> 31);

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

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

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

	// read output[4]: from bit 5 to 5
	value = ((uint32_t)(input[0] & 0x04) << 29);
	output[4] = (double)(value >> 31);

	// read output[5]: from bit 6 to 6
	value = ((uint32_t)(input[0] & 0x02) << 30);
	output[5] = (double)(value >> 31);
}

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

	uint32_t value;

	// read output[0]: from bit 2 to 2
	value = ((uint32_t)(input[0] & 0x20) << 26);
	output[0] = (double)(value >> 31);

	// read output[1]: from bit 3 to 3
	value = ((uint32_t)(input[0] & 0x10) << 27);
	output[1] = (double)(value >> 31);

	// read output[2]: from bit 4 to 4
	value = ((uint32_t)(input[0] & 0x08) << 28);
	output[2] = (double)(value >> 31);

	// read output[3]: from bit 5 to 5
	value = ((uint32_t)(input[0] & 0x04) << 29);
	output[3] = (double)(value >> 31);

	// read output[4]: from bit 6 to 6
	value = ((uint32_t)(input[0] & 0x02) << 30);
	output[4] = (double)(value >> 31);

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

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

	uint32_t value;

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

	// read output[1]: from bit 4 to 4
	value = ((uint32_t)(input[0] & 0x08) << 28);
	output[1] = (double)(value >> 31);

	// read output[2]: from bit 5 to 5
	value = ((uint32_t)(input[0] & 0x04) << 29);
	output[2] = (double)(value >> 31);

	// read output[3]: from bit 6 to 6
	value = ((uint32_t)(input[0] & 0x02) << 30);
	output[3] = (double)(value >> 31);

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

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

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

	uint32_t value;

	// read output[0]: from bit 4 to 4
	value = ((uint32_t)(input[0] & 0x08) << 28);
	output[0] = (double)(value >> 31);

	// read output[1]: from bit 5 to 5
	value = ((uint32_t)(input[0] & 0x04) << 29);
	output[1] = (double)(value >> 31);

	// read output[2]: from bit 6 to 6
	value = ((uint32_t)(input[0] & 0x02) << 30);
	output[2] = (double)(value >> 31);

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

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

	// read output[5]: from bit 9 to 9
	value = ((uint32_t)(input[1] & 0x40) << 25);
	output[5] = (double)(value >> 31);
}

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

	uint32_t value;

	// read output[0]: from bit 5 to 5
	value = ((uint32_t)(input[0] & 0x04) << 29);
	output[0] = (double)(value >> 31);

	// read output[1]: from bit 6 to 6
	value = ((uint32_t)(input[0] & 0x02) << 30);
	output[1] = (double)(value >> 31);

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

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

	// read output[4]: from bit 9 to 9
	value = ((uint32_t)(input[1] & 0x40) << 25);
	output[4] = (double)(value >> 31);

	// read output[5]: from bit 10 to 10
	value = ((uint32_t)(input[1] & 0x20) << 26);
	output[5] = (double)(value >> 31);
}

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

	uint32_t value;

	// read output[0]: from bit 6 to 6
	value = ((uint32_t)(input[0] & 0x02) << 30);
	output[0] = (double)(value >> 31);

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

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

	// read output[3]: from bit 9 to 9
	value = ((uint32_t)(input[1] & 0x40) << 25);
	output[3] = (double)(value >> 31);

	// read output[4]: from bit 10 to 10
	value = ((uint32_t)(input[1] & 0x20) << 26);
	output[4] = (double)(value >> 31);

	// read output[5]: from bit 11 to 11
	value = ((uint32_t)(input[1] & 0x10) << 27);
	output[5] = (double)(value >> 31);
}

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

	uint32_t value;

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

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

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

	// read output[3]: from bit 10 to 10
	value = ((uint32_t)(input[1] & 0x20) << 26);
	output[3] = (double)(value >> 31);

	// read output[4]: from bit 11 to 11
	value = ((uint32_t)(input[1] & 0x10) << 27);
	output[4] = (double)(value >> 31);

	// read output[5]: from bit 12 to 12
	value = ((uint32_t)(input[1] & 0x08) << 28);
	output[5] = (double)(value >> 31);
}

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

	uint32_t value;

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

	// read output[1]: from bit 1 to 1
	value = ((uint32_t)(input[0] & 0x40) << 25);
	output[1] = (double)(value >> 31);

	// read output[2]: from bit 2 to 2
	value = ((uint32_t)(input[0] & 0x20) << 26);
	output[2] = (double)(value >> 31);

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

	// read output[4]: from bit 4 to 4
	value = ((uint32_t)(input[0] & 0x08) << 28);
	output[4] = (double)(value >> 31);

	// read output[5]: from bit 5 to 5
	value = ((uint32_t)(input[0] & 0x04) << 29);
	output[5] = (double)(value >> 31);

	// read output[6]: from bit 6 to 6
	value = ((uint32_t)(input[0] & 0x02) << 30);
	output[6] = (double)(value >> 31);
}

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

	uint32_t value;

	// read output[0]: from bit 1 to 1
	value = ((uint32_t)(input[0] & 0x40) << 25);
	output[0] = (double)(value >> 31);

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

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

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

	// read output[4]: from bit 5 to 5
	value = ((uint32_t)(input[0] & 0x04) << 29);
	output[4] = (double)(value >> 31);

	// read output[5]: from bit 6 to 6
	value = ((uint32_t)(input[0] & 0x02) << 30);
	output[5] = (double)(value >> 31);

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

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

	uint32_t value;

	// read output[0]: from bit 2 to 2
	value = ((uint32_t)(input[0] & 0x20) << 26);
	output[0] = (double)(value >> 31);

	// read output[1]: from bit 3 to 3
	value = ((uint32_t)(input[0] & 0x10) << 27);
	output[1] = (double)(value >> 31);

	// read output[2]: from bit 4 to 4
	value = ((uint32_t)(input[0] & 0x08) << 28);
	output[2] = (double)(value >> 31);

	// read output[3]: from bit 5 to 5
	value = ((uint32_t)(input[0] & 0x04) << 29);
	output[3] = (double)(value >> 31);

	// read output[4]: from bit 6 to 6
	value = ((uint32_t)(input[0] & 0x02) << 30);
	output[4] = (double)(value >> 31);

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

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

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

	uint32_t value;

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

	// read output[1]: from bit 4 to 4
	value = ((uint32_t)(input[0] & 0x08) << 28);
	output[1] = (double)(value >> 31);

	// read output[2]: from bit 5 to 5
	value = ((uint32_t)(input[0] & 0x04) << 29);
	output[2] = (double)(value >> 31);

	// read output[3]: from bit 6 to 6
	value = ((uint32_t)(input[0] & 0x02) << 30);
	output[3] = (double)(value >> 31);

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

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

	// read output[6]: from bit 9 to 9
	value = ((uint32_t)(input[1] & 0x40) << 25);
	output[6] = (double)(value >> 31);
}

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

	uint32_t value;

	// read output[0]: from bit 4 to 4
	value = ((uint32_t)(input[0] & 0x08) << 28);
	output[0] = (double)(value >> 31);

	// read output[1]: from bit 5 to 5
	value = ((uint32_t)(input[0] & 0x04) << 29);
	output[1] = (double)(value >> 31);

	// read output[2]: from bit 6 to 6
	value = ((uint32_t)(input[0] & 0x02) << 30);
	output[2] = (double)(value >> 31);

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

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

	// read output[5]: from bit 9 to 9
	value = ((uint32_t)(input[1] & 0x40) << 25);
	output[5] = (double)(value >> 31);

	// read output[6]: from bit 10 to 10
	value = ((uint32_t)(input[1] & 0x20) << 26);
	output[6] = (double)(value >> 31);
}

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

	uint32_t value;

	// read output[0]: from bit 5 to 5
	value = ((uint32_t)(input[0] & 0x04) << 29);
	output[0] = (double)(value >> 31);

	// read output[1]: from bit 6 to 6
	value = ((uint32_t)(input[0] & 0x02) << 30);
	output[1] = (double)(value >> 31);

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

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

	// read output[4]: from bit 9 to 9
	value = ((uint32_t)(input[1] & 0x40) << 25);
	output[4] = (double)(value >> 31);

	// read output[5]: from bit 10 to 10
	value = ((uint32_t)(input[1] & 0x20) << 26);
	output[5] = (double)(value >> 31);

	// read output[6]: from bit 11 to 11
	value = ((uint32_t)(input[1] & 0x10) << 27);
	output[6] = (double)(value >> 31);
}

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

	uint32_t value;

	// read output[0]: from bit 6 to 6
	value = ((uint32_t)(input[0] & 0x02) << 30);
	output[0] = (double)(value >> 31);

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

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

	// read output[3]: from bit 9 to 9
	value = ((uint32_t)(input[1] & 0x40) << 25);
	output[3] = (double)(value >> 31);

	// read output[4]: from bit 10 to 10
	value = ((uint32_t)(input[1] & 0x20) << 26);
	output[4] = (double)(value >> 31);

	// read output[5]: from bit 11 to 11
	value = ((uint32_t)(input[1] & 0x10) << 27);
	output[5] = (double)(value >> 31);

	// read output[6]: from bit 12 to 12
	value = ((uint32_t)(input[1] & 0x08) << 28);
	output[6] = (double)(value >> 31);
}

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

	uint32_t value;

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

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

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

	// read output[3]: from bit 10 to 10
	value = ((uint32_t)(input[1] & 0x20) << 26);
	output[3] = (double)(value >> 31);

	// read output[4]: from bit 11 to 11
	value = ((uint32_t)(input[1] & 0x10) << 27);
	output[4] = (double)(value >> 31);

	// read output[5]: from bit 12 to 12
	value = ((uint32_t)(input[1] & 0x08) << 28);
	output[5] = (double)(value >> 31);

	// read output[6]: from bit 13 to 13
	value = ((uint32_t)(input[1] & 0x04) << 29);
	output[6] = (double)(value >> 31);
}

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

	uint32_t value;

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

	// read output[1]: from bit 1 to 1
	value = ((uint32_t)(input[0] & 0x40) << 25);
	output[1] = (double)(value >> 31);

	// read output[2]: from bit 2 to 2
	value = ((uint32_t)(input[0] & 0x20) << 26);
	output[2] = (double)(value >> 31);

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

	// read output[4]: from bit 4 to 4
	value = ((uint32_t)(input[0] & 0x08) << 28);
	output[4] = (double)(value >> 31);

	// read output[5]: from bit 5 to 5
	value = ((uint32_t)(input[0] & 0x04) << 29);
	output[5] = (double)(value >> 31);

	// read output[6]: from bit 6 to 6
	value = ((uint32_t)(input[0] & 0x02) << 30);
	output[6] = (double)(value >> 31);

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

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

	uint32_t value;

	// read output[0]: from bit 1 to 1
	value = ((uint32_t)(input[0] & 0x40) << 25);
	output[0] = (double)(value >> 31);

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

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

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

	// read output[4]: from bit 5 to 5
	value = ((uint32_t)(input[0] & 0x04) << 29);
	output[4] = (double)(value >> 31);

	// read output[5]: from bit 6 to 6
	value = ((uint32_t)(input[0] & 0x02) << 30);
	output[5] = (double)(value >> 31);

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

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

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

	uint32_t value;

	// read output[0]: from bit 2 to 2
	value = ((uint32_t)(input[0] & 0x20) << 26);
	output[0] = (double)(value >> 31);

	// read output[1]: from bit 3 to 3
	value = ((uint32_t)(input[0] & 0x10) << 27);
	output[1] = (double)(value >> 31);

	// read output[2]: from bit 4 to 4
	value = ((uint32_t)(input[0] & 0x08) << 28);
	output[2] = (double)(value >> 31);

	// read output[3]: from bit 5 to 5
	value = ((uint32_t)(input[0] & 0x04) << 29);
	output[3] = (double)(value >> 31);

	// read output[4]: from bit 6 to 6
	value = ((uint32_t)(input[0] & 0x02) << 30);
	output[4] = (double)(value >> 31);

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

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

	// read output[7]: from bit 9 to 9
	value = ((uint32_t)(input[1] & 0x40) << 25);
	output[7] = (double)(value >> 31);
}

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

	uint32_t value;

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

	// read output[1]: from bit 4 to 4
	value = ((uint32_t)(input[0] & 0x08) << 28);
	output[1] = (double)(value >> 31);

	// read output[2]: from bit 5 to 5
	value = ((uint32_t)(input[0] & 0x04) << 29);
	output[2] = (double)(value >> 31);

	// read output[3]: from bit 6 to 6
	value = ((uint32_t)(input[0] & 0x02) << 30);
	output[3] = (double)(value >> 31);

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

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

	// read output[6]: from bit 9 to 9
	value = ((uint32_t)(input[1] & 0x40) << 25);
	output[6] = (double)(value >> 31);

	// read output[7]: from bit 10 to 10
	value = ((uint32_t)(input[1] & 0x20) << 26);
	output[7] = (double)(value >> 31);
}

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

	uint32_t value;

	// read output[0]: from bit 4 to 4
	value = ((uint32_t)(input[0] & 0x08) << 28);
	output[0] = (double)(value >> 31);

	// read output[1]: from bit 5 to 5
	value = ((uint32_t)(input[0] & 0x04) << 29);
	output[1] = (double)(value >> 31);

	// read output[2]: from bit 6 to 6
	value = ((uint32_t)(input[0] & 0x02) << 30);
	output[2] = (double)(value >> 31);

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

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

	// read output[5]: from bit 9 to 9
	value = ((uint32_t)(input[1] & 0x40) << 25);
	output[5] = (double)(value >> 31);

	// read output[6]: from bit 10 to 10
	value = ((uint32_t)(input[1] & 0x20) << 26);
	output[6] = (double)(value >> 31);

	// read output[7]: from bit 11 to 11
	value = ((uint32_t)(input[1] & 0x10) << 27);
	output[7] = (double)(value >> 31);
}

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

	uint32_t value;

	// read output[0]: from bit 5 to 5
	value = ((uint32_t)(input[0] & 0x04) << 29);
	output[0] = (double)(value >> 31);

	// read output[1]: from bit 6 to 6
	value = ((uint32_t)(input[0] & 0x02) << 30);
	output[1] = (double)(value >> 31);

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

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

	// read output[4]: from bit 9 to 9
	value = ((uint32_t)(input[1] & 0x40) << 25);
	output[4] = (double)(value >> 31);

	// read output[5]: from bit 10 to 10
	value = ((uint32_t)(input[1] & 0x20) << 26);
	output[5] = (double)(value >> 31);

	// read output[6]: from bit 11 to 11
	value = ((uint32_t)(input[1] & 0x10) << 27);
	output[6] = (double)(value >> 31);

	// read output[7]: from bit 12 to 12
	value = ((uint32_t)(input[1] & 0x08) << 28);
	output[7] = (double)(value >> 31);
}

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

	uint32_t value;

	// read output[0]: from bit 6 to 6
	value = ((uint32_t)(input[0] & 0x02) << 30);
	output[0] = (double)(value >> 31);

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

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

	// read output[3]: from bit 9 to 9
	value = ((uint32_t)(input[1] & 0x40) << 25);
	output[3] = (double)(value >> 31);

	// read output[4]: from bit 10 to 10
	value = ((uint32_t)(input[1] & 0x20) << 26);
	output[4] = (double)(value >> 31);

	// read output[5]: from bit 11 to 11
	value = ((uint32_t)(input[1] & 0x10) << 27);
	output[5] = (double)(value >> 31);

	// read output[6]: from bit 12 to 12
	value = ((uint32_t)(input[1] & 0x08) << 28);
	output[6] = (double)(value >> 31);

	// read output[7]: from bit 13 to 13
	value = ((uint32_t)(input[1] & 0x04) << 29);
	output[7] = (double)(value >> 31);
}

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

	uint32_t value;

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

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

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

	// read output[3]: from bit 10 to 10
	value = ((uint32_t)(input[1] & 0x20) << 26);
	output[3] = (double)(value >> 31);

	// read output[4]: from bit 11 to 11
	value = ((uint32_t)(input[1] & 0x10) << 27);
	output[4] = (double)(value >> 31);

	// read output[5]: from bit 12 to 12
	value = ((uint32_t)(input[1] & 0x08) << 28);
	output[5] = (double)(value >> 31);

	// read output[6]: from bit 13 to 13
	value = ((uint32_t)(input[1] & 0x04) << 29);
	output[6] = (double)(value >> 31);

	// read output[7]: from bit 14 to 14
	value = ((uint32_t)(input[1] & 0x02) << 30);
	output[7] = (double)(value >> 31);
}


unpack_func_t unpack_1bit[UNPACK_1BIT_MAX_COUNT][8][2] = {
	{
		{
			unpack_1_1bit_unsigned_0off,
			NULL,
		},
		{
			unpack_1_1bit_unsigned_1off,
			NULL,
		},
		{
			unpack_1_1bit_unsigned_2off,
			NULL,
		},
		{
			unpack_1_1bit_unsigned_3off,
			NULL,
		},
		{
			unpack_1_1bit_unsigned_4off,
			NULL,
		},
		{
			unpack_1_1bit_unsigned_5off,
			NULL,
		},
		{
			unpack_1_1bit_unsigned_6off,
			NULL,
		},
		{
			unpack_1_1bit_unsigned_7off,
			NULL,
		},
	},
	{
		{
			unpack_2_1bit_unsigned_0off,
			NULL,
		},
		{
			unpack_2_1bit_unsigned_1off,
			NULL,
		},
		{
			unpack_2_1bit_unsigned_2off,
			NULL,
		},
		{
			unpack_2_1bit_unsigned_3off,
			NULL,
		},
		{
			unpack_2_1bit_unsigned_4off,
			NULL,
		},
		{
			unpack_2_1bit_unsigned_5off,
			NULL,
		},
		{
			unpack_2_1bit_unsigned_6off,
			NULL,
		},
		{
			unpack_2_1bit_unsigned_7off,
			NULL,
		},
	},
	{
		{
			unpack_3_1bit_unsigned_0off,
			NULL,
		},
		{
			unpack_3_1bit_unsigned_1off,
			NULL,
		},
		{
			unpack_3_1bit_unsigned_2off,
			NULL,
		},
		{
			unpack_3_1bit_unsigned_3off,
			NULL,
		},
		{
			unpack_3_1bit_unsigned_4off,
			NULL,
		},
		{
			unpack_3_1bit_unsigned_5off,
			NULL,
		},
		{
			unpack_3_1bit_unsigned_6off,
			NULL,
		},
		{
			unpack_3_1bit_unsigned_7off,
			NULL,
		},
	},
	{
		{
			unpack_4_1bit_unsigned_0off,
			NULL,
		},
		{
			unpack_4_1bit_unsigned_1off,
			NULL,
		},
		{
			unpack_4_1bit_unsigned_2off,
			NULL,
		},
		{
			unpack_4_1bit_unsigned_3off,
			NULL,
		},
		{
			unpack_4_1bit_unsigned_4off,
			NULL,
		},
		{
			unpack_4_1bit_unsigned_5off,
			NULL,
		},
		{
			unpack_4_1bit_unsigned_6off,
			NULL,
		},
		{
			unpack_4_1bit_unsigned_7off,
			NULL,
		},
	},
	{
		{
			unpack_5_1bit_unsigned_0off,
			NULL,
		},
		{
			unpack_5_1bit_unsigned_1off,
			NULL,
		},
		{
			unpack_5_1bit_unsigned_2off,
			NULL,
		},
		{
			unpack_5_1bit_unsigned_3off,
			NULL,
		},
		{
			unpack_5_1bit_unsigned_4off,
			NULL,
		},
		{
			unpack_5_1bit_unsigned_5off,
			NULL,
		},
		{
			unpack_5_1bit_unsigned_6off,
			NULL,
		},
		{
			unpack_5_1bit_unsigned_7off,
			NULL,
		},
	},
	{
		{
			unpack_6_1bit_unsigned_0off,
			NULL,
		},
		{
			unpack_6_1bit_unsigned_1off,
			NULL,
		},
		{
			unpack_6_1bit_unsigned_2off,
			NULL,
		},
		{
			unpack_6_1bit_unsigned_3off,
			NULL,
		},
		{
			unpack_6_1bit_unsigned_4off,
			NULL,
		},
		{
			unpack_6_1bit_unsigned_5off,
			NULL,
		},
		{
			unpack_6_1bit_unsigned_6off,
			NULL,
		},
		{
			unpack_6_1bit_unsigned_7off,
			NULL,
		},
	},
	{
		{
			unpack_7_1bit_unsigned_0off,
			NULL,
		},
		{
			unpack_7_1bit_unsigned_1off,
			NULL,
		},
		{
			unpack_7_1bit_unsigned_2off,
			NULL,
		},
		{
			unpack_7_1bit_unsigned_3off,
			NULL,
		},
		{
			unpack_7_1bit_unsigned_4off,
			NULL,
		},
		{
			unpack_7_1bit_unsigned_5off,
			NULL,
		},
		{
			unpack_7_1bit_unsigned_6off,
			NULL,
		},
		{
			unpack_7_1bit_unsigned_7off,
			NULL,
		},
	},
	{
		{
			unpack_8_1bit_unsigned_0off,
			NULL,
		},
		{
			unpack_8_1bit_unsigned_1off,
			NULL,
		},
		{
			unpack_8_1bit_unsigned_2off,
			NULL,
		},
		{
			unpack_8_1bit_unsigned_3off,
			NULL,
		},
		{
			unpack_8_1bit_unsigned_4off,
			NULL,
		},
		{
			unpack_8_1bit_unsigned_5off,
			NULL,
		},
		{
			unpack_8_1bit_unsigned_6off,
			NULL,
		},
		{
			unpack_8_1bit_unsigned_7off,
			NULL,
		},
	},
};
