From 46d42036a47c07b598af784a220ddeeb07ae5f10 Mon Sep 17 00:00:00 2001 From: Alex Barney Date: Wed, 3 Jan 2018 00:02:49 -0700 Subject: [PATCH] Quick and dirty port to C Very direct port from C# version. Same files, function/variable names. Band extension isn't handled. Tables are pre-generated instead of being created at runtime. Extensive testing has not been done. --- C/bit_allocation.c | 119 ++ C/bit_allocation.h | 6 + C/bit_reader.c | 110 ++ C/bit_reader.h | 13 + C/decinit.c | 110 ++ C/decinit.h | 11 + C/decoder.c | 99 ++ C/decoder.h | 10 + C/error_codes.h | 31 + C/huffCodes.c | 27 + C/huffCodes.h | 3186 +++++++++++++++++++++++++++++++++++ C/imdct.c | 80 + C/imdct.h | 6 + C/libatrac9.c | 51 + C/libatrac9.h | 34 + C/libatrac9.sln | 31 + C/libatrac9.vcxproj | 159 ++ C/libatrac9.vcxproj.filters | 96 ++ C/quantization.c | 54 + C/quantization.h | 8 + C/scale_factors.c | 146 ++ C/scale_factors.h | 8 + C/structures.h | 142 ++ C/tables.h | 642 +++++++ C/unpack.c | 328 ++++ C/unpack.h | 20 + C/utility.c | 20 + C/utility.h | 9 + 28 files changed, 5556 insertions(+) create mode 100644 C/bit_allocation.c create mode 100644 C/bit_allocation.h create mode 100644 C/bit_reader.c create mode 100644 C/bit_reader.h create mode 100644 C/decinit.c create mode 100644 C/decinit.h create mode 100644 C/decoder.c create mode 100644 C/decoder.h create mode 100644 C/error_codes.h create mode 100644 C/huffCodes.c create mode 100644 C/huffCodes.h create mode 100644 C/imdct.c create mode 100644 C/imdct.h create mode 100644 C/libatrac9.c create mode 100644 C/libatrac9.h create mode 100644 C/libatrac9.sln create mode 100644 C/libatrac9.vcxproj create mode 100644 C/libatrac9.vcxproj.filters create mode 100644 C/quantization.c create mode 100644 C/quantization.h create mode 100644 C/scale_factors.c create mode 100644 C/scale_factors.h create mode 100644 C/structures.h create mode 100644 C/tables.h create mode 100644 C/unpack.c create mode 100644 C/unpack.h create mode 100644 C/utility.c create mode 100644 C/utility.h diff --git a/C/bit_allocation.c b/C/bit_allocation.c new file mode 100644 index 0000000..2977efc --- /dev/null +++ b/C/bit_allocation.c @@ -0,0 +1,119 @@ +#include "bit_allocation.h" +#include "tables.h" +#include "utility.h" +#include + +at9_status CreateGradient(block* block) +{ + int valueCount = block->GradientEndValue - block->GradientStartValue; + int unitCount = block->GradientEndUnit - block->GradientStartUnit; + + for (int i = 0; i < block->GradientEndUnit; i++) + { + block->Gradient[i] = block->GradientStartValue; + } + + for (int i = block->GradientEndUnit; i <= block->QuantizationUnitCount; i++) + { + block->Gradient[i] = block->GradientEndValue; + } + if (unitCount <= 0) return ERR_SUCCESS; + if (valueCount == 0) return ERR_SUCCESS; + + const unsigned char* curve = GradientCurves[unitCount - 1]; + if (valueCount <= 0) + { + double scale = (-valueCount - 1) / 31.0; + int baseVal = block->GradientStartValue - 1; + for (int i = block->GradientStartUnit; i < block->GradientEndUnit; i++) + { + block->Gradient[i] = baseVal - (int)(curve[i - block->GradientStartUnit] * scale); + } + } + else + { + double scale = (valueCount - 1) / 31.0; + int baseVal = block->GradientStartValue + 1; + for (int i = block->GradientStartUnit; i < block->GradientEndUnit; i++) + { + block->Gradient[i] = baseVal + (int)(curve[i - block->GradientStartUnit] * scale); + } + } + + return ERR_SUCCESS; +} + +void CalculateMask(channel* channel) +{ + memset(channel->PrecisionMask, 0, sizeof(channel->PrecisionMask)); + for (int i = 1; i < channel->Block->QuantizationUnitCount; i++) + { + const int delta = channel->ScaleFactors[i] - channel->ScaleFactors[i - 1]; + if (delta > 1) + { + channel->PrecisionMask[i] += min(delta - 1, 5); + } + else if (delta < -1) + { + channel->PrecisionMask[i - 1] += min(delta * -1 - 1, 5); + } + } +} + +void CalculatePrecisions(channel* channel) +{ + block* block = channel->Block; + + if (block->GradientMode != 0) + { + for (int i = 0; i < block->QuantizationUnitCount; i++) + { + channel->Precisions[i] = channel->ScaleFactors[i] + channel->PrecisionMask[i] - block->Gradient[i]; + if (channel->Precisions[i] > 0) + { + switch (block->GradientMode) + { + case 1: + channel->Precisions[i] /= 2; + break; + case 2: + channel->Precisions[i] = 3 * channel->Precisions[i] / 8; + break; + case 3: + channel->Precisions[i] /= 4; + break; + } + } + } + } + else + { + for (int i = 0; i < block->QuantizationUnitCount; i++) + { + channel->Precisions[i] = channel->ScaleFactors[i] - block->Gradient[i]; + } + } + + for (int i = 0; i < block->QuantizationUnitCount; i++) + { + if (channel->Precisions[i] < 1) + { + channel->Precisions[i] = 1; + } + } + + for (int i = 0; i < block->GradientBoundary; i++) + { + channel->Precisions[i]++; + } + + for (int i = 0; i < block->QuantizationUnitCount; i++) + { + channel->PrecisionsFine[i] = 0; + if (channel->Precisions[i] > 15) + { + channel->PrecisionsFine[i] = channel->Precisions[i] - 15; + channel->Precisions[i] = 15; + } + } +} \ No newline at end of file diff --git a/C/bit_allocation.h b/C/bit_allocation.h new file mode 100644 index 0000000..8ab8ba2 --- /dev/null +++ b/C/bit_allocation.h @@ -0,0 +1,6 @@ +#pragma once +#include "unpack.h" + +at9_status CreateGradient(block* block); +void CalculateMask(channel* channel); +void CalculatePrecisions(channel* channel); diff --git a/C/bit_reader.c b/C/bit_reader.c new file mode 100644 index 0000000..f385305 --- /dev/null +++ b/C/bit_reader.c @@ -0,0 +1,110 @@ +#include "bit_reader.h" +#include "utility.h" + +static int peek_int_fallback(bit_reader_cxt* br, int bit_count); + +void init_bit_reader_cxt(bit_reader_cxt* br, const void * buffer) +{ + br->buffer = buffer; + br->position = 0; +} + +int read_int(bit_reader_cxt* br, const int bits) +{ + const int value = peek_int(br, bits); + br->position += bits; + return value; +} + +int read_signed_int(bit_reader_cxt* br, const int bits) +{ + const int value = peek_int(br, bits); + br->position += bits; + return SignExtend32(value, bits); +} + +int read_offset_binary(bit_reader_cxt* br, const int bits) +{ + const int offset = 1 << (bits - 1); + const int value = peek_int(br, bits) - offset; + br->position += bits; + return value; +} + +int peek_int(bit_reader_cxt* br, const int bits) +{ + const int byte_index = br->position / 8; + const int bit_index = br->position % 8; + const unsigned char* buffer = br->buffer; + + if (bits <= 9) + { + int value = buffer[byte_index] << 8 | buffer[byte_index + 1]; + value &= 0xFFFF >> bit_index; + value >>= 16 - bits - bit_index; + return value; + } + + if (bits <= 17) + { + int value = buffer[byte_index] << 16 | buffer[byte_index + 1] << 8 | buffer[byte_index + 2]; + value &= 0xFFFFFF >> bit_index; + value >>= 24 - bits - bit_index; + return value; + } + + if (bits <= 25) + { + int value = buffer[byte_index] << 24 + | buffer[byte_index + 1] << 16 + | buffer[byte_index + 2] << 8 + | buffer[byte_index + 3]; + + value &= (int)(0xFFFFFFFF >> bit_index); + value >>= 32 - bits - bit_index; + return value; + } + return peek_int_fallback(br, bits); +} + +void align_position(bit_reader_cxt* br, const unsigned int multiple) +{ + const int position = br->position; + if (position % multiple == 0) + { + return; + } + + br->position = position + multiple - position % multiple; +} + +static int peek_int_fallback(bit_reader_cxt* br, int bit_count) +{ + int value = 0; + int byte_index = br->position / 8; + int bit_index = br->position % 8; + const unsigned char* buffer = br->buffer; + + while (bit_count > 0) + { + if (bit_index >= 8) + { + bit_index = 0; + byte_index++; + } + + int bits_to_read = bit_count; + if (bits_to_read > 8 - bit_index) + { + bits_to_read = 8 - bit_index; + } + + const int mask = 0xFF >> bit_index; + const int current_byte = (mask & buffer[byte_index]) >> (8 - bit_index - bits_to_read); + + value = (value << bits_to_read) | current_byte; + bit_index += bits_to_read; + bit_count -= bits_to_read; + } + return value; +} \ No newline at end of file diff --git a/C/bit_reader.h b/C/bit_reader.h new file mode 100644 index 0000000..bcec9d4 --- /dev/null +++ b/C/bit_reader.h @@ -0,0 +1,13 @@ +#pragma once + +typedef struct { + const unsigned char * buffer; + int position; +} bit_reader_cxt; + +void init_bit_reader_cxt(bit_reader_cxt* br, const void * buffer); +int peek_int(bit_reader_cxt* br, const int bits); +int read_int(bit_reader_cxt* br, const int bits); +int read_signed_int(bit_reader_cxt* br, const int bits); +int read_offset_binary(bit_reader_cxt* br, const int bits); +void align_position(bit_reader_cxt* br, const unsigned int multiple); \ No newline at end of file diff --git a/C/decinit.c b/C/decinit.c new file mode 100644 index 0000000..cba8529 --- /dev/null +++ b/C/decinit.c @@ -0,0 +1,110 @@ +#include "bit_reader.h" +#include "decinit.h" +#include "error_codes.h" +#include "structures.h" +#include "tables.h" +#include + +static int BlockTypeToChannelCount(BlockType block_type); + +at9_status init_decoder(atrac9_handle* handle, unsigned char* config_data, int wlength) +{ + ERROR_CHECK(init_config_data(&handle->config, config_data)); + ERROR_CHECK(init_frame(handle)); + handle->wlength = wlength; + handle->initialized = 1; + return ERR_SUCCESS; +} + +at9_status init_config_data(ConfigData* config, unsigned char* config_data) +{ + memcpy(config->ConfigData, config_data, CONFIG_DATA_SIZE); + ERROR_CHECK(read_config_data(config)); + + config->FramesPerSuperframe = 1 << config->SuperframeIndex; + config->SuperframeBytes = config->FrameBytes << config->SuperframeIndex; + + config->ChannelConfig = ChannelConfigs[config->ChannelConfigIndex]; + config->ChannelCount = config->ChannelConfig.ChannelCount; + config->SampleRate = SampleRates[config->SampleRateIndex]; + config->HighSampleRate = config->SampleRateIndex > 7; + config->FrameSamplesPower = SamplingRateIndexToFrameSamplesPower[config->SampleRateIndex]; + config->FrameSamples = 1 << config->FrameSamplesPower; + config->SuperframeSamples = config->FrameSamples * config->FramesPerSuperframe; + + return ERR_SUCCESS; +} + +at9_status read_config_data(ConfigData* config) +{ + bit_reader_cxt br; + init_bit_reader_cxt(&br, &config->ConfigData); + + const int header = read_int(&br, 8); + config->SampleRateIndex = read_int(&br, 4); + config->ChannelConfigIndex = read_int(&br, 3); + const int validation_bit = read_int(&br, 1); + config->FrameBytes = read_int(&br, 11) + 1; + config->SuperframeIndex = read_int(&br, 2); + + if (header != 0xFE || validation_bit != 0) + { + return ERR_BAD_CONFIG_DATA; + } + + return ERR_SUCCESS; +} + +at9_status init_frame(atrac9_handle* handle) +{ + const int block_count = handle->config.ChannelConfig.BlockCount; + handle->frame.config = &handle->config; + + for (int i = 0; i < block_count; i++) + { + ERROR_CHECK(init_block(&handle->frame.Blocks[i], &handle->frame, i)); + } + + return ERR_SUCCESS; +} + +at9_status init_block(block* block, frame* parent_frame, int block_index) +{ + block->Frame = parent_frame; + block->BlockIndex = block_index; + block->config = parent_frame->config; + block->BlockType = block->config->ChannelConfig.Types[block_index]; + block->ChannelCount = BlockTypeToChannelCount(block->BlockType); + + for (int i = 0; i < block->ChannelCount; i++) + { + ERROR_CHECK(init_channel(&block->Channels[i], block, i)); + } + + return ERR_SUCCESS; +} + +at9_status init_channel(channel* channel, block* parent_block, int channel_index) +{ + channel->Block = parent_block; + channel->Frame = parent_block->Frame; + channel->config = parent_block->config; + channel->ChannelIndex = channel_index; + channel->mdct.bits = parent_block->config->FrameSamplesPower; + return ERR_SUCCESS; +} + +static int BlockTypeToChannelCount(BlockType block_type) +{ + switch (block_type) + { + case Mono: + return 1; + case Stereo: + return 2; + case LFE: + return 1; + default: + return 0; + } +} diff --git a/C/decinit.h b/C/decinit.h new file mode 100644 index 0000000..949726d --- /dev/null +++ b/C/decinit.h @@ -0,0 +1,11 @@ +#pragma once + +#include "error_codes.h" +#include "structures.h" + +at9_status init_decoder(atrac9_handle* handle, unsigned char * config_data, int wlength); +at9_status init_config_data(ConfigData* config, unsigned char * config_data); +at9_status read_config_data(ConfigData* config); +at9_status init_frame(atrac9_handle* handle); +at9_status init_block(block* block, frame* parent_frame, int block_index); +at9_status init_channel(channel* channel, block* parent_block, int channel_index); \ No newline at end of file diff --git a/C/decoder.c b/C/decoder.c new file mode 100644 index 0000000..aa85372 --- /dev/null +++ b/C/decoder.c @@ -0,0 +1,99 @@ +#include "decoder.h" +#include "unpack.h" +#include "quantization.h" +#include "tables.h" +#include "imdct.h" +#include +#include "utility.h" + +at9_status Decode(atrac9_handle* handle, const unsigned char* audio, unsigned char* pcm, int* bytesUsed) +{ + handle->frame.frameNum++; + bit_reader_cxt br; + init_bit_reader_cxt(&br, audio); + ERROR_CHECK(DecodeFrame(&handle->frame, &br)); + + PcmFloatToShort(&handle->frame, (short*)pcm); + + + *bytesUsed = br.position / 8; + return ERR_SUCCESS; +} + +at9_status DecodeFrame(frame* frame, bit_reader_cxt* br) +{ + ERROR_CHECK(UnpackFrame(frame, br)); + + for (int i = 0; i < frame->config->ChannelConfig.BlockCount; i++) + { + block* block = &frame->Blocks[i]; + + DequantizeSpectra(block); + ApplyIntensityStereo(block); + ScaleSpectrumBlock(block); + ImdctBlock(block); + } + + return ERR_SUCCESS; +} + +void PcmFloatToShort(frame* frame, short* pcmOut) +{ + const int endSample = frame->config->FrameSamples; + short* dest = pcmOut; + for (int d = 0, s = 0; s < endSample; d++, s++) + { + for (int i = 0; i < frame->config->ChannelConfig.BlockCount; i++) + { + block* block = &frame->Blocks[i]; + + for (int j = 0; j < block->ChannelCount; j++) + { + channel* channel = &block->Channels[j]; + double* pcmSrc = channel->Pcm; + + const double sample = pcmSrc[d]; + const int roundedSample = (int)floor(sample + 0.5); + *dest++ = Clamp16(roundedSample); + } + } + } +} + +void ImdctBlock(block* block) +{ + for (int i = 0; i < block->ChannelCount; i++) + { + channel* channel = &block->Channels[i]; + + RunImdct(&channel->mdct, channel->Spectra, channel->Pcm); + } +} + +void ApplyIntensityStereo(block* block) +{ + if (block->BlockType != Stereo) return; + + const int totalUnits = block->QuantizationUnitCount; + const int stereoUnits = block->StereoQuantizationUnit; + if (stereoUnits >= totalUnits) return; + + channel* source = &block->Channels[block->PrimaryChannelIndex == 0 ? 0 : 1]; + channel* dest = &block->Channels[block->PrimaryChannelIndex == 0 ? 1 : 0]; + + for (int i = stereoUnits; i < totalUnits; i++) + { + const int sign = block->JointStereoSigns[i]; + for (int sb = QuantUnitToCoeffIndex[i]; sb < QuantUnitToCoeffIndex[i + 1]; sb++) + { + if (sign > 0) + { + dest->Spectra[sb] = -source->Spectra[sb]; + } + else + { + dest->Spectra[sb] = source->Spectra[sb]; + } + } + } +} diff --git a/C/decoder.h b/C/decoder.h new file mode 100644 index 0000000..ed17060 --- /dev/null +++ b/C/decoder.h @@ -0,0 +1,10 @@ +#pragma once +#include "bit_reader.h" +#include "error_codes.h" +#include "structures.h" + +at9_status Decode(atrac9_handle* handle, const unsigned char* audio, unsigned char* pcm, int* bytesUsed); +at9_status DecodeFrame(frame* frame, bit_reader_cxt* br); +void ImdctBlock(block* block); +void ApplyIntensityStereo(block* block); +void PcmFloatToShort(frame* frame, short* pcmOut); \ No newline at end of file diff --git a/C/error_codes.h b/C/error_codes.h new file mode 100644 index 0000000..d1086d3 --- /dev/null +++ b/C/error_codes.h @@ -0,0 +1,31 @@ +#pragma once + +typedef enum at9_status +{ + ERR_SUCCESS = 0, + + ERR_NOT_IMPLEMENTED = 0x80000000, + + ERR_BAD_CONFIG_DATA = 0x81000000, + + ERR_UNPACK_SUPERFRAME_FLAG_INVALID = 0x82000000, + ERR_UNPACK_REUSE_BAND_PARAMS_INVALID, + ERR_UNPACK_BAND_PARAMS_INVALID, + + ERR_UNPACK_GRAD_BOUNDARY_INVALID = 0x82100000, + ERR_UNPACK_GRAD_START_UNIT_OOB, + ERR_UNPACK_GRAD_END_UNIT_OOB, + ERR_UNPACK_GRAD_START_VALUE_OOB, + ERR_UNPACK_GRAD_END_VALUE_OOB, + ERR_UNPACK_GRAD_END_UNIT_INVALID, // start_unit > end_unit + + ERR_UNPACK_SCALE_FACTOR_MODE_INVALID, + ERR_UNPACK_SCALE_FACTOR_OOB +} at9_status; + +#define ERROR_CHECK(x) do { \ + at9_status status = (x); \ + if (status != ERR_SUCCESS) { \ + return status; \ + } \ +} while (0) \ No newline at end of file diff --git a/C/huffCodes.c b/C/huffCodes.c new file mode 100644 index 0000000..a34c5ee --- /dev/null +++ b/C/huffCodes.c @@ -0,0 +1,27 @@ +#include "huffCodes.h" +#include "utility.h" + +int ReadHuffmanValue(const HuffmanCodebook* huff, bit_reader_cxt* br, int is_signed) +{ + const int code = peek_int(br, huff->MaxBitSize); + const unsigned char value = huff->Lookup[code]; + const int bits = huff->Bits[value]; + br->position += bits; + return is_signed ? SignExtend32(value, huff->ValueBits) : value; +} + +void DecodeHuffmanValues(int* spectrum, int index, int bandCount, const HuffmanCodebook* huff, const int* values) +{ + const int valueCount = bandCount >> huff->ValueCountPower; + const int mask = (1 << huff->ValueBits) - 1; + + for (int i = 0; i < valueCount; i++) + { + int value = values[i]; + for (int j = 0; j < huff->ValueCount; j++) + { + spectrum[index++] = SignExtend32(value & mask, huff->ValueBits); + value >>= huff->ValueBits; + } + } +} \ No newline at end of file diff --git a/C/huffCodes.h b/C/huffCodes.h new file mode 100644 index 0000000..ecef5d0 --- /dev/null +++ b/C/huffCodes.h @@ -0,0 +1,3186 @@ +#pragma once +#include +#include "bit_reader.h" + +typedef struct +{ + const unsigned char* Bits; + const short* Codes; + const unsigned char* Lookup; + int ValueCount; + int ValueCountPower; + int ValueBits; + int ValueMax; + int MaxBitSize; +} HuffmanCodebook; + +int ReadHuffmanValue(const HuffmanCodebook* huff, bit_reader_cxt* br, int is_signed); +void DecodeHuffmanValues(int* spectrum, int index, int bandCount, const HuffmanCodebook* huff, const int* values); + +static const uint8_t ScaleFactorsA1Bits[] = +{ + 1, 1 +}; + +static const uint16_t ScaleFactorsA1Codes[] = +{ + 0x00, 0x01 +}; + +static const uint8_t ScaleFactorsA2Bits[] = +{ + 1, 3, 3, 2 +}; + +static const uint16_t ScaleFactorsA2Codes[] = +{ + 0x00, 0x06, 0x07, 0x02 +}; + +static const uint8_t ScaleFactorsA3Bits[] = +{ + 2, 2, 4, 6, 6, 5, 3, 2 +}; + +static const uint16_t ScaleFactorsA3Codes[] = +{ + 0x00, 0x01, 0x0E, 0x3E, 0x3F, 0x1E, 0x06, 0x02 +}; + +static const uint8_t ScaleFactorsA4Bits[] = +{ + 2, 2, 4, 5, 6, 7, 8, 8, 8, 8, 8, 8, 6, 5, 4, 2 +}; + +static const uint16_t ScaleFactorsA4Codes[] = +{ + 0x01, 0x02, 0x00, 0x06, 0x0F, 0x13, 0x23, 0x24, 0x25, 0x22, 0x21, 0x20, 0x0E, 0x05, 0x01, 0x03 +}; + +static const uint8_t ScaleFactorsA5Bits[] = +{ + 2, 3, 3, 4, 5, 5, 6, 7, 7, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 6, 5, 5, 4, 3 +}; + +static const uint16_t ScaleFactorsA5Codes[] = +{ + 0x02, 0x01, 0x07, 0x0D, 0x0C, 0x18, 0x1B, 0x21, 0x3F, 0x6A, 0x6B, 0x68, 0x73, 0x79, 0x7C, 0x7D, + 0x7A, 0x7B, 0x78, 0x72, 0x44, 0x45, 0x47, 0x46, 0x69, 0x38, 0x20, 0x1D, 0x19, 0x09, 0x05, 0x00 +}; + +static const uint8_t ScaleFactorsA6Bits[] = +{ + 3, 3, 4, 4, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 7, 7, 7, 6, 6, 5, 5, 5, 4, 4, 4 +}; + +static const uint16_t ScaleFactorsA6Codes[] = +{ + 0x00, 0x01, 0x04, 0x05, 0x12, 0x13, 0x2E, 0x2F, 0x30, 0x66, 0x67, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, + 0xDB, 0xDC, 0xDD, 0xDE, 0xDF, 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, + 0xEB, 0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, + 0xFB, 0xFC, 0xFD, 0xFE, 0xFF, 0x68, 0x69, 0x6A, 0x31, 0x32, 0x14, 0x15, 0x16, 0x06, 0x07, 0x08 +}; + +static const uint8_t ScaleFactorsB2Bits[] = +{ + 1, 2, 0, 2 +}; + +static const uint16_t ScaleFactorsB2Codes[] = +{ + 0x00, 0x03, 0x00, 0x02 +}; + +static const uint8_t ScaleFactorsB3Bits[] = +{ + 1, 3, 5, 6, 0, 6, 4, 2 +}; + +static const uint16_t ScaleFactorsB3Codes[] = +{ + 0x01, 0x00, 0x04, 0x0B, 0x00, 0x0A, 0x03, 0x01 +}; + +static const uint8_t ScaleFactorsB4Bits[] = +{ + 1, 3, 4, 5, 5, 7, 8, 8, 0, 8, 8, 7, 6, 6, 4, 3 +}; + +static const uint16_t ScaleFactorsB4Codes[] = +{ + 0x01, 0x01, 0x04, 0x0E, 0x0F, 0x2C, 0x5A, 0x5D, 0x00, 0x5C, 0x5B, 0x2F, 0x15, 0x14, 0x06, 0x00 +}; + +static const uint8_t ScaleFactorsB5Bits[] = +{ + 3, 3, 4, 4, 4, 4, 4, 4, 4, 5, 6, 7, 7, 7, 8, 8, + 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 3 +}; + +static const uint16_t ScaleFactorsB5Codes[] = +{ + 0x00, 0x05, 0x07, 0x0C, 0x04, 0x02, 0x03, 0x05, 0x09, 0x10, 0x23, 0x33, 0x36, 0x6E, 0x60, 0x65, + 0x62, 0x61, 0x63, 0x64, 0x6F, 0x6D, 0x6C, 0x6B, 0x6A, 0x68, 0x69, 0x45, 0x44, 0x37, 0x1A, 0x07 +}; + +static const uint8_t SpectrumA21Bits[] = +{ + 0, 3, 0, 3, 3, 3, 0, 3, 0, 0, 0, 0, 3, 3, 0, 3 +}; + +static const uint16_t SpectrumA21Codes[] = +{ + 0x00, 0x00, 0x00, 0x01, 0x03, 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x06 +}; + +static const uint8_t SpectrumA22Bits[] = +{ + 0, 4, 0, 4, 5, 6, 0, 6, 0, 0, 0, 0, 5, 6, 0, 6, + 5, 6, 0, 6, 6, 7, 0, 7, 0, 0, 0, 0, 6, 7, 0, 7, + 0, 0, 0, 0, 0, 0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, 0x27, + 0x16, 0x14, 0x00, 0x17, 0x76, 0x06, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x35, 0x64, 0x00, 0x6F, + 0x26, 0x04, 0x00, 0x63, 0x22, 0xA2, 0x00, 0x97, 0x00, 0x00, 0x00, 0x00, 0x67, 0xA0, 0x00, 0x0D, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x2B, 0x52, 0x00, 0x0B, 0x20, 0x92, 0x00, 0x91, 0x00, 0x00, 0x00, 0x00, 0x61, 0x0E, 0x00, 0x95, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x17, 0x16, 0x00, 0x15, 0x34, 0x6E, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x77, 0x08, 0x00, 0x07, + 0x2A, 0x0A, 0x00, 0x53, 0x60, 0x94, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x21, 0x90, 0x00, 0x93, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x27, 0x62, 0x00, 0x05, 0x66, 0x0C, 0x00, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x23, 0x96, 0x00, 0xA3 +}; + +static const uint8_t SpectrumA23Bits[] = +{ + 3, 4, 0, 4, 5, 6, 0, 6, 0, 0, 0, 0, 5, 6, 0, 6, + 5, 7, 0, 6, 6, 8, 0, 7, 0, 0, 0, 0, 6, 8, 0, 7, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 5, 6, 0, 7, 6, 7, 0, 8, 0, 0, 0, 0, 6, 7, 0, 8, + 5, 6, 0, 6, 7, 8, 0, 8, 0, 0, 0, 0, 6, 7, 0, 7, + 6, 8, 0, 7, 8, 9, 0, 9, 0, 0, 0, 0, 7, 9, 0, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 6, 8, 0, 8, 8, 9, 0, 9, 0, 0, 0, 0, 7, 8, 0, 9, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 5, 6, 0, 6, 6, 7, 0, 7, 0, 0, 0, 0, 7, 8, 0, 8, + 6, 8, 0, 8, 7, 9, 0, 8, 0, 0, 0, 0, 8, 9, 0, 9, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 6, 7, 0, 8, 7, 8, 0, 9, 0, 0, 0, 0, 8, 9, 0, 9 +}; + +static const uint16_t SpectrumA23Codes[] = +{ + 0x006, 0x002, 0x000, 0x003, 0x016, 0x01E, 0x000, 0x021, 0x000, 0x000, 0x000, 0x000, + 0x017, 0x020, 0x000, 0x01F, 0x01C, 0x054, 0x000, 0x027, 0x010, 0x0A6, 0x000, 0x027, + 0x000, 0x000, 0x000, 0x000, 0x015, 0x0A4, 0x000, 0x02D, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x01D, 0x026, 0x000, 0x055, 0x014, 0x02C, 0x000, 0x0A5, 0x000, 0x000, 0x000, 0x000, + 0x011, 0x026, 0x000, 0x0A7, 0x01E, 0x000, 0x000, 0x003, 0x04A, 0x074, 0x000, 0x071, + 0x000, 0x000, 0x000, 0x000, 0x023, 0x00A, 0x000, 0x009, 0x018, 0x072, 0x000, 0x00D, + 0x0A2, 0x15A, 0x000, 0x123, 0x000, 0x000, 0x000, 0x000, 0x00F, 0x158, 0x000, 0x05D, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x01B, 0x0AE, 0x000, 0x077, 0x092, 0x140, 0x000, 0x121, + 0x000, 0x000, 0x000, 0x000, 0x025, 0x05E, 0x000, 0x143, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x01F, 0x002, 0x000, 0x001, 0x022, 0x008, 0x000, 0x00B, 0x000, 0x000, 0x000, 0x000, + 0x04B, 0x070, 0x000, 0x075, 0x01A, 0x076, 0x000, 0x0AF, 0x024, 0x142, 0x000, 0x05F, + 0x000, 0x000, 0x000, 0x000, 0x093, 0x120, 0x000, 0x141, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x019, 0x00C, 0x000, 0x073, 0x00E, 0x05C, 0x000, 0x159, 0x000, 0x000, 0x000, 0x000, + 0x0A3, 0x122, 0x000, 0x15B +}; + +static const uint8_t SpectrumA24Bits[] = +{ + 2, 4, 0, 4, 5, 6, 0, 6, 0, 0, 0, 0, 5, 6, 0, 6, + 5, 7, 0, 6, 6, 8, 0, 8, 0, 0, 0, 0, 6, 8, 0, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 5, 6, 0, 7, 6, 8, 0, 8, 0, 0, 0, 0, 6, 8, 0, 8, + 5, 7, 0, 7, 7, 9, 0, 9, 0, 0, 0, 0, 6, 8, 0, 8, + 6, 9, 0, 8, 8, 10, 0, 10, 0, 0, 0, 0, 8, 10, 0, 9, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 6, 8, 0, 9, 9, 10, 0, 10, 0, 0, 0, 0, 8, 9, 0, 10, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 5, 7, 0, 7, 6, 8, 0, 8, 0, 0, 0, 0, 7, 9, 0, 9, + 6, 9, 0, 8, 8, 10, 0, 9, 0, 0, 0, 0, 9, 10, 0, 10, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 6, 8, 0, 9, 8, 9, 0, 10, 0, 0, 0, 0, 8, 10, 0, 10 +}; + +static const uint16_t SpectrumA24Codes[] = +{ + 0x002, 0x002, 0x000, 0x003, 0x01E, 0x010, 0x000, 0x013, 0x000, 0x000, 0x000, 0x000, + 0x01F, 0x012, 0x000, 0x011, 0x01A, 0x030, 0x000, 0x01B, 0x000, 0x064, 0x000, 0x0C1, + 0x000, 0x000, 0x000, 0x000, 0x003, 0x052, 0x000, 0x07D, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x01B, 0x01A, 0x000, 0x031, 0x002, 0x07C, 0x000, 0x053, 0x000, 0x000, 0x000, 0x000, + 0x001, 0x0C0, 0x000, 0x065, 0x01C, 0x062, 0x000, 0x065, 0x02A, 0x198, 0x000, 0x19B, + 0x000, 0x000, 0x000, 0x000, 0x017, 0x078, 0x000, 0x07B, 0x004, 0x0FE, 0x000, 0x077, + 0x050, 0x33A, 0x000, 0x1F9, 0x000, 0x000, 0x000, 0x000, 0x073, 0x338, 0x000, 0x0E1, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x007, 0x066, 0x000, 0x187, 0x19E, 0x308, 0x000, 0x30B, + 0x000, 0x000, 0x000, 0x000, 0x075, 0x0E2, 0x000, 0x1FB, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x01D, 0x064, 0x000, 0x063, 0x016, 0x07A, 0x000, 0x079, 0x000, 0x000, 0x000, 0x000, + 0x02B, 0x19A, 0x000, 0x199, 0x006, 0x186, 0x000, 0x067, 0x074, 0x1FA, 0x000, 0x0E3, + 0x000, 0x000, 0x000, 0x000, 0x19F, 0x30A, 0x000, 0x309, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x005, 0x076, 0x000, 0x0FF, 0x072, 0x0E0, 0x000, 0x339, 0x000, 0x000, 0x000, 0x000, + 0x051, 0x1F8, 0x000, 0x33B +}; + +static const uint8_t SpectrumA31Bits[] = +{ + 0, 0, 4, 5, 0, 5, 4, 0, 0, 0, 5, 5, 0, 5, 5, 0, + 5, 5, 6, 6, 0, 6, 5, 5, 5, 6, 6, 7, 0, 7, 6, 6, + 0, 0, 0, 0, 0, 0, 0, 0, 5, 6, 6, 7, 0, 7, 6, 6, + 5, 5, 5, 6, 0, 6, 6, 5, 0, 0, 5, 5, 0, 5, 5, 0 +}; + +static const uint16_t SpectrumA31Codes[] = +{ + 0x00, 0x00, 0x02, 0x18, 0x00, 0x19, 0x03, 0x00, 0x00, 0x00, 0x12, 0x02, 0x00, 0x09, 0x15, 0x00, + 0x1A, 0x0A, 0x3E, 0x2C, 0x00, 0x2F, 0x01, 0x0D, 0x0E, 0x38, 0x20, 0x78, 0x00, 0x7B, 0x23, 0x3B, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x3A, 0x22, 0x7A, 0x00, 0x79, 0x21, 0x39, + 0x1B, 0x0C, 0x00, 0x2E, 0x00, 0x2D, 0x3F, 0x0B, 0x00, 0x00, 0x14, 0x08, 0x00, 0x03, 0x13, 0x00 +}; + +static const uint8_t SpectrumA32Bits[] = +{ + 4, 5, 5, 6, 0, 6, 5, 5, 5, 6, 5, 6, 0, 6, 5, 5, + 5, 5, 6, 7, 0, 7, 6, 5, 6, 6, 7, 7, 0, 7, 7, 6, + 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 7, 7, 0, 7, 7, 6, + 5, 5, 6, 7, 0, 7, 6, 5, 5, 5, 5, 6, 0, 6, 5, 6 +}; + +static const uint16_t SpectrumA32Codes[] = +{ + 0x0D, 0x18, 0x16, 0x3A, 0x00, 0x3B, 0x17, 0x19, 0x12, 0x3E, 0x08, 0x1C, 0x00, 0x1B, 0x07, 0x01, + 0x10, 0x02, 0x28, 0x78, 0x00, 0x7B, 0x1F, 0x05, 0x2A, 0x16, 0x72, 0x2A, 0x00, 0x29, 0x71, 0x19, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2B, 0x18, 0x70, 0x28, 0x00, 0x2B, 0x73, 0x17, + 0x11, 0x04, 0x1E, 0x7A, 0x00, 0x79, 0x29, 0x03, 0x13, 0x00, 0x06, 0x1A, 0x00, 0x1D, 0x09, 0x3F +}; + +static const uint8_t SpectrumA33Bits[] = +{ + 3, 4, 5, 6, 0, 6, 5, 4, 4, 5, 6, 7, 0, 7, 6, 5, + 5, 6, 6, 7, 0, 7, 6, 6, 6, 7, 8, 8, 0, 8, 8, 7, + 0, 0, 0, 0, 0, 0, 0, 0, 6, 7, 8, 8, 0, 8, 8, 7, + 5, 6, 6, 7, 0, 7, 6, 6, 4, 5, 6, 7, 0, 7, 6, 5 +}; + +static const uint16_t SpectrumA33Codes[] = +{ + 0x05, 0x06, 0x10, 0x08, 0x00, 0x09, 0x11, 0x07, 0x04, 0x12, 0x3E, 0x6A, 0x00, 0x6D, 0x3D, 0x19, + 0x06, 0x3A, 0x06, 0x02, 0x00, 0x01, 0x05, 0x39, 0x02, 0x16, 0xDC, 0x2A, 0x00, 0x29, 0xDF, 0x69, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x68, 0xDE, 0x28, 0x00, 0x2B, 0xDD, 0x17, + 0x07, 0x38, 0x04, 0x00, 0x00, 0x03, 0x07, 0x3B, 0x05, 0x18, 0x3C, 0x6C, 0x00, 0x6B, 0x3F, 0x13 +}; + +static const uint8_t SpectrumA34Bits[] = +{ + 2, 4, 5, 7, 0, 7, 5, 4, 4, 5, 6, 8, 0, 8, 6, 5, + 5, 6, 7, 8, 0, 8, 7, 6, 7, 8, 8, 10, 0, 10, 9, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 7, 8, 9, 10, 0, 10, 8, 8, + 5, 6, 7, 8, 0, 8, 7, 6, 4, 5, 6, 8, 0, 8, 6, 5 +}; + +static const uint16_t SpectrumA34Codes[] = +{ + 0x000, 0x00A, 0x00A, 0x034, 0x000, 0x035, 0x00B, 0x00B, 0x008, 0x01C, 0x032, 0x0DA, + 0x000, 0x0DD, 0x035, 0x01F, 0x008, 0x01E, 0x03A, 0x06C, 0x000, 0x063, 0x039, 0x031, + 0x032, 0x06E, 0x060, 0x37A, 0x000, 0x379, 0x1BF, 0x0D9, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x033, 0x0D8, 0x1BE, 0x378, 0x000, 0x37B, 0x061, 0x06F, + 0x009, 0x030, 0x038, 0x062, 0x000, 0x06D, 0x03B, 0x01F, 0x009, 0x01E, 0x034, 0x0DC, + 0x000, 0x0DB, 0x033, 0x01D +}; + +static const uint8_t SpectrumA41Bits[] = +{ + 0, 0, 0, 0, 6, 6, 7, 7, 0, 7, 7, 6, 6, 0, 0, 0, + 0, 0, 0, 0, 7, 7, 7, 7, 0, 7, 7, 7, 6, 0, 0, 0, + 0, 0, 0, 0, 7, 7, 7, 8, 0, 8, 7, 7, 7, 0, 0, 0, + 0, 0, 0, 0, 7, 7, 8, 8, 0, 8, 8, 7, 7, 0, 0, 0, + 7, 7, 7, 8, 7, 8, 8, 8, 0, 8, 8, 8, 7, 8, 7, 7, + 7, 7, 7, 7, 8, 8, 8, 9, 0, 8, 8, 8, 8, 7, 7, 7, + 7, 7, 8, 8, 8, 8, 9, 9, 0, 9, 8, 8, 8, 8, 8, 7, + 8, 8, 8, 8, 8, 9, 9, 9, 0, 9, 9, 9, 8, 8, 8, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 8, 8, 8, 8, 8, 9, 9, 9, 0, 9, 9, 9, 8, 8, 8, 8, + 7, 7, 8, 8, 8, 8, 8, 9, 0, 9, 9, 8, 8, 8, 8, 7, + 7, 7, 7, 7, 8, 8, 8, 8, 0, 9, 8, 8, 8, 7, 7, 7, + 7, 7, 7, 8, 7, 8, 8, 8, 0, 8, 8, 8, 7, 8, 7, 7, + 0, 0, 0, 0, 7, 7, 8, 8, 0, 8, 8, 7, 7, 0, 0, 0, + 0, 0, 0, 0, 7, 7, 7, 8, 0, 8, 7, 7, 7, 0, 0, 0, + 0, 0, 0, 0, 6, 7, 7, 7, 0, 7, 7, 7, 7, 0, 0, 0 +}; + +static const uint16_t SpectrumA41Codes[] = +{ + 0x000, 0x000, 0x000, 0x000, 0x018, 0x00E, 0x05E, 0x028, 0x000, 0x029, 0x05F, 0x00F, + 0x019, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x076, 0x06E, 0x03E, 0x004, + 0x000, 0x017, 0x045, 0x07B, 0x013, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x04A, 0x048, 0x010, 0x0CE, 0x000, 0x0E1, 0x023, 0x055, 0x053, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x008, 0x018, 0x0D6, 0x09E, 0x000, 0x09D, 0x0E5, 0x02B, + 0x01B, 0x000, 0x000, 0x000, 0x07C, 0x05C, 0x038, 0x0FC, 0x002, 0x0D2, 0x09A, 0x05C, + 0x000, 0x06B, 0x0A3, 0x0D9, 0x00F, 0x0FF, 0x03D, 0x061, 0x074, 0x056, 0x036, 0x000, + 0x0CC, 0x08C, 0x058, 0x1E2, 0x000, 0x00F, 0x05F, 0x0A1, 0x0D5, 0x00D, 0x03B, 0x059, + 0x040, 0x014, 0x0DA, 0x0B6, 0x084, 0x040, 0x1E0, 0x196, 0x000, 0x1A1, 0x00D, 0x043, + 0x087, 0x0C7, 0x0E3, 0x00B, 0x0F2, 0x0C4, 0x08E, 0x05A, 0x024, 0x1CC, 0x194, 0x168, + 0x000, 0x16B, 0x1A3, 0x1CF, 0x027, 0x069, 0x099, 0x0C9, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x0F3, 0x0C8, 0x098, 0x068, 0x026, 0x1CE, 0x1A2, 0x16A, 0x000, 0x169, 0x195, 0x1CD, + 0x025, 0x05B, 0x08F, 0x0C5, 0x041, 0x00A, 0x0E2, 0x0C6, 0x086, 0x042, 0x00C, 0x1A0, + 0x000, 0x197, 0x1E1, 0x041, 0x085, 0x0B7, 0x0DB, 0x015, 0x075, 0x058, 0x03A, 0x00C, + 0x0D4, 0x0A0, 0x05E, 0x00E, 0x000, 0x1E3, 0x059, 0x08D, 0x0CD, 0x001, 0x037, 0x057, + 0x07D, 0x060, 0x03C, 0x0FE, 0x00E, 0x0D8, 0x0A2, 0x06A, 0x000, 0x05D, 0x09B, 0x0D3, + 0x003, 0x0FD, 0x039, 0x05D, 0x000, 0x000, 0x000, 0x000, 0x01A, 0x02A, 0x0E4, 0x09C, + 0x000, 0x09F, 0x0D7, 0x019, 0x009, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x052, 0x054, 0x022, 0x0E0, 0x000, 0x0CF, 0x011, 0x049, 0x04B, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x012, 0x07A, 0x044, 0x016, 0x000, 0x005, 0x03F, 0x06F, + 0x077, 0x000, 0x000, 0x000 +}; + +static const uint8_t SpectrumA42Bits[] = +{ + 5, 6, 7, 7, 7, 7, 8, 8, 0, 8, 8, 7, 7, 7, 7, 6, + 6, 7, 7, 8, 7, 7, 8, 8, 0, 8, 8, 7, 7, 8, 7, 7, + 7, 7, 8, 8, 7, 8, 8, 9, 0, 9, 8, 8, 7, 8, 8, 7, + 8, 8, 8, 8, 8, 8, 8, 9, 0, 9, 8, 8, 8, 8, 8, 8, + 7, 7, 7, 8, 8, 8, 9, 9, 0, 9, 9, 8, 8, 8, 7, 7, + 7, 7, 8, 8, 8, 9, 9, 9, 0, 9, 9, 9, 8, 8, 8, 7, + 8, 8, 8, 8, 9, 9, 9, 10, 0, 10, 9, 9, 9, 8, 8, 8, + 8, 8, 9, 9, 9, 9, 10, 10, 0, 10, 10, 9, 9, 9, 9, 9, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 8, 9, 9, 9, 9, 9, 10, 10, 0, 10, 10, 9, 9, 9, 9, 8, + 8, 8, 8, 8, 9, 9, 9, 10, 0, 10, 9, 9, 9, 8, 8, 8, + 7, 7, 8, 8, 8, 9, 9, 9, 0, 9, 9, 9, 8, 8, 8, 7, + 7, 7, 7, 8, 8, 8, 9, 9, 0, 9, 9, 8, 8, 8, 7, 7, + 8, 8, 8, 8, 8, 8, 8, 9, 0, 9, 8, 8, 8, 8, 8, 8, + 7, 7, 8, 8, 7, 8, 8, 9, 0, 9, 8, 8, 7, 8, 8, 7, + 6, 7, 7, 8, 7, 7, 8, 8, 0, 8, 8, 7, 7, 8, 7, 7 +}; + +static const uint16_t SpectrumA42Codes[] = +{ + 0x003, 0x018, 0x058, 0x000, 0x066, 0x03C, 0x0D6, 0x07C, 0x000, 0x07D, 0x0D7, 0x03D, + 0x067, 0x001, 0x059, 0x019, 0x002, 0x064, 0x036, 0x0DA, 0x04C, 0x01C, 0x0BE, 0x02C, + 0x000, 0x037, 0x0C5, 0x029, 0x04B, 0x0E7, 0x03B, 0x069, 0x044, 0x02E, 0x0FA, 0x092, + 0x020, 0x0F8, 0x086, 0x1FC, 0x000, 0x1E7, 0x07F, 0x0F5, 0x023, 0x0AD, 0x0FD, 0x02D, + 0x0F6, 0x0DC, 0x09C, 0x03E, 0x0F0, 0x0B6, 0x026, 0x186, 0x000, 0x18D, 0x02F, 0x0B5, + 0x0E1, 0x03D, 0x0AF, 0x0D9, 0x054, 0x040, 0x014, 0x0EC, 0x0BC, 0x054, 0x1C6, 0x108, + 0x000, 0x10B, 0x1C5, 0x069, 0x0B9, 0x0DF, 0x019, 0x047, 0x026, 0x008, 0x0E4, 0x0A2, + 0x056, 0x1DC, 0x142, 0x06A, 0x000, 0x091, 0x123, 0x1DF, 0x04B, 0x0A7, 0x0EB, 0x00B, + 0x0C0, 0x09E, 0x06A, 0x022, 0x1AA, 0x140, 0x092, 0x3CA, 0x000, 0x3A7, 0x04B, 0x121, + 0x18F, 0x007, 0x071, 0x0A5, 0x020, 0x004, 0x1A8, 0x174, 0x0E4, 0x068, 0x3A4, 0x2EE, + 0x000, 0x2ED, 0x3C9, 0x049, 0x0E7, 0x185, 0x1D1, 0x1FF, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x021, 0x1FE, 0x1D0, 0x184, 0x0E6, 0x048, 0x3C8, 0x2EC, 0x000, 0x2EF, 0x3A5, 0x069, + 0x0E5, 0x175, 0x1A9, 0x005, 0x0C1, 0x0A4, 0x070, 0x006, 0x18E, 0x120, 0x04A, 0x3A6, + 0x000, 0x3CB, 0x093, 0x141, 0x1AB, 0x023, 0x06B, 0x09F, 0x027, 0x00A, 0x0EA, 0x0A6, + 0x04A, 0x1DE, 0x122, 0x090, 0x000, 0x06B, 0x143, 0x1DD, 0x057, 0x0A3, 0x0E5, 0x009, + 0x055, 0x046, 0x018, 0x0DE, 0x0B8, 0x068, 0x1C4, 0x10A, 0x000, 0x109, 0x1C7, 0x055, + 0x0BD, 0x0ED, 0x015, 0x041, 0x0F7, 0x0D8, 0x0AE, 0x03C, 0x0E0, 0x0B4, 0x02E, 0x18C, + 0x000, 0x187, 0x027, 0x0B7, 0x0F1, 0x03F, 0x09D, 0x0DD, 0x045, 0x02C, 0x0FC, 0x0AC, + 0x022, 0x0F4, 0x07E, 0x1E6, 0x000, 0x1FD, 0x087, 0x0F9, 0x021, 0x093, 0x0FB, 0x02F, + 0x003, 0x068, 0x03A, 0x0E6, 0x04A, 0x028, 0x0C4, 0x036, 0x000, 0x02D, 0x0BF, 0x01D, + 0x04D, 0x0DB, 0x037, 0x065 +}; + +static const uint8_t SpectrumA43Bits[] = +{ + 4, 6, 6, 7, 7, 8, 8, 9, 0, 9, 8, 8, 7, 7, 6, 6, + 5, 6, 7, 7, 7, 8, 8, 9, 0, 9, 8, 8, 7, 7, 7, 6, + 6, 7, 7, 7, 8, 8, 9, 9, 0, 9, 9, 8, 8, 7, 7, 7, + 7, 7, 7, 8, 8, 8, 9, 10, 0, 10, 9, 9, 8, 8, 7, 7, + 7, 7, 8, 8, 8, 9, 10, 10, 0, 10, 10, 9, 8, 8, 8, 7, + 8, 8, 8, 9, 9, 9, 10, 10, 0, 10, 10, 9, 9, 9, 8, 8, + 8, 9, 9, 9, 10, 10, 10, 10, 0, 10, 10, 10, 10, 9, 9, 9, + 9, 9, 10, 10, 10, 10, 10, 10, 0, 10, 10, 10, 10, 10, 10, 9, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 9, 9, 10, 10, 10, 10, 10, 10, 0, 10, 10, 10, 10, 10, 10, 9, + 8, 9, 9, 9, 10, 10, 10, 10, 0, 10, 10, 10, 10, 9, 9, 9, + 8, 8, 8, 9, 9, 9, 10, 10, 0, 10, 10, 9, 9, 9, 8, 8, + 7, 7, 8, 8, 8, 9, 10, 10, 0, 10, 10, 9, 8, 8, 8, 7, + 7, 7, 7, 8, 8, 9, 9, 10, 0, 10, 9, 8, 8, 8, 7, 7, + 6, 7, 7, 7, 8, 8, 9, 9, 0, 9, 9, 8, 8, 7, 7, 7, + 5, 6, 7, 7, 7, 8, 8, 9, 0, 9, 8, 8, 7, 7, 7, 6 +}; + +static const uint16_t SpectrumA43Codes[] = +{ + 0x002, 0x03E, 0x016, 0x060, 0x04E, 0x0DC, 0x04A, 0x130, 0x000, 0x131, 0x04B, 0x0DD, + 0x04F, 0x061, 0x017, 0x03F, 0x002, 0x02C, 0x076, 0x042, 0x034, 0x0CE, 0x002, 0x0E8, + 0x000, 0x0CF, 0x001, 0x0D1, 0x037, 0x045, 0x07B, 0x02F, 0x014, 0x072, 0x052, 0x01A, + 0x0E0, 0x080, 0x198, 0x01E, 0x000, 0x01D, 0x19B, 0x083, 0x0DF, 0x019, 0x055, 0x079, + 0x050, 0x03C, 0x004, 0x0C4, 0x096, 0x00C, 0x0EA, 0x34A, 0x000, 0x34F, 0x0ED, 0x1D7, + 0x095, 0x0AF, 0x003, 0x03F, 0x046, 0x026, 0x0D6, 0x092, 0x046, 0x15A, 0x3A8, 0x108, + 0x000, 0x10F, 0x3A3, 0x135, 0x039, 0x091, 0x0D9, 0x031, 0x0D4, 0x0CA, 0x072, 0x1C6, + 0x136, 0x090, 0x2B2, 0x104, 0x000, 0x103, 0x111, 0x08B, 0x133, 0x1D3, 0x071, 0x0C9, + 0x03E, 0x1B4, 0x18C, 0x0CC, 0x38A, 0x2B0, 0x106, 0x0F2, 0x000, 0x0EF, 0x101, 0x113, + 0x3A1, 0x0CB, 0x18F, 0x1B7, 0x0EE, 0x092, 0x388, 0x348, 0x10A, 0x0F4, 0x0F0, 0x0EA, + 0x000, 0x0E9, 0x0ED, 0x0F7, 0x10D, 0x34D, 0x3AB, 0x0C9, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x0EF, 0x0C8, 0x3AA, 0x34C, 0x10C, 0x0F6, 0x0EC, 0x0E8, 0x000, 0x0EB, 0x0F1, 0x0F5, + 0x10B, 0x349, 0x389, 0x093, 0x03F, 0x1B6, 0x18E, 0x0CA, 0x3A0, 0x112, 0x100, 0x0EE, + 0x000, 0x0F3, 0x107, 0x2B1, 0x38B, 0x0CD, 0x18D, 0x1B5, 0x0D5, 0x0C8, 0x070, 0x1D2, + 0x132, 0x08A, 0x110, 0x102, 0x000, 0x105, 0x2B3, 0x091, 0x137, 0x1C7, 0x073, 0x0CB, + 0x047, 0x030, 0x0D8, 0x090, 0x038, 0x134, 0x3A2, 0x10E, 0x000, 0x109, 0x3A9, 0x15B, + 0x047, 0x093, 0x0D7, 0x027, 0x051, 0x03E, 0x002, 0x0AE, 0x094, 0x1D6, 0x0EC, 0x34E, + 0x000, 0x34B, 0x0EB, 0x00D, 0x097, 0x0C5, 0x005, 0x03D, 0x015, 0x078, 0x054, 0x018, + 0x0DE, 0x082, 0x19A, 0x01C, 0x000, 0x01F, 0x199, 0x081, 0x0E1, 0x01B, 0x053, 0x073, + 0x003, 0x02E, 0x07A, 0x044, 0x036, 0x0D0, 0x000, 0x0CE, 0x000, 0x0E9, 0x003, 0x0CF, + 0x035, 0x043, 0x077, 0x02D +}; + +static const uint8_t SpectrumA44Bits[] = +{ + 4, 5, 6, 7, 7, 8, 9, 10, 0, 10, 9, 8, 7, 7, 6, 5, + 5, 6, 6, 7, 7, 8, 9, 10, 0, 10, 9, 8, 7, 7, 6, 6, + 6, 6, 7, 7, 8, 9, 10, 10, 0, 10, 10, 9, 8, 7, 7, 6, + 7, 7, 7, 8, 8, 9, 10, 10, 0, 10, 10, 9, 8, 8, 7, 7, + 7, 8, 8, 8, 9, 10, 10, 10, 0, 10, 10, 10, 9, 8, 8, 7, + 8, 8, 9, 9, 10, 10, 10, 10, 0, 10, 10, 10, 10, 9, 9, 8, + 9, 9, 10, 10, 10, 10, 10, 10, 0, 10, 10, 10, 10, 10, 10, 9, + 10, 10, 10, 10, 10, 10, 10, 10, 0, 10, 10, 10, 10, 10, 10, 10, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 10, 10, 10, 10, 10, 10, 10, 10, 0, 10, 10, 10, 10, 10, 10, 10, + 9, 9, 10, 10, 10, 10, 10, 10, 0, 10, 10, 10, 10, 10, 10, 9, + 8, 8, 9, 9, 10, 10, 10, 10, 0, 10, 10, 10, 10, 9, 9, 8, + 7, 7, 8, 8, 9, 10, 10, 10, 0, 10, 10, 10, 9, 8, 8, 8, + 7, 7, 7, 8, 8, 9, 10, 10, 0, 10, 10, 9, 8, 8, 7, 7, + 6, 6, 7, 7, 8, 9, 10, 10, 0, 10, 10, 9, 8, 7, 7, 6, + 5, 6, 6, 7, 7, 8, 9, 10, 0, 10, 9, 8, 7, 7, 6, 6 +}; + +static const uint16_t SpectrumA44Codes[] = +{ + 0x00A, 0x012, 0x030, 0x06E, 0x024, 0x074, 0x0EC, 0x07E, 0x000, 0x07F, 0x0ED, 0x075, + 0x025, 0x06F, 0x031, 0x013, 0x010, 0x03C, 0x018, 0x05A, 0x002, 0x046, 0x09E, 0x07C, + 0x000, 0x079, 0x0E5, 0x04D, 0x007, 0x065, 0x01B, 0x03F, 0x02E, 0x016, 0x072, 0x01A, + 0x0D6, 0x1C6, 0x3B4, 0x066, 0x000, 0x06B, 0x3B7, 0x1D9, 0x0D5, 0x021, 0x075, 0x015, + 0x06C, 0x03E, 0x01E, 0x0CC, 0x044, 0x0F2, 0x082, 0x05C, 0x000, 0x05F, 0x087, 0x0F5, + 0x031, 0x0CF, 0x017, 0x059, 0x01C, 0x0EE, 0x0D0, 0x024, 0x1C0, 0x08E, 0x06E, 0x048, + 0x000, 0x04D, 0x06D, 0x089, 0x0F7, 0x033, 0x0D3, 0x001, 0x070, 0x028, 0x1C2, 0x0F0, + 0x08A, 0x074, 0x054, 0x040, 0x000, 0x043, 0x053, 0x073, 0x099, 0x0EF, 0x1C5, 0x02B, + 0x0E6, 0x04E, 0x08C, 0x080, 0x068, 0x058, 0x046, 0x02A, 0x000, 0x029, 0x045, 0x051, + 0x065, 0x085, 0x09B, 0x09D, 0x07A, 0x076, 0x060, 0x056, 0x04E, 0x02C, 0x024, 0x022, + 0x000, 0x021, 0x027, 0x02F, 0x04B, 0x05B, 0x063, 0x071, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x07B, 0x070, 0x062, 0x05A, 0x04A, 0x02E, 0x026, 0x020, 0x000, 0x023, 0x025, 0x02D, + 0x04F, 0x057, 0x061, 0x077, 0x0E7, 0x09C, 0x09A, 0x084, 0x064, 0x050, 0x044, 0x028, + 0x000, 0x02B, 0x047, 0x059, 0x069, 0x081, 0x08D, 0x04F, 0x071, 0x02A, 0x1C4, 0x0EE, + 0x098, 0x072, 0x052, 0x042, 0x000, 0x041, 0x055, 0x075, 0x08B, 0x0F1, 0x1C3, 0x029, + 0x01D, 0x000, 0x0D2, 0x032, 0x0F6, 0x088, 0x06C, 0x04C, 0x000, 0x049, 0x06F, 0x08F, + 0x1C1, 0x025, 0x0D1, 0x0EF, 0x06D, 0x058, 0x016, 0x0CE, 0x030, 0x0F4, 0x086, 0x05E, + 0x000, 0x05D, 0x083, 0x0F3, 0x045, 0x0CD, 0x01F, 0x03F, 0x02F, 0x014, 0x074, 0x020, + 0x0D4, 0x1D8, 0x3B6, 0x06A, 0x000, 0x067, 0x3B5, 0x1C7, 0x0D7, 0x01B, 0x073, 0x017, + 0x011, 0x03E, 0x01A, 0x064, 0x006, 0x04C, 0x0E4, 0x078, 0x000, 0x07D, 0x09F, 0x047, + 0x003, 0x05B, 0x019, 0x03D +}; + +static const uint8_t SpectrumA51Bits[] = +{ + 5, 5, 5, 5, 5, 6, 6, 6, 4, 4, 5, 5, 5, 5, 5, 5, + 0, 5, 5, 5, 5, 5, 5, 4, 4, 6, 6, 6, 5, 5, 5, 5 +}; + +static const uint16_t SpectrumA51Codes[] = +{ + 0x19, 0x16, 0x12, 0x0E, 0x06, 0x3A, 0x38, 0x30, 0x00, 0x04, 0x1E, 0x1A, 0x14, 0x10, 0x0C, 0x04, + 0x00, 0x05, 0x0D, 0x11, 0x15, 0x1B, 0x1F, 0x05, 0x01, 0x31, 0x39, 0x3B, 0x07, 0x0F, 0x13, 0x17 +}; + +static const uint8_t SpectrumA52Bits[] = +{ + 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, + 0, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4 +}; + +static const uint16_t SpectrumA52Codes[] = +{ + 0x09, 0x04, 0x00, 0x1E, 0x1A, 0x14, 0x0C, 0x06, 0x18, 0x16, 0x0E, 0x04, 0x3A, 0x38, 0x22, 0x20, + 0x00, 0x21, 0x23, 0x39, 0x3B, 0x05, 0x0F, 0x17, 0x19, 0x07, 0x0D, 0x15, 0x1B, 0x1F, 0x01, 0x05 +}; + +static const uint8_t SpectrumA53Bits[] = +{ + 3, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 7, 7, 7, 7, + 0, 7, 7, 7, 7, 6, 6, 5, 5, 5, 5, 5, 5, 4, 4, 4 +}; + +static const uint16_t SpectrumA53Codes[] = +{ + 0x00, 0x0C, 0x08, 0x04, 0x1E, 0x16, 0x14, 0x06, 0x0C, 0x04, 0x38, 0x1E, 0x76, 0x74, 0x3A, 0x38, + 0x00, 0x39, 0x3B, 0x75, 0x77, 0x1F, 0x39, 0x05, 0x0D, 0x07, 0x15, 0x17, 0x1F, 0x05, 0x09, 0x0D +}; + +static const uint8_t SpectrumA54Bits[] = +{ + 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 7, 7, 7, 8, 8, + 0, 8, 8, 7, 7, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4 +}; + +static const uint16_t SpectrumA54Codes[] = +{ + 0x02, 0x0E, 0x0A, 0x08, 0x02, 0x1A, 0x0E, 0x02, 0x00, 0x30, 0x18, 0x66, 0x36, 0x34, 0xCA, 0xC8, + 0x00, 0xC9, 0xCB, 0x35, 0x37, 0x67, 0x19, 0x31, 0x01, 0x03, 0x0F, 0x1B, 0x03, 0x09, 0x0B, 0x0F +}; + +static const uint8_t SpectrumA61Bits[] = +{ + 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, + 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, + 5, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6 +}; + +static const uint16_t SpectrumA61Codes[] = +{ + 0x35, 0x30, 0x2A, 0x28, 0x24, 0x20, 0x18, 0x0E, 0x0C, 0x7E, 0x7C, 0x72, 0x70, 0x68, 0x5E, 0x5C, + 0x04, 0x0E, 0x08, 0x00, 0x3C, 0x3A, 0x36, 0x32, 0x2C, 0x26, 0x22, 0x1A, 0x16, 0x14, 0x06, 0x04, + 0x00, 0x05, 0x07, 0x15, 0x17, 0x1B, 0x23, 0x27, 0x2D, 0x33, 0x37, 0x3B, 0x3D, 0x01, 0x09, 0x0F, + 0x05, 0x5D, 0x5F, 0x69, 0x71, 0x73, 0x7D, 0x7F, 0x0D, 0x0F, 0x19, 0x21, 0x25, 0x29, 0x2B, 0x31 +}; + +static const uint8_t SpectrumA62Bits[] = +{ + 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, + 0, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5 +}; + +static const uint16_t SpectrumA62Codes[] = +{ + 0x14, 0x0E, 0x08, 0x04, 0x02, 0x3E, 0x3C, 0x38, 0x34, 0x30, 0x2A, 0x24, 0x1A, 0x18, 0x0E, 0x02, + 0x32, 0x36, 0x2C, 0x26, 0x20, 0x16, 0x0C, 0x00, 0x76, 0x74, 0x5E, 0x5C, 0x46, 0x44, 0x2A, 0x28, + 0x00, 0x29, 0x2B, 0x45, 0x47, 0x5D, 0x5F, 0x75, 0x77, 0x01, 0x0D, 0x17, 0x21, 0x27, 0x2D, 0x37, + 0x33, 0x03, 0x0F, 0x19, 0x1B, 0x25, 0x2B, 0x31, 0x35, 0x39, 0x3D, 0x3F, 0x03, 0x05, 0x09, 0x0F +}; + +static const uint8_t SpectrumA63Bits[] = +{ + 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, + 0, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5 +}; + +static const uint16_t SpectrumA63Codes[] = +{ + 0x00, 0x1C, 0x18, 0x14, 0x10, 0x0A, 0x08, 0x02, 0x3E, 0x36, 0x2E, 0x2C, 0x24, 0x1C, 0x0E, 0x08, + 0x1E, 0x1A, 0x0C, 0x7A, 0x6A, 0x68, 0x4C, 0x32, 0x16, 0x14, 0xF2, 0xF0, 0x9E, 0x9C, 0x62, 0x60, + 0x00, 0x61, 0x63, 0x9D, 0x9F, 0xF1, 0xF3, 0x15, 0x17, 0x33, 0x4D, 0x69, 0x6B, 0x7B, 0x0D, 0x1B, + 0x1F, 0x09, 0x0F, 0x1D, 0x25, 0x2D, 0x2F, 0x37, 0x3F, 0x03, 0x09, 0x0B, 0x11, 0x15, 0x19, 0x1D +}; + +static const uint8_t SpectrumA64Bits[] = +{ + 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, + 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, + 0, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, + 6, 7, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 4 +}; + +static const uint16_t SpectrumA64Codes[] = +{ + 0x006, 0x002, 0x01C, 0x01A, 0x016, 0x012, 0x00E, 0x00A, 0x002, 0x03E, 0x032, 0x02A, + 0x022, 0x020, 0x010, 0x07A, 0x000, 0x078, 0x060, 0x050, 0x024, 0x006, 0x0C6, 0x0C4, + 0x0A4, 0x04E, 0x00A, 0x008, 0x14E, 0x14C, 0x09A, 0x098, 0x000, 0x099, 0x09B, 0x14D, + 0x14F, 0x009, 0x00B, 0x04F, 0x0A5, 0x0C5, 0x0C7, 0x007, 0x025, 0x051, 0x061, 0x079, + 0x001, 0x07B, 0x011, 0x021, 0x023, 0x02B, 0x033, 0x03F, 0x003, 0x00B, 0x00F, 0x013, + 0x017, 0x01B, 0x01D, 0x003 +}; + +static const uint8_t SpectrumA71Bits[] = +{ + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, + 6, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7 +}; + +static const uint16_t SpectrumA71Codes[] = +{ + 0x6C, 0x66, 0x62, 0x5C, 0x56, 0x50, 0x52, 0x4E, 0x48, 0x3E, 0x36, 0x34, 0x2A, 0x26, 0x1E, 0x16, + 0x0E, 0x08, 0x00, 0xF6, 0xF4, 0xEE, 0xEC, 0xE2, 0xE0, 0xDA, 0xD2, 0xD0, 0xBE, 0xBC, 0xB2, 0xB0, + 0x0C, 0x20, 0x1C, 0x16, 0x10, 0x08, 0x02, 0x7E, 0x7C, 0x78, 0x74, 0x72, 0x6E, 0x6A, 0x64, 0x60, + 0x5A, 0x54, 0x4C, 0x4A, 0x46, 0x44, 0x3C, 0x32, 0x30, 0x28, 0x24, 0x1C, 0x14, 0x0C, 0x0A, 0x02, + 0x00, 0x03, 0x0B, 0x0D, 0x15, 0x1D, 0x25, 0x29, 0x31, 0x33, 0x3D, 0x45, 0x47, 0x4B, 0x4D, 0x55, + 0x5B, 0x61, 0x65, 0x6B, 0x6F, 0x73, 0x75, 0x79, 0x7D, 0x7F, 0x03, 0x09, 0x11, 0x17, 0x1D, 0x21, + 0x0D, 0xB1, 0xB3, 0xBD, 0xBF, 0xD1, 0xD3, 0xDB, 0xE1, 0xE3, 0xED, 0xEF, 0xF5, 0xF7, 0x01, 0x09, + 0x0F, 0x17, 0x1F, 0x27, 0x2B, 0x35, 0x37, 0x3F, 0x49, 0x4F, 0x53, 0x51, 0x57, 0x5D, 0x63, 0x67 +}; + +static const uint8_t SpectrumA72Bits[] = +{ + 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 0, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6 +}; + +static const uint16_t SpectrumA72Codes[] = +{ + 0x2A, 0x24, 0x1C, 0x18, 0x12, 0x0E, 0x0A, 0x06, 0x02, 0x7E, 0x7C, 0x7A, 0x76, 0x72, 0x70, 0x6A, + 0x68, 0x62, 0x5C, 0x5A, 0x52, 0x4E, 0x46, 0x42, 0x3C, 0x34, 0x2A, 0x28, 0x20, 0x12, 0x10, 0x08, + 0x66, 0x74, 0x6C, 0x64, 0x5E, 0x58, 0x50, 0x44, 0x40, 0x36, 0x2C, 0x22, 0x1A, 0x0A, 0x02, 0x00, + 0xF2, 0xF0, 0xDE, 0xDC, 0xC2, 0xC0, 0xAE, 0xAC, 0x9A, 0x98, 0x7E, 0x7C, 0x5E, 0x5C, 0x32, 0x30, + 0x00, 0x31, 0x33, 0x5D, 0x5F, 0x7D, 0x7F, 0x99, 0x9B, 0xAD, 0xAF, 0xC1, 0xC3, 0xDD, 0xDF, 0xF1, + 0xF3, 0x01, 0x03, 0x0B, 0x1B, 0x23, 0x2D, 0x37, 0x41, 0x45, 0x51, 0x59, 0x5F, 0x65, 0x6D, 0x75, + 0x67, 0x09, 0x11, 0x13, 0x21, 0x29, 0x2B, 0x35, 0x3D, 0x43, 0x47, 0x4F, 0x53, 0x5B, 0x5D, 0x63, + 0x69, 0x6B, 0x71, 0x73, 0x77, 0x7B, 0x7D, 0x7F, 0x03, 0x07, 0x0B, 0x0F, 0x13, 0x19, 0x1D, 0x25 +}; + +static const uint8_t SpectrumA73Bits[] = +{ + 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6 +}; + +static const uint16_t SpectrumA73Codes[] = +{ + 0x003, 0x03E, 0x038, 0x034, 0x030, 0x02C, 0x028, 0x024, 0x020, 0x01C, 0x016, 0x014, + 0x00E, 0x00A, 0x004, 0x000, 0x07A, 0x076, 0x06E, 0x06C, 0x064, 0x05E, 0x056, 0x04E, + 0x04C, 0x044, 0x036, 0x030, 0x022, 0x018, 0x012, 0x004, 0x03C, 0x03E, 0x032, 0x024, + 0x020, 0x010, 0x0F2, 0x0F0, 0x0E8, 0x0CE, 0x0BA, 0x0B8, 0x0A8, 0x08C, 0x06A, 0x04E, + 0x04C, 0x034, 0x00E, 0x00C, 0x1D6, 0x1D4, 0x19A, 0x198, 0x156, 0x154, 0x11E, 0x11C, + 0x0D2, 0x0D0, 0x06E, 0x06C, 0x000, 0x06D, 0x06F, 0x0D1, 0x0D3, 0x11D, 0x11F, 0x155, + 0x157, 0x199, 0x19B, 0x1D5, 0x1D7, 0x00D, 0x00F, 0x035, 0x04D, 0x04F, 0x06B, 0x08D, + 0x0A9, 0x0B9, 0x0BB, 0x0CF, 0x0E9, 0x0F1, 0x0F3, 0x011, 0x021, 0x025, 0x033, 0x03F, + 0x03D, 0x005, 0x013, 0x019, 0x023, 0x031, 0x037, 0x045, 0x04D, 0x04F, 0x057, 0x05F, + 0x065, 0x06D, 0x06F, 0x077, 0x07B, 0x001, 0x005, 0x00B, 0x00F, 0x015, 0x017, 0x01D, + 0x021, 0x025, 0x029, 0x02D, 0x031, 0x035, 0x039, 0x03F +}; + +static const uint8_t SpectrumA74Bits[] = +{ + 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, + 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 0, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 7, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5 +}; + +static const uint16_t SpectrumA74Codes[] = +{ + 0x00D, 0x00A, 0x004, 0x000, 0x03A, 0x036, 0x032, 0x030, 0x02C, 0x028, 0x026, 0x022, + 0x01E, 0x018, 0x012, 0x00E, 0x006, 0x07E, 0x07A, 0x070, 0x06A, 0x05E, 0x056, 0x054, + 0x048, 0x040, 0x038, 0x022, 0x01A, 0x00A, 0x0F8, 0x0E6, 0x008, 0x0FA, 0x0F0, 0x0D2, + 0x0BA, 0x0B8, 0x094, 0x084, 0x074, 0x042, 0x032, 0x1E6, 0x1CA, 0x1C8, 0x1A2, 0x12E, + 0x10E, 0x10C, 0x0EC, 0x082, 0x062, 0x060, 0x3CA, 0x3C8, 0x342, 0x340, 0x25A, 0x258, + 0x1DE, 0x1DC, 0x102, 0x100, 0x000, 0x101, 0x103, 0x1DD, 0x1DF, 0x259, 0x25B, 0x341, + 0x343, 0x3C9, 0x3CB, 0x061, 0x063, 0x083, 0x0ED, 0x10D, 0x10F, 0x12F, 0x1A3, 0x1C9, + 0x1CB, 0x1E7, 0x033, 0x043, 0x075, 0x085, 0x095, 0x0B9, 0x0BB, 0x0D3, 0x0F1, 0x0FB, + 0x009, 0x0E7, 0x0F9, 0x00B, 0x01B, 0x023, 0x039, 0x041, 0x049, 0x055, 0x057, 0x05F, + 0x06B, 0x071, 0x07B, 0x07F, 0x007, 0x00F, 0x013, 0x019, 0x01F, 0x023, 0x027, 0x029, + 0x02D, 0x031, 0x033, 0x037, 0x03B, 0x001, 0x005, 0x00B +}; + +static const uint8_t SpectrumB22Bits[] = +{ + 0, 4, 0, 4, 4, 5, 0, 5, 0, 0, 0, 0, 4, 5, 0, 5, + 4, 7, 0, 6, 6, 9, 0, 7, 0, 0, 0, 0, 6, 9, 0, 7, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 4, 6, 0, 7, 6, 7, 0, 9, 0, 0, 0, 0, 6, 7, 0, 9, + 4, 8, 0, 8, 8, 10, 0, 10, 0, 0, 0, 0, 6, 9, 0, 9, + 5, 10, 0, 9, 9, 10, 0, 10, 0, 0, 0, 0, 7, 10, 0, 10, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 6, 9, 0, 10, 9, 10, 0, 10, 0, 0, 0, 0, 7, 10, 0, 10, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 4, 8, 0, 8, 6, 9, 0, 9, 0, 0, 0, 0, 8, 10, 0, 10, + 6, 10, 0, 9, 7, 10, 0, 10, 0, 0, 0, 0, 9, 10, 0, 10, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 5, 9, 0, 10, 7, 10, 0, 10, 0, 0, 0, 0, 9, 10, 0, 10 +}; + +static const uint16_t SpectrumB22Codes[] = +{ + 0x000, 0x00E, 0x000, 0x00F, 0x008, 0x006, 0x000, 0x00B, 0x000, 0x000, 0x000, 0x000, + 0x009, 0x00A, 0x000, 0x007, 0x006, 0x00A, 0x000, 0x029, 0x006, 0x158, 0x000, 0x023, + 0x000, 0x000, 0x000, 0x000, 0x013, 0x174, 0x000, 0x021, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x007, 0x028, 0x000, 0x00B, 0x012, 0x020, 0x000, 0x175, 0x000, 0x000, 0x000, 0x000, + 0x007, 0x022, 0x000, 0x159, 0x00C, 0x0BC, 0x000, 0x0BF, 0x022, 0x2B8, 0x000, 0x2BB, + 0x000, 0x000, 0x000, 0x000, 0x00B, 0x170, 0x000, 0x15B, 0x000, 0x04E, 0x000, 0x15F, + 0x042, 0x04A, 0x000, 0x041, 0x000, 0x000, 0x000, 0x000, 0x055, 0x044, 0x000, 0x04D, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x02D, 0x172, 0x000, 0x2ED, 0x040, 0x042, 0x000, 0x047, + 0x000, 0x000, 0x000, 0x000, 0x013, 0x2EE, 0x000, 0x049, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x00D, 0x0BE, 0x000, 0x0BD, 0x00A, 0x15A, 0x000, 0x171, 0x000, 0x000, 0x000, 0x000, + 0x023, 0x2BA, 0x000, 0x2B9, 0x02C, 0x2EC, 0x000, 0x173, 0x012, 0x048, 0x000, 0x2EF, + 0x000, 0x000, 0x000, 0x000, 0x041, 0x046, 0x000, 0x043, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x001, 0x15E, 0x000, 0x04F, 0x054, 0x04C, 0x000, 0x045, 0x000, 0x000, 0x000, 0x000, + 0x043, 0x040, 0x000, 0x04B +}; + +static const uint8_t SpectrumB23Bits[] = +{ + 2, 4, 0, 4, 4, 6, 0, 6, 0, 0, 0, 0, 4, 6, 0, 6, + 4, 9, 0, 7, 7, 9, 0, 8, 0, 0, 0, 0, 7, 9, 0, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 4, 7, 0, 9, 7, 8, 0, 9, 0, 0, 0, 0, 7, 8, 0, 9, + 4, 8, 0, 8, 9, 10, 0, 10, 0, 0, 0, 0, 7, 10, 0, 10, + 7, 10, 0, 10, 10, 10, 0, 10, 0, 0, 0, 0, 9, 10, 0, 10, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 7, 10, 0, 10, 10, 10, 0, 10, 0, 0, 0, 0, 8, 10, 0, 10, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 4, 8, 0, 8, 7, 10, 0, 10, 0, 0, 0, 0, 9, 10, 0, 10, + 7, 10, 0, 10, 8, 10, 0, 10, 0, 0, 0, 0, 10, 10, 0, 10, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 7, 10, 0, 10, 9, 10, 0, 10, 0, 0, 0, 0, 10, 10, 0, 10 +}; + +static const uint16_t SpectrumB23Codes[] = +{ + 0x003, 0x008, 0x000, 0x009, 0x002, 0x018, 0x000, 0x01B, 0x000, 0x000, 0x000, 0x000, + 0x003, 0x01A, 0x000, 0x019, 0x000, 0x17C, 0x000, 0x055, 0x056, 0x0E8, 0x000, 0x07D, + 0x000, 0x000, 0x000, 0x000, 0x059, 0x0F6, 0x000, 0x07F, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x001, 0x054, 0x000, 0x17D, 0x058, 0x07E, 0x000, 0x0F7, 0x000, 0x000, 0x000, 0x000, + 0x057, 0x07C, 0x000, 0x0E9, 0x004, 0x0A2, 0x000, 0x0A1, 0x17A, 0x1DA, 0x000, 0x1D9, + 0x000, 0x000, 0x000, 0x000, 0x053, 0x1E8, 0x000, 0x2F3, 0x05C, 0x1D6, 0x000, 0x1E7, + 0x1EA, 0x1E2, 0x000, 0x1CF, 0x000, 0x000, 0x000, 0x000, 0x17F, 0x1CA, 0x000, 0x1DD, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x05B, 0x2F0, 0x000, 0x1DF, 0x1E4, 0x1CC, 0x000, 0x1D5, + 0x000, 0x000, 0x000, 0x000, 0x071, 0x1E0, 0x000, 0x1C9, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x005, 0x0A0, 0x000, 0x0A3, 0x052, 0x2F2, 0x000, 0x1E9, 0x000, 0x000, 0x000, 0x000, + 0x17B, 0x1D8, 0x000, 0x1DB, 0x05A, 0x1DE, 0x000, 0x2F1, 0x070, 0x1C8, 0x000, 0x1E1, + 0x000, 0x000, 0x000, 0x000, 0x1E5, 0x1D4, 0x000, 0x1CD, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x05D, 0x1E6, 0x000, 0x1D7, 0x17E, 0x1DC, 0x000, 0x1CB, 0x000, 0x000, 0x000, 0x000, + 0x1EB, 0x1CE, 0x000, 0x1E3 +}; + +static const uint8_t SpectrumB24Bits[] = +{ + 1, 4, 0, 4, 5, 7, 0, 7, 0, 0, 0, 0, 5, 7, 0, 7, + 5, 9, 0, 7, 8, 10, 0, 9, 0, 0, 0, 0, 7, 10, 0, 9, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 5, 7, 0, 9, 7, 9, 0, 10, 0, 0, 0, 0, 8, 9, 0, 10, + 5, 9, 0, 8, 9, 10, 0, 10, 0, 0, 0, 0, 7, 10, 0, 10, + 7, 10, 0, 10, 10, 10, 0, 10, 0, 0, 0, 0, 10, 10, 0, 10, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 7, 10, 0, 10, 10, 10, 0, 10, 0, 0, 0, 0, 10, 10, 0, 10, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 5, 8, 0, 9, 7, 10, 0, 10, 0, 0, 0, 0, 9, 10, 0, 10, + 7, 10, 0, 10, 10, 10, 0, 10, 0, 0, 0, 0, 10, 10, 0, 10, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 7, 10, 0, 10, 10, 10, 0, 10, 0, 0, 0, 0, 10, 10, 0, 10 +}; + +static const uint16_t SpectrumB24Codes[] = +{ + 0x001, 0x000, 0x000, 0x001, 0x00A, 0x01C, 0x000, 0x033, 0x000, 0x000, 0x000, 0x000, + 0x00B, 0x032, 0x000, 0x01D, 0x008, 0x0D8, 0x000, 0x031, 0x06E, 0x0FA, 0x000, 0x0D7, + 0x000, 0x000, 0x000, 0x000, 0x011, 0x0F4, 0x000, 0x0D5, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x009, 0x030, 0x000, 0x0D9, 0x010, 0x0D4, 0x000, 0x0F5, 0x000, 0x000, 0x000, 0x000, + 0x06F, 0x0D6, 0x000, 0x0FB, 0x00E, 0x0DA, 0x000, 0x025, 0x0D2, 0x0D4, 0x000, 0x0DB, + 0x000, 0x000, 0x000, 0x000, 0x017, 0x0FE, 0x000, 0x0FD, 0x014, 0x0DC, 0x000, 0x0F9, + 0x0F2, 0x0D6, 0x000, 0x09B, 0x000, 0x000, 0x000, 0x000, 0x1A3, 0x09C, 0x000, 0x0D3, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x019, 0x0F6, 0x000, 0x0D9, 0x0F0, 0x09E, 0x000, 0x0D1, + 0x000, 0x000, 0x000, 0x000, 0x1A1, 0x0DE, 0x000, 0x099, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x00F, 0x024, 0x000, 0x0DB, 0x016, 0x0FC, 0x000, 0x0FF, 0x000, 0x000, 0x000, 0x000, + 0x0D3, 0x0DA, 0x000, 0x0D5, 0x018, 0x0D8, 0x000, 0x0F7, 0x1A0, 0x098, 0x000, 0x0DF, + 0x000, 0x000, 0x000, 0x000, 0x0F1, 0x0D0, 0x000, 0x09F, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x015, 0x0F8, 0x000, 0x0DD, 0x1A2, 0x0D2, 0x000, 0x09D, 0x000, 0x000, 0x000, 0x000, + 0x0F3, 0x09A, 0x000, 0x0D7 +}; + +static const uint8_t SpectrumB32Bits[] = +{ + 2, 4, 5, 6, 0, 6, 5, 4, 5, 6, 6, 7, 0, 6, 5, 6, + 5, 6, 7, 7, 0, 8, 7, 6, 6, 7, 8, 9, 0, 9, 8, 7, + 0, 0, 0, 0, 0, 0, 0, 0, 6, 7, 8, 9, 0, 9, 8, 7, + 5, 6, 7, 8, 0, 7, 7, 6, 5, 6, 5, 6, 0, 7, 6, 6 +}; + +static const uint16_t SpectrumB32Codes[] = +{ + 0x001, 0x002, 0x01E, 0x02A, 0x000, 0x02B, 0x01F, 0x003, 0x016, 0x020, 0x03A, 0x064, + 0x000, 0x005, 0x001, 0x023, 0x01A, 0x026, 0x070, 0x00C, 0x000, 0x0CF, 0x073, 0x031, + 0x024, 0x00E, 0x0CC, 0x146, 0x000, 0x145, 0x0A1, 0x053, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x025, 0x052, 0x0A0, 0x144, 0x000, 0x147, 0x0CD, 0x00F, + 0x01B, 0x030, 0x072, 0x0CE, 0x000, 0x00D, 0x071, 0x027, 0x017, 0x022, 0x000, 0x004, + 0x000, 0x065, 0x03B, 0x021 +}; + +static const uint8_t SpectrumB33Bits[] = +{ + 2, 4, 5, 7, 0, 7, 5, 4, 4, 5, 6, 8, 0, 7, 6, 5, + 5, 6, 7, 9, 0, 8, 7, 6, 7, 8, 9, 10, 0, 10, 9, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 7, 8, 9, 10, 0, 10, 9, 8, + 5, 6, 7, 8, 0, 9, 7, 6, 4, 5, 6, 7, 0, 8, 6, 5 +}; + +static const uint16_t SpectrumB33Codes[] = +{ + 0x003, 0x008, 0x014, 0x05E, 0x000, 0x05F, 0x015, 0x009, 0x004, 0x002, 0x01C, 0x0BA, + 0x000, 0x011, 0x01F, 0x001, 0x00C, 0x00C, 0x014, 0x166, 0x000, 0x02D, 0x013, 0x00F, + 0x05A, 0x0B0, 0x05E, 0x0B8, 0x000, 0x0BB, 0x165, 0x0B9, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x05B, 0x0B8, 0x164, 0x0BA, 0x000, 0x0B9, 0x05F, 0x0B1, + 0x00D, 0x00E, 0x012, 0x02C, 0x000, 0x167, 0x015, 0x00D, 0x005, 0x000, 0x01E, 0x010, + 0x000, 0x0BB, 0x01D, 0x003 +}; + +static const uint8_t SpectrumB34Bits[] = +{ + 1, 4, 6, 8, 0, 8, 6, 4, 4, 6, 7, 9, 0, 8, 7, 6, + 6, 7, 8, 10, 0, 10, 8, 7, 8, 9, 10, 10, 0, 10, 10, 9, + 0, 0, 0, 0, 0, 0, 0, 0, 8, 9, 10, 10, 0, 10, 10, 9, + 6, 7, 8, 10, 0, 10, 8, 7, 4, 6, 7, 8, 0, 9, 7, 6 +}; + +static const uint16_t SpectrumB34Codes[] = +{ + 0x000, 0x00A, 0x038, 0x0EE, 0x000, 0x0EF, 0x039, 0x00B, 0x008, 0x03C, 0x06E, 0x1D8, + 0x000, 0x0C1, 0x075, 0x03F, 0x032, 0x068, 0x0C4, 0x358, 0x000, 0x30F, 0x0C7, 0x06D, + 0x0D4, 0x1AE, 0x30C, 0x308, 0x000, 0x30B, 0x35B, 0x1DB, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x0D5, 0x1DA, 0x35A, 0x30A, 0x000, 0x309, 0x30D, 0x1AF, + 0x033, 0x06C, 0x0C6, 0x30E, 0x000, 0x359, 0x0C5, 0x069, 0x009, 0x03E, 0x074, 0x0C0, + 0x000, 0x1D9, 0x06F, 0x03D +}; + +static const uint8_t SpectrumB42Bits[] = +{ + 4, 5, 6, 8, 6, 7, 8, 8, 0, 8, 8, 7, 6, 8, 6, 5, + 5, 6, 7, 8, 7, 7, 8, 9, 0, 8, 8, 7, 7, 8, 7, 6, + 7, 7, 8, 9, 7, 8, 9, 9, 0, 9, 9, 8, 7, 9, 8, 7, + 8, 9, 9, 10, 8, 8, 9, 10, 0, 10, 9, 8, 8, 10, 9, 8, + 6, 7, 8, 8, 9, 9, 10, 10, 0, 10, 10, 9, 9, 8, 8, 7, + 7, 7, 8, 9, 9, 10, 10, 10, 0, 10, 10, 10, 9, 9, 8, 7, + 8, 8, 9, 9, 10, 10, 10, 10, 0, 10, 10, 10, 10, 9, 9, 8, + 8, 9, 9, 10, 10, 10, 10, 10, 0, 10, 10, 10, 10, 10, 9, 9, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 8, 9, 9, 10, 10, 10, 10, 10, 0, 10, 10, 10, 10, 10, 9, 9, + 8, 8, 9, 9, 10, 10, 10, 10, 0, 10, 10, 10, 10, 9, 9, 8, + 7, 7, 8, 9, 9, 10, 10, 10, 0, 10, 10, 10, 9, 9, 8, 7, + 6, 7, 8, 8, 9, 9, 10, 10, 0, 10, 10, 9, 9, 8, 8, 7, + 8, 8, 9, 10, 8, 8, 9, 10, 0, 10, 9, 8, 8, 10, 9, 9, + 7, 7, 8, 9, 7, 8, 9, 9, 0, 9, 9, 8, 7, 9, 8, 7, + 5, 6, 7, 8, 7, 7, 8, 8, 0, 9, 8, 7, 7, 8, 7, 6 +}; + +static const uint16_t SpectrumB42Codes[] = +{ + 0x00E, 0x018, 0x010, 0x0F0, 0x024, 0x05A, 0x0F6, 0x078, 0x000, 0x079, 0x0F7, 0x05B, + 0x025, 0x0F1, 0x011, 0x019, 0x00C, 0x014, 0x01C, 0x036, 0x05C, 0x012, 0x09E, 0x1E4, + 0x000, 0x00B, 0x0A9, 0x03B, 0x05F, 0x071, 0x019, 0x017, 0x06E, 0x000, 0x03E, 0x114, + 0x002, 0x0B0, 0x1AA, 0x07A, 0x000, 0x099, 0x1E7, 0x0B3, 0x00B, 0x131, 0x07F, 0x00D, + 0x0D8, 0x1FE, 0x112, 0x22E, 0x086, 0x010, 0x134, 0x35C, 0x000, 0x35F, 0x133, 0x013, + 0x081, 0x22D, 0x119, 0x07B, 0x00A, 0x050, 0x0F8, 0x04E, 0x1B4, 0x154, 0x3EC, 0x0D2, + 0x000, 0x0D7, 0x3D7, 0x137, 0x1FD, 0x073, 0x0FD, 0x057, 0x052, 0x010, 0x08E, 0x1E8, + 0x11A, 0x3EE, 0x0F2, 0x03C, 0x000, 0x03F, 0x0F1, 0x3D5, 0x111, 0x1F5, 0x09D, 0x025, + 0x0D2, 0x082, 0x1A0, 0x0F8, 0x36E, 0x0D4, 0x072, 0x03A, 0x000, 0x027, 0x071, 0x07D, + 0x36D, 0x0FB, 0x1AD, 0x085, 0x00C, 0x1A8, 0x03C, 0x346, 0x0D0, 0x076, 0x024, 0x020, + 0x000, 0x023, 0x039, 0x075, 0x07F, 0x345, 0x09B, 0x157, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x00D, 0x156, 0x09A, 0x344, 0x07E, 0x074, 0x038, 0x022, 0x000, 0x021, 0x025, 0x077, + 0x0D1, 0x347, 0x03D, 0x1A9, 0x0D3, 0x084, 0x1AC, 0x0FA, 0x36C, 0x07C, 0x070, 0x026, + 0x000, 0x03B, 0x073, 0x0D5, 0x36F, 0x0F9, 0x1A1, 0x083, 0x053, 0x024, 0x09C, 0x1F4, + 0x110, 0x3D4, 0x0F0, 0x03E, 0x000, 0x03D, 0x0F3, 0x3EF, 0x11B, 0x1E9, 0x08F, 0x011, + 0x00B, 0x056, 0x0FC, 0x072, 0x1FC, 0x136, 0x3D6, 0x0D6, 0x000, 0x0D3, 0x3ED, 0x155, + 0x1B5, 0x04F, 0x0F9, 0x051, 0x0D9, 0x07A, 0x118, 0x22C, 0x080, 0x012, 0x132, 0x35E, + 0x000, 0x35D, 0x135, 0x011, 0x087, 0x22F, 0x113, 0x1FF, 0x06F, 0x00C, 0x07E, 0x130, + 0x00A, 0x0B2, 0x1E6, 0x098, 0x000, 0x07B, 0x1AB, 0x0B1, 0x003, 0x115, 0x03F, 0x001, + 0x00D, 0x016, 0x018, 0x070, 0x05E, 0x03A, 0x0A8, 0x00A, 0x000, 0x1E5, 0x09F, 0x013, + 0x05D, 0x037, 0x01D, 0x015 +}; + +static const uint8_t SpectrumB43Bits[] = +{ + 2, 5, 6, 7, 7, 8, 8, 9, 0, 9, 8, 8, 7, 7, 6, 5, + 5, 6, 7, 8, 7, 8, 9, 10, 0, 10, 9, 8, 7, 8, 7, 6, + 6, 7, 8, 9, 8, 9, 10, 10, 0, 10, 10, 9, 8, 9, 8, 7, + 7, 8, 9, 10, 9, 9, 10, 10, 0, 10, 10, 10, 9, 10, 9, 8, + 7, 8, 8, 9, 10, 10, 10, 10, 0, 10, 10, 10, 10, 9, 8, 7, + 8, 8, 9, 10, 10, 10, 10, 10, 0, 10, 10, 10, 10, 10, 9, 8, + 9, 9, 10, 10, 10, 10, 10, 10, 0, 10, 10, 10, 10, 10, 10, 9, + 10, 10, 10, 10, 10, 10, 10, 10, 0, 10, 10, 10, 10, 10, 10, 10, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 10, 10, 10, 10, 10, 10, 10, 10, 0, 10, 10, 10, 10, 10, 10, 10, + 9, 9, 10, 10, 10, 10, 10, 10, 0, 10, 10, 10, 10, 10, 10, 9, + 8, 8, 9, 10, 10, 10, 10, 10, 0, 10, 10, 10, 10, 10, 9, 8, + 7, 7, 8, 9, 10, 10, 10, 10, 0, 10, 10, 10, 10, 9, 8, 8, + 7, 8, 9, 10, 9, 10, 10, 10, 0, 10, 10, 9, 9, 10, 9, 8, + 6, 7, 8, 9, 8, 9, 10, 10, 0, 10, 10, 9, 8, 9, 8, 7, + 5, 6, 7, 8, 7, 8, 9, 10, 0, 10, 9, 8, 7, 8, 7, 6 +}; + +static const uint16_t SpectrumB43Codes[] = +{ + 0x001, 0x01E, 0x022, 0x018, 0x064, 0x0EC, 0x008, 0x100, 0x000, 0x101, 0x009, 0x0ED, + 0x065, 0x019, 0x023, 0x01F, 0x01A, 0x030, 0x056, 0x09A, 0x00A, 0x090, 0x12C, 0x0A6, + 0x000, 0x0A9, 0x12F, 0x093, 0x00F, 0x09F, 0x059, 0x039, 0x00E, 0x054, 0x0BC, 0x19E, + 0x082, 0x176, 0x0AC, 0x088, 0x000, 0x08B, 0x0AF, 0x19D, 0x095, 0x1D1, 0x0BF, 0x051, + 0x002, 0x098, 0x1D4, 0x0B8, 0x170, 0x046, 0x090, 0x060, 0x000, 0x067, 0x095, 0x0BD, + 0x173, 0x0B5, 0x1D3, 0x09D, 0x052, 0x0EE, 0x034, 0x174, 0x0BA, 0x09C, 0x080, 0x044, + 0x000, 0x047, 0x06D, 0x099, 0x0BF, 0x16F, 0x085, 0x001, 0x0CC, 0x036, 0x16C, 0x0B0, + 0x09A, 0x084, 0x04E, 0x03E, 0x000, 0x037, 0x04B, 0x06B, 0x0A1, 0x0B3, 0x16B, 0x087, + 0x1D6, 0x102, 0x0A4, 0x092, 0x068, 0x04C, 0x034, 0x030, 0x000, 0x02D, 0x03D, 0x049, + 0x083, 0x097, 0x0AB, 0x169, 0x0B6, 0x09E, 0x06E, 0x064, 0x040, 0x038, 0x02E, 0x02A, + 0x000, 0x029, 0x033, 0x03B, 0x043, 0x063, 0x087, 0x0A3, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x0B7, 0x0A2, 0x086, 0x062, 0x042, 0x03A, 0x032, 0x028, 0x000, 0x02B, 0x02F, 0x039, + 0x041, 0x065, 0x06F, 0x09F, 0x1D7, 0x168, 0x0AA, 0x096, 0x082, 0x048, 0x03C, 0x02C, + 0x000, 0x031, 0x035, 0x04D, 0x069, 0x093, 0x0A5, 0x103, 0x0CD, 0x086, 0x16A, 0x0B2, + 0x0A0, 0x06A, 0x04A, 0x036, 0x000, 0x03F, 0x04F, 0x085, 0x09B, 0x0B1, 0x16D, 0x037, + 0x053, 0x000, 0x084, 0x16E, 0x0BE, 0x098, 0x06C, 0x046, 0x000, 0x045, 0x081, 0x09D, + 0x0BB, 0x175, 0x035, 0x0EF, 0x003, 0x09C, 0x1D2, 0x0B4, 0x172, 0x0BC, 0x094, 0x066, + 0x000, 0x061, 0x091, 0x047, 0x171, 0x0B9, 0x1D5, 0x099, 0x00F, 0x050, 0x0BE, 0x1D0, + 0x094, 0x19C, 0x0AE, 0x08A, 0x000, 0x089, 0x0AD, 0x177, 0x083, 0x19F, 0x0BD, 0x055, + 0x01B, 0x038, 0x058, 0x09E, 0x00E, 0x092, 0x12E, 0x0A8, 0x000, 0x0A7, 0x12D, 0x091, + 0x00B, 0x09B, 0x057, 0x031 +}; + +static const uint8_t SpectrumB44Bits[] = +{ + 2, 4, 6, 7, 7, 8, 10, 10, 0, 10, 10, 8, 7, 7, 6, 4, + 5, 5, 7, 8, 8, 10, 10, 10, 0, 10, 10, 10, 8, 8, 7, 5, + 6, 7, 8, 9, 9, 10, 10, 10, 0, 10, 10, 10, 10, 9, 8, 7, + 8, 8, 9, 10, 10, 10, 10, 10, 0, 10, 10, 10, 10, 10, 10, 8, + 8, 8, 10, 10, 10, 10, 10, 10, 0, 10, 10, 10, 10, 10, 10, 8, + 9, 10, 10, 10, 10, 10, 10, 10, 0, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 0, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 0, 10, 10, 10, 10, 10, 10, 10, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 10, 10, 10, 10, 10, 10, 10, 10, 0, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 0, 10, 10, 10, 10, 10, 10, 10, + 9, 10, 10, 10, 10, 10, 10, 10, 0, 10, 10, 10, 10, 10, 10, 10, + 8, 8, 10, 10, 10, 10, 10, 10, 0, 10, 10, 10, 10, 10, 10, 8, + 8, 8, 10, 10, 10, 10, 10, 10, 0, 10, 10, 10, 10, 10, 9, 8, + 6, 7, 8, 9, 10, 10, 10, 10, 0, 10, 10, 10, 9, 9, 8, 7, + 5, 5, 7, 8, 8, 10, 10, 10, 0, 10, 10, 10, 8, 8, 7, 5 +}; + +static const uint16_t SpectrumB44Codes[] = +{ + 0x002, 0x002, 0x030, 0x000, 0x002, 0x00C, 0x1D2, 0x1AE, 0x000, 0x1AF, 0x1D3, 0x00D, + 0x003, 0x001, 0x031, 0x003, 0x01E, 0x002, 0x070, 0x0C8, 0x07E, 0x1E8, 0x1C0, 0x176, + 0x000, 0x17F, 0x1C3, 0x1EB, 0x0CF, 0x0D3, 0x073, 0x009, 0x018, 0x06A, 0x0EC, 0x1DE, + 0x1A2, 0x1CA, 0x1AA, 0x164, 0x000, 0x16D, 0x1AD, 0x1D1, 0x1EF, 0x1DD, 0x0EB, 0x06D, + 0x0E8, 0x0CA, 0x1BE, 0x1CE, 0x1DA, 0x1B6, 0x170, 0x154, 0x000, 0x153, 0x173, 0x1B1, + 0x1D7, 0x1D5, 0x343, 0x0CD, 0x0DC, 0x078, 0x340, 0x1CC, 0x1BA, 0x1A8, 0x156, 0x148, + 0x000, 0x145, 0x15F, 0x1A1, 0x1BD, 0x1D9, 0x1ED, 0x07D, 0x1BC, 0x1DC, 0x1C4, 0x1B2, + 0x17C, 0x15A, 0x14A, 0x03A, 0x000, 0x039, 0x147, 0x16B, 0x17B, 0x1B5, 0x1C9, 0x1DF, + 0x1C6, 0x1B8, 0x1A2, 0x168, 0x160, 0x14C, 0x02E, 0x024, 0x000, 0x027, 0x03D, 0x151, + 0x15D, 0x16F, 0x1A7, 0x1BF, 0x1A4, 0x174, 0x162, 0x14E, 0x140, 0x02C, 0x02A, 0x022, + 0x000, 0x021, 0x029, 0x03F, 0x143, 0x159, 0x167, 0x179, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x1A5, 0x178, 0x166, 0x158, 0x142, 0x03E, 0x028, 0x020, 0x000, 0x023, 0x02B, 0x02D, + 0x141, 0x14F, 0x163, 0x175, 0x1C7, 0x1BE, 0x1A6, 0x16E, 0x15C, 0x150, 0x03C, 0x026, + 0x000, 0x025, 0x02F, 0x14D, 0x161, 0x169, 0x1A3, 0x1B9, 0x1BD, 0x1DE, 0x1C8, 0x1B4, + 0x17A, 0x16A, 0x146, 0x038, 0x000, 0x03B, 0x14B, 0x15B, 0x17D, 0x1B3, 0x1C5, 0x1DD, + 0x0DD, 0x07C, 0x1EC, 0x1D8, 0x1BC, 0x1A0, 0x15E, 0x144, 0x000, 0x149, 0x157, 0x1A9, + 0x1BB, 0x1CD, 0x341, 0x079, 0x0E9, 0x0CC, 0x342, 0x1D4, 0x1D6, 0x1B0, 0x172, 0x152, + 0x000, 0x155, 0x171, 0x1B7, 0x1DB, 0x1CF, 0x1BF, 0x0CB, 0x019, 0x06C, 0x0EA, 0x1DC, + 0x1EE, 0x1D0, 0x1AC, 0x16C, 0x000, 0x165, 0x1AB, 0x1CB, 0x1A3, 0x1DF, 0x0ED, 0x06B, + 0x01F, 0x008, 0x072, 0x0D2, 0x0CE, 0x1EA, 0x1C2, 0x17E, 0x000, 0x177, 0x1C1, 0x1E9, + 0x07F, 0x0C9, 0x071, 0x003 +}; + +static const uint8_t SpectrumB52Bits[] = +{ + 3, 4, 4, 4, 5, 5, 6, 6, 5, 5, 5, 6, 6, 6, 7, 7, + 0, 7, 7, 6, 6, 6, 5, 5, 5, 6, 6, 5, 5, 4, 4, 4 +}; + +static const uint16_t SpectrumB52Codes[] = +{ + 0x06, 0x0E, 0x06, 0x00, 0x0A, 0x04, 0x2C, 0x12, 0x14, 0x10, 0x06, 0x2E, 0x24, 0x10, 0x4E, 0x4C, + 0x00, 0x4D, 0x4F, 0x11, 0x25, 0x2F, 0x07, 0x11, 0x15, 0x13, 0x2D, 0x05, 0x0B, 0x01, 0x07, 0x0F +}; + +static const uint8_t SpectrumB53Bits[] = +{ + 2, 3, 4, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 8, 8, + 0, 8, 8, 7, 7, 7, 6, 6, 6, 6, 6, 6, 5, 5, 4, 3 +}; + +static const uint16_t SpectrumB53Codes[] = +{ + 0x02, 0x00, 0x06, 0x1C, 0x18, 0x3E, 0x16, 0x10, 0x3C, 0x36, 0x14, 0x6A, 0x26, 0x24, 0xD2, 0xD0, + 0x00, 0xD1, 0xD3, 0x25, 0x27, 0x6B, 0x15, 0x37, 0x3D, 0x11, 0x17, 0x3F, 0x19, 0x1D, 0x07, 0x01 +}; + +static const uint8_t SpectrumB54Bits[] = +{ + 2, 3, 4, 4, 5, 6, 6, 7, 6, 6, 7, 8, 8, 8, 9, 9, + 0, 9, 9, 8, 8, 8, 7, 6, 6, 7, 6, 6, 5, 4, 4, 3 +}; + +static const uint16_t SpectrumB54Codes[] = +{ + 0x003, 0x002, 0x008, 0x000, 0x014, 0x02E, 0x00E, 0x05A, 0x00A, 0x008, 0x01A, 0x0B2, + 0x032, 0x030, 0x162, 0x160, 0x000, 0x161, 0x163, 0x031, 0x033, 0x0B3, 0x01B, 0x009, + 0x00B, 0x05B, 0x00F, 0x02F, 0x015, 0x001, 0x009, 0x003 +}; + +static const uint8_t SpectrumB62Bits[] = +{ + 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, + 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, + 0, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, + 6, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 4 +}; + +static const uint16_t SpectrumB62Codes[] = +{ + 0x0D, 0x06, 0x1C, 0x14, 0x0A, 0x04, 0x3E, 0x2E, 0x22, 0x0E, 0x06, 0x00, 0x5A, 0x4E, 0x40, 0x20, + 0x30, 0x32, 0x24, 0x12, 0x0C, 0x02, 0x78, 0x58, 0x42, 0x22, 0x0A, 0x08, 0xF6, 0xF4, 0x9A, 0x98, + 0x00, 0x99, 0x9B, 0xF5, 0xF7, 0x09, 0x0B, 0x23, 0x43, 0x59, 0x79, 0x03, 0x0D, 0x13, 0x25, 0x33, + 0x31, 0x21, 0x41, 0x4F, 0x5B, 0x01, 0x07, 0x0F, 0x23, 0x2F, 0x3F, 0x05, 0x0B, 0x15, 0x1D, 0x07 +}; + +static const uint8_t SpectrumB63Bits[] = +{ + 3, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, + 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, + 0, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 7, 7, 7, 7, 6, + 6, 8, 7, 7, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 4, 4 +}; + +static const uint16_t SpectrumB63Codes[] = +{ + 0x006, 0x00E, 0x004, 0x014, 0x010, 0x006, 0x000, 0x026, 0x01C, 0x018, 0x004, 0x05C, + 0x04A, 0x03C, 0x016, 0x0BC, 0x006, 0x008, 0x058, 0x03E, 0x036, 0x014, 0x0B6, 0x0B4, + 0x090, 0x068, 0x17E, 0x17C, 0x126, 0x124, 0x0D6, 0x0D4, 0x000, 0x0D5, 0x0D7, 0x125, + 0x127, 0x17D, 0x17F, 0x069, 0x091, 0x0B5, 0x0B7, 0x015, 0x037, 0x03F, 0x059, 0x009, + 0x007, 0x0BD, 0x017, 0x03D, 0x04B, 0x05D, 0x005, 0x019, 0x01D, 0x027, 0x001, 0x007, + 0x011, 0x015, 0x005, 0x00F +}; + +static const uint8_t SpectrumB64Bits[] = +{ + 3, 3, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, + 7, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, + 0, 10, 10, 10, 10, 9, 9, 9, 9, 9, 9, 8, 8, 8, 7, 7, + 7, 8, 7, 7, 7, 7, 7, 6, 6, 6, 6, 5, 5, 5, 4, 3 +}; + +static const uint16_t SpectrumB64Codes[] = +{ + 0x007, 0x000, 0x008, 0x01A, 0x014, 0x00C, 0x032, 0x02E, 0x01E, 0x014, 0x062, 0x05A, + 0x03A, 0x026, 0x020, 0x0B2, 0x038, 0x02C, 0x022, 0x0C0, 0x05E, 0x04A, 0x186, 0x184, + 0x160, 0x0BA, 0x092, 0x090, 0x2C6, 0x2C4, 0x172, 0x170, 0x000, 0x171, 0x173, 0x2C5, + 0x2C7, 0x091, 0x093, 0x0BB, 0x161, 0x185, 0x187, 0x04B, 0x05F, 0x0C1, 0x023, 0x02D, + 0x039, 0x0B3, 0x021, 0x027, 0x03B, 0x05B, 0x063, 0x015, 0x01F, 0x02F, 0x033, 0x00D, + 0x015, 0x01B, 0x009, 0x001 +}; + +static const uint8_t SpectrumB72Bits[] = +{ + 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5 +}; + +static const uint16_t SpectrumB72Codes[] = +{ + 0x01E, 0x016, 0x00C, 0x000, 0x038, 0x032, 0x028, 0x022, 0x01C, 0x012, 0x00E, 0x006, + 0x076, 0x06C, 0x060, 0x04E, 0x03E, 0x02A, 0x022, 0x01A, 0x012, 0x00A, 0x0FC, 0x0DC, + 0x0C6, 0x0A8, 0x094, 0x086, 0x058, 0x042, 0x040, 0x02A, 0x068, 0x07C, 0x06A, 0x056, + 0x048, 0x040, 0x02E, 0x028, 0x016, 0x010, 0x008, 0x0EA, 0x0DE, 0x0AA, 0x09A, 0x096, + 0x07A, 0x078, 0x05A, 0x032, 0x030, 0x028, 0x1FE, 0x1FC, 0x1D2, 0x1D0, 0x18A, 0x188, + 0x132, 0x130, 0x10A, 0x108, 0x000, 0x109, 0x10B, 0x131, 0x133, 0x189, 0x18B, 0x1D1, + 0x1D3, 0x1FD, 0x1FF, 0x029, 0x031, 0x033, 0x05B, 0x079, 0x07B, 0x097, 0x09B, 0x0AB, + 0x0DF, 0x0EB, 0x009, 0x011, 0x017, 0x029, 0x02F, 0x041, 0x049, 0x057, 0x06B, 0x07D, + 0x069, 0x02B, 0x041, 0x043, 0x059, 0x087, 0x095, 0x0A9, 0x0C7, 0x0DD, 0x0FD, 0x00B, + 0x013, 0x01B, 0x023, 0x02B, 0x03F, 0x04F, 0x061, 0x06D, 0x077, 0x007, 0x00F, 0x013, + 0x01D, 0x023, 0x029, 0x033, 0x039, 0x001, 0x00D, 0x017 +}; + +static const uint8_t SpectrumB73Bits[] = +{ + 3, 4, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, + 8, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 0, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, 8, 8, 7, + 8, 9, 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 5, 5, 5, 4 +}; + +static const uint16_t SpectrumB73Codes[] = +{ + 0x000, 0x006, 0x018, 0x010, 0x004, 0x03A, 0x034, 0x02A, 0x026, 0x014, 0x010, 0x07E, + 0x072, 0x06E, 0x05C, 0x052, 0x04A, 0x02C, 0x024, 0x018, 0x0F4, 0x0E0, 0x0DA, 0x0B6, + 0x0B2, 0x0A0, 0x05E, 0x04E, 0x038, 0x034, 0x1E6, 0x1B2, 0x0FA, 0x01E, 0x0F8, 0x0F0, + 0x0BE, 0x0B4, 0x0A2, 0x090, 0x04C, 0x03A, 0x1EE, 0x1E4, 0x1C6, 0x1B0, 0x178, 0x162, + 0x126, 0x124, 0x0B8, 0x06C, 0x3DA, 0x3D8, 0x38A, 0x388, 0x2F6, 0x2F4, 0x2C2, 0x2C0, + 0x176, 0x174, 0x0DC, 0x0DE, 0x000, 0x0DF, 0x0DD, 0x175, 0x177, 0x2C1, 0x2C3, 0x2F5, + 0x2F7, 0x389, 0x38B, 0x3D9, 0x3DB, 0x06D, 0x0B9, 0x125, 0x127, 0x163, 0x179, 0x1B1, + 0x1C7, 0x1E5, 0x1EF, 0x03B, 0x04D, 0x091, 0x0A3, 0x0B5, 0x0BF, 0x0F1, 0x0F9, 0x01F, + 0x0FB, 0x1B3, 0x1E7, 0x035, 0x039, 0x04F, 0x05F, 0x0A1, 0x0B3, 0x0B7, 0x0DB, 0x0E1, + 0x0F5, 0x019, 0x025, 0x02D, 0x04B, 0x053, 0x05D, 0x06F, 0x073, 0x07F, 0x011, 0x015, + 0x027, 0x02B, 0x035, 0x03B, 0x005, 0x011, 0x019, 0x007 +}; + +static const uint8_t SpectrumB74Bits[] = +{ + 3, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, + 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, + 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 0, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, + 8, 9, 9, 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, + 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 4 +}; + +static const uint16_t SpectrumB74Codes[] = +{ + 0x001, 0x008, 0x01E, 0x018, 0x00C, 0x002, 0x03A, 0x034, 0x02C, 0x01E, 0x016, 0x012, + 0x072, 0x06E, 0x05E, 0x056, 0x050, 0x038, 0x022, 0x004, 0x0E2, 0x0DA, 0x0BA, 0x0A8, + 0x076, 0x054, 0x050, 0x002, 0x000, 0x1C0, 0x1B0, 0x156, 0x0A4, 0x0A6, 0x074, 0x052, + 0x004, 0x1C2, 0x1B2, 0x170, 0x154, 0x0AE, 0x0AC, 0x086, 0x2E6, 0x2E4, 0x10A, 0x108, + 0x106, 0x104, 0x102, 0x100, 0x03E, 0x03A, 0x03C, 0x038, 0x036, 0x034, 0x032, 0x030, + 0x01E, 0x01A, 0x01C, 0x018, 0x000, 0x019, 0x01D, 0x01B, 0x01F, 0x031, 0x033, 0x035, + 0x037, 0x039, 0x03D, 0x03B, 0x03F, 0x101, 0x103, 0x105, 0x107, 0x109, 0x10B, 0x2E5, + 0x2E7, 0x087, 0x0AD, 0x0AF, 0x155, 0x171, 0x1B3, 0x1C3, 0x005, 0x053, 0x075, 0x0A7, + 0x0A5, 0x157, 0x1B1, 0x1C1, 0x001, 0x003, 0x051, 0x055, 0x077, 0x0A9, 0x0BB, 0x0DB, + 0x0E3, 0x005, 0x023, 0x039, 0x051, 0x057, 0x05F, 0x06F, 0x073, 0x013, 0x017, 0x01F, + 0x02D, 0x035, 0x03B, 0x003, 0x00D, 0x019, 0x01F, 0x009 +}; + +static const uint8_t ScaleFactorsA1Lookup[2] = +{ + 0x0, 0x1 +}; + +static const uint8_t ScaleFactorsA2Lookup[8] = +{ + 0x0, 0x0, 0x0, 0x0, 0x3, 0x3, 0x1, 0x2 +}; + +static const uint8_t ScaleFactorsA3Lookup[64] = +{ + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, + 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, + 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x2, 0x2, 0x2, 0x2, 0x5, 0x5, 0x3, 0x4 +}; + +static const uint8_t ScaleFactorsA4Lookup[256] = +{ + 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, + 0xE, 0xE, 0xE, 0xE, 0xE, 0xE, 0xE, 0xE, 0xE, 0xE, 0xE, 0xE, 0xE, 0xE, 0xE, 0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F, 0xF, 0xF, 0xF, 0xF, 0xF, 0xF, + 0xF, 0xF, 0xF, 0xF, 0xF, 0xF, 0xF, 0xF, 0xF, 0xF, 0xF, 0xF, 0xF, 0xF, 0xF, 0xF +}; + +static const uint8_t ScaleFactorsA5Lookup[256] = +{ + 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, + 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x1A, 0x1A, 0x07, 0x07, 0x14, 0x15, 0x17, 0x16, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, + 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x0B, 0x18, 0x09, 0x0A, 0x06, 0x06, 0x06, 0x06, + 0x19, 0x19, 0x13, 0x0C, 0x1B, 0x1B, 0x1B, 0x1B, 0x12, 0x0D, 0x10, 0x11, 0x0E, 0x0F, 0x08, 0x08, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02 +}; + +static const uint8_t ScaleFactorsA6Lookup[256] = +{ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, + 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, + 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, + 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, + 0x08, 0x08, 0x08, 0x08, 0x38, 0x38, 0x38, 0x38, 0x39, 0x39, 0x39, 0x39, 0x09, 0x09, 0x0A, 0x0A, + 0x35, 0x35, 0x36, 0x36, 0x37, 0x37, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, + 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, + 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, 0x34 +}; + +static const uint8_t ScaleFactorsB2Lookup[4] = +{ + 0x0, 0x0, 0x3, 0x1 +}; + +static const uint8_t ScaleFactorsB3Lookup[64] = +{ + 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0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0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 +}; + +static const uint8_t ScaleFactorsB5Lookup[256] = +{ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x0E, 0x11, 0x10, 0x12, 0x13, 0x0F, 0x0B, 0x0B, 0x1E, 0x1E, 0x1E, 0x1E, 0x0C, 0x0C, 0x1D, 0x1D, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, + 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x1C, 0x1C, 0x1B, 0x1B, 0x0A, 0x0A, 0x0A, 0x0A, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x19, 0x19, 0x1A, 0x1A, 0x18, 0x18, 0x17, 0x17, 0x16, 0x16, 0x15, 0x15, 0x0D, 0x0D, 0x14, 0x14, + 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, + 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F +}; + +static const uint8_t SpectrumA21Lookup[8] = +{ + 0x1, 0x3, 0xC, 0x4, 0x7, 0xD, 0xF, 0x5 +}; + +static const uint8_t SpectrumA22Lookup[256] = +{ + 0x11, 0x11, 0x11, 0x11, 0x33, 0x33, 0x33, 0x33, 0x51, 0x51, 0xF3, 0xF3, 0x45, 0x45, 0xCF, 0xCF, + 0xCD, 0xCD, 0x47, 0x47, 0xD1, 0xD1, 0x73, 0x73, 0xF5, 0xF5, 0x5F, 0x5F, 0x7D, 0x7D, 0xD7, 0xD7, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x74, 0x74, 0xDC, 0xDC, 0x54, 0x54, 0xFC, 0xFC, 0x1D, 0x1D, 0x37, 0x37, 0x15, 0x15, 0x3F, 0x3F, + 0x41, 0x41, 0x41, 0x41, 0xC3, 0xC3, 0xC3, 0xC3, 0xC1, 0xC1, 0xC1, 0xC1, 0x43, 0x43, 0x43, 0x43, + 0x14, 0x14, 0x14, 0x14, 0x3C, 0x3C, 0x3C, 0x3C, 0x34, 0x34, 0x34, 0x34, 0x1C, 0x1C, 0x1C, 0x1C, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, + 0xDD, 0x77, 0x75, 0xDF, 0xD5, 0x7F, 0xFD, 0x57, 0x50, 0x50, 0x50, 0x50, 0xF0, 0xF0, 0xF0, 0xF0, + 0x5D, 0xF7, 0x55, 0xFF, 0x71, 0x71, 0xD3, 0xD3, 0xD0, 0xD0, 0xD0, 0xD0, 0x70, 0x70, 0x70, 0x70, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, + 0xD4, 0xD4, 0x7C, 0x7C, 0xF1, 0xF1, 0x53, 0x53, 0x4D, 0x4D, 0xC7, 0xC7, 0xF4, 0xF4, 0x5C, 0x5C, + 0xC4, 0xC4, 0xC4, 0xC4, 0x4C, 0x4C, 0x4C, 0x4C, 0x35, 0x35, 0x1F, 0x1F, 0xC5, 0xC5, 0x4F, 0x4F, + 0x31, 0x31, 0x31, 0x31, 0x13, 0x13, 0x13, 0x13, 0x3D, 0x3D, 0x17, 0x17, 0x44, 0x44, 0xCC, 0xCC, + 0x05, 0x05, 0x05, 0x05, 0x0F, 0x0F, 0x0F, 0x0F, 0x0D, 0x0D, 0x0D, 0x0D, 0x07, 0x07, 0x07, 0x07 +}; + +static const uint8_t SpectrumA23Lookup[512] = +{ + 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0xC3, 0xC3, 0xC3, 0xC3, 0xC3, 0xC3, 0xC3, 0xC3, + 0xC1, 0xC1, 0xC1, 0xC1, 0xC1, 0xC1, 0xC1, 0xC1, 0x43, 0x43, 0x43, 0x43, 0x43, 0x43, 0x43, 0x43, + 0xC5, 0xC5, 0xC5, 0xC5, 0x4F, 0x4F, 0x4F, 0x4F, 0x4D, 0x4D, 0x4D, 0x4D, 0xC7, 0xC7, 0xC7, 0xC7, + 0xF1, 0xF1, 0xF1, 0xF1, 0x53, 0x53, 0x53, 0x53, 0xF4, 0xF4, 0xF4, 0xF4, 0x5C, 0x5C, 0x5C, 0x5C, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03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D, 0x57, 0x74, 0x74, 0xDC, 0xDC, 0x44, 0x44, 0x44, 0x44, 0xCC, 0xCC, 0xCC, 0xCC, + 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, + 0x75, 0xDF, 0xD5, 0x7F, 0x54, 0x54, 0xFC, 0xFC, 0x1D, 0x1D, 0x37, 0x37, 0x15, 0x15, 0x3F, 0x3F, + 0x11, 0x11, 0x11, 0x11, 0x33, 0x33, 0x33, 0x33, 0x5D, 0xF7, 0x55, 0xFF, 0x71, 0x71, 0xD3, 0xD3, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0 +}; + +static const uint8_t SpectrumA24Lookup[1024] = +{ + 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, + 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, + 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, + 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, + 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, + 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, + 0xD0, 0xD0, 0xD0, 0xD0, 0xD0, 0xD0, 0xD0, 0xD0, 0xD0, 0xD0, 0xD0, 0xD0, 0xD0, 0xD0, 0xD0, 0xD0, + 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, + 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x54, 0x54, 0x54, 0x54, 0xFC, 0xFC, 0xFC, 0xFC, 0x1D, 0x1D, 0x1D, 0x1D, 0x37, 0x37, 0x37, 0x37, + 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0xCC, 0xCC, 0xCC, 0xCC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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x3D, 0x3D, 0x3D, 0x3D, 0x17, 0x17, 0x17, 0x17, 0x75, 0xDF, 0xDD, 0x77, 0xD1, 0xD1, 0x73, 0x73, + 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0xC3, 0xC3, 0xC3, 0xC3, 0xC3, 0xC3, 0xC3, 0xC3, + 0xC1, 0xC1, 0xC1, 0xC1, 0xC1, 0xC1, 0xC1, 0xC1, 0x43, 0x43, 0x43, 0x43, 0x43, 0x43, 0x43, 0x43, + 0x45, 0x45, 0xCF, 0xCF, 0xCD, 0xCD, 0x47, 0x47, 0x5D, 0xF7, 0x55, 0xFF, 0x74, 0x74, 0xDC, 0xDC, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, + 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, + 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C +}; + +static const uint8_t SpectrumA31Lookup[128] = +{ + 0x32, 0x32, 0x32, 0x32, 0x16, 0x16, 0x16, 0x16, 0x0B, 0x0B, 0x0B, 0x0B, 0x3D, 0x3D, 0x3D, 0x3D, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x3B, 0x3B, 0x3B, 0x3B, 0x0D, 0x0D, 0x0D, 0x0D, 0x11, 0x11, 0x11, 0x11, 0x37, 0x37, 0x37, 0x37, + 0x31, 0x31, 0x31, 0x31, 0x17, 0x17, 0x17, 0x17, 0x18, 0x18, 0x18, 0x18, 0x28, 0x28, 0x28, 0x28, + 0x1A, 0x1A, 0x2E, 0x2E, 0x2A, 0x2A, 0x1E, 0x1E, 0x0A, 0x0A, 0x0A, 0x0A, 0x3E, 0x3E, 0x3E, 0x3E, + 0x3A, 0x3A, 0x3A, 0x3A, 0x0E, 0x0E, 0x0E, 0x0E, 0x13, 0x13, 0x35, 0x35, 0x33, 0x33, 0x15, 0x15, + 0x03, 0x03, 0x03, 0x03, 0x05, 0x05, 0x05, 0x05, 0x10, 0x10, 0x10, 0x10, 0x30, 0x30, 0x30, 0x30, + 0x19, 0x19, 0x2F, 0x2F, 0x29, 0x29, 0x1F, 0x1F, 0x1B, 0x2D, 0x2B, 0x1D, 0x12, 0x12, 0x36, 0x36 +}; + +static const uint8_t SpectrumA32Lookup[128] = +{ + 0x39, 0x39, 0x39, 0x39, 0x0F, 0x0F, 0x0F, 0x0F, 0x11, 0x11, 0x11, 0x11, 0x37, 0x37, 0x37, 0x37, + 0x31, 0x31, 0x31, 0x31, 0x17, 0x17, 0x17, 0x17, 0x3A, 0x3A, 0x3A, 0x3A, 0x0E, 0x0E, 0x0E, 0x0E, + 0x0A, 0x0A, 0x0A, 0x0A, 0x3E, 0x3E, 0x3E, 0x3E, 0x2B, 0x1D, 0x1B, 0x2D, 0x19, 0x19, 0x2F, 0x2F, + 0x29, 0x29, 0x1F, 0x1F, 0x3B, 0x3B, 0x0D, 0x0D, 0x0B, 0x0B, 0x3D, 0x3D, 0x32, 0x32, 0x16, 0x16, + 0x10, 0x10, 0x10, 0x10, 0x30, 0x30, 0x30, 0x30, 0x08, 0x08, 0x08, 0x08, 0x38, 0x38, 0x38, 0x38, + 0x12, 0x12, 0x36, 0x36, 0x18, 0x18, 0x28, 0x28, 0x02, 0x02, 0x02, 0x02, 0x06, 0x06, 0x06, 0x06, + 0x01, 0x01, 0x01, 0x01, 0x07, 0x07, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x2A, 0x1E, 0x1A, 0x2E, 0x03, 0x03, 0x05, 0x05, 0x13, 0x35, 0x33, 0x15, 0x09, 0x09, 0x3F, 0x3F +}; + +static const uint8_t SpectrumA33Lookup[256] = +{ + 0x33, 0x33, 0x15, 0x15, 0x13, 0x13, 0x35, 0x35, 0x18, 0x18, 0x18, 0x18, 0x28, 0x28, 0x28, 0x28, + 0x32, 0x32, 0x32, 0x32, 0x16, 0x16, 0x16, 0x16, 0x12, 0x12, 0x12, 0x12, 0x36, 0x36, 0x36, 0x36, + 0x03, 0x03, 0x03, 0x03, 0x05, 0x05, 0x05, 0x05, 0x2B, 0x1D, 0x1B, 0x2D, 0x19, 0x19, 0x2F, 0x2F, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, + 0x29, 0x29, 0x1F, 0x1F, 0x0B, 0x0B, 0x3D, 0x3D, 0x3B, 0x3B, 0x0D, 0x0D, 0x1A, 0x2E, 0x2A, 0x1E, + 0x31, 0x31, 0x31, 0x31, 0x17, 0x17, 0x17, 0x17, 0x11, 0x11, 0x11, 0x11, 0x37, 0x37, 0x37, 0x37, + 0x3A, 0x3A, 0x3A, 0x3A, 0x0E, 0x0E, 0x0E, 0x0E, 0x0A, 0x0A, 0x0A, 0x0A, 0x3E, 0x3E, 0x3E, 0x3E +}; + +static const uint8_t SpectrumA34Lookup[1024] = +{ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x1A, 0x1A, 0x1A, 0x1A, 0x2E, 0x2E, 0x2E, 0x2E, 0x33, 0x33, 0x33, 0x33, 0x15, 0x15, 0x15, 0x15, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x13, 0x13, 0x13, 0x13, 0x35, 0x35, 0x35, 0x35, 0x19, 0x19, 0x19, 0x19, 0x2F, 0x2F, 0x2F, 0x2F, + 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, + 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, + 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, + 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, + 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, + 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, + 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, + 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, + 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, + 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, + 0x29, 0x29, 0x29, 0x29, 0x1F, 0x1F, 0x1F, 0x1F, 0x0B, 0x0B, 0x0B, 0x0B, 0x3D, 0x3D, 0x3D, 0x3D, + 0x3B, 0x3B, 0x3B, 0x3B, 0x0D, 0x0D, 0x0D, 0x0D, 0x2B, 0x1D, 0x1B, 0x2D, 0x2A, 0x2A, 0x1E, 0x1E, + 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, + 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x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 0x4B, 0x4B, 0x62, 0x62, 0xAE, 0xAE, 0x15, 0x15, 0x15, 0x15, 0xFB, 0xFB, 0xFB, 0xFB, + 0xE7, 0xE7, 0x29, 0x29, 0xA2, 0xA2, 0x6E, 0x6E, 0xD6, 0xD6, 0x3A, 0x3A, 0x75, 0x9B, 0x95, 0x7B, + 0x50, 0x50, 0x50, 0x50, 0xB0, 0xB0, 0xB0, 0xB0, 0x14, 0x14, 0x14, 0x14, 0xFC, 0xFC, 0xFC, 0xFC, + 0x66, 0xAA, 0x57, 0xB9, 0x70, 0x70, 0x90, 0x90, 0xF5, 0xF5, 0xF5, 0xF5, 0x1B, 0x1B, 0x1B, 0x1B, + 0x40, 0x40, 0x40, 0x40, 0xC0, 0xC0, 0xC0, 0xC0, 0x43, 0x43, 0xCD, 0xCD, 0xC3, 0xC3, 0x4D, 0x4D +}; + +static const uint8_t SpectrumA42Lookup[1024] = +{ + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, + 0x71, 0x71, 0x71, 0x71, 0x9F, 0x9F, 0x9F, 0x9F, 0xA3, 0xA3, 0xA3, 0xA3, 0x6D, 0x6D, 0x6D, 0x6D, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, + 0x51, 0x51, 0x51, 0x51, 0x51, 0x51, 0x51, 0x51, 0xBF, 0xBF, 0xBF, 0xBF, 0xBF, 0xBF, 0xBF, 0xBF, + 0xB1, 0xB1, 0xB1, 0xB1, 0xB1, 0xB1, 0xB1, 0xB1, 0x5F, 0x5F, 0x5F, 0x5F, 0x5F, 0x5F, 0x5F, 0x5F, + 0x00,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, 0xEB, 0xEB, 0xEB, 0xEB, 0x22, 0x22, 0x22, 0x22, 0xEE, 0xEE, 0xEE, 0xEE, + 0xE2, 0xE2, 0xE2, 0xE2, 0x2E, 0x2E, 0x2E, 0x2E, 0x27, 0x27, 0xE9, 0xE9, 0x91, 0x91, 0x7F, 0x7F +}; + +static const uint8_t SpectrumA43Lookup[1024] = +{ + 0xF6, 0xF6, 0xF6, 0xF6, 0x1A, 0x1A, 0x1A, 0x1A, 0x16, 0x16, 0x16, 0x16, 0xFA, 0xFA, 0xFA, 0xFA, + 0xD2, 0xD2, 0xD2, 0xD2, 0xD2, 0xD2, 0xD2, 0xD2, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, + 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0xDE, 0xDE, 0xDE, 0xDE, 0xDE, 0xDE, 0xDE, 0xDE, + 0x35, 0x35, 0x35, 0x35, 0xDB, 0xDB, 0xDB, 0xDB, 0xE7, 0xE7, 0x29, 0x29, 0x27, 0x27, 0xE9, 0xE9, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, + 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xE3, 0xE3, 0xE3, 0xE3, 0xE3, 0xE3, 0xE3, 0xE3, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, + 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0xED, 0xED, 0xED, 0xED, 0xED, 0xED, 0xED, 0xED, + 0xC4, 0xC4, 0xC4, 0xC4, 0x4C, 0x4C, 0x4C, 0x4C, 0x97, 0x79, 0x77, 0x99, 0x96, 0x7A, 0xA7, 0x69, + 0x76, 0x9A, 0x67, 0xA9, 0x75, 0x9B, 0x95, 0x7B, 0x60, 0x60, 0x60, 0x60, 0xA0, 0xA0, 0xA0, 0xA0, + 0xA6, 0x6A, 0xB7, 0x59, 0x57, 0xB9, 0x66, 0xAA, 0x47, 0xC9, 0x74, 0x9C, 0x94, 0x7C, 0xC7, 0x49, + 0xB6, 0x5A, 0xA5, 0x6B, 0xB5, 0xB5, 0x5B, 0x5B, 0x44, 0x44, 0x44, 0x44, 0xCC, 0xCC, 0xCC, 0xCC, + 0x55, 0x55, 0xBB, 0xBB, 0x71, 0x71, 0x9F, 0x9F, 0x06, 0x06, 0x06, 0x06, 0x0A, 0x0A, 0x0A, 0x0A, + 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0xCF, 0xCF, 0xCF, 0xCF, 0xCF, 0xCF, 0xCF, 0xCF, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0xE0, 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F0, 0xF0, + 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, + 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xD1, 0xD1, 0xD1, 0xD1, 0xD1, 0xD1, 0xD1, 0xD1, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, + 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0xFD, 0xFD, 0xFD, 0xFD, 0xFD, 0xFD, 0xFD, 0xFD, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 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E, 0xEE, 0xEE, + 0xE2, 0xE2, 0xE2, 0xE2, 0xE2, 0xE2, 0xE2, 0xE2, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, + 0xE5, 0xE5, 0x2B, 0x2B, 0x26, 0xEA, 0xE6, 0x2A, 0x41, 0x41, 0x41, 0x41, 0xCF, 0xCF, 0xCF, 0xCF, + 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xF1, 0xF1, 0xF1, 0xF1, 0xF1, 0xF1, 0xF1, 0xF1, 0xF1, 0xF1, 0xF1, 0xF1, 0xF1, 0xF1, 0xF1, 0xF1, + 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F +}; + +static const uint8_t SpectrumA51Lookup[64] = +{ + 0x08, 0x08, 0x08, 0x08, 0x18, 0x18, 0x18, 0x18, 0x0F, 0x0F, 0x11, 0x11, 0x04, 0x04, 0x1C, 0x1C, + 0x09, 0x09, 0x09, 0x09, 0x17, 0x17, 0x17, 0x17, 0x0E, 0x0E, 0x12, 0x12, 0x03, 0x03, 0x1D, 0x1D, + 0x0D, 0x0D, 0x13, 0x13, 0x02, 0x02, 0x1E, 0x1E, 0x0C, 0x0C, 0x14, 0x14, 0x01, 0x01, 0x1F, 0x1F, + 0x07, 0x19, 0x00, 0x00, 0x0B, 0x0B, 0x15, 0x15, 0x06, 0x1A, 0x05, 0x1B, 0x0A, 0x0A, 0x16, 0x16 +}; + +static const uint8_t SpectrumA52Lookup[64] = +{ + 0x02, 0x02, 0x02, 0x02, 0x1E, 0x1E, 0x1E, 0x1E, 0x0B, 0x0B, 0x15, 0x15, 0x07, 0x07, 0x19, 0x19, + 0x01, 0x01, 0x01, 0x01, 0x1F, 0x1F, 0x1F, 0x1F, 0x06, 0x06, 0x1A, 0x1A, 0x0A, 0x0A, 0x16, 0x16, + 0x0F, 0x11, 0x0E, 0x12, 0x00, 0x00, 0x00, 0x00, 0x05, 0x05, 0x1B, 0x1B, 0x09, 0x09, 0x17, 0x17, + 0x08, 0x08, 0x18, 0x18, 0x04, 0x04, 0x1C, 0x1C, 0x0D, 0x13, 0x0C, 0x14, 0x03, 0x03, 0x1D, 0x1D +}; + +static const uint8_t SpectrumA53Lookup[128] = +{ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x09, 0x09, 0x09, 0x09, 0x17, 0x17, 0x17, 0x17, 0x07, 0x07, 0x07, 0x07, 0x19, 0x19, 0x19, 0x19, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, + 0x08, 0x08, 0x08, 0x08, 0x18, 0x18, 0x18, 0x18, 0x0F, 0x11, 0x0E, 0x12, 0x0B, 0x0B, 0x15, 0x15, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, + 0x06, 0x06, 0x06, 0x06, 0x1A, 0x1A, 0x1A, 0x1A, 0x05, 0x05, 0x05, 0x05, 0x1B, 0x1B, 0x1B, 0x1B, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, + 0x0A, 0x0A, 0x16, 0x16, 0x0D, 0x13, 0x0C, 0x14, 0x04, 0x04, 0x04, 0x04, 0x1C, 0x1C, 0x1C, 0x1C +}; + +static const uint8_t SpectrumA54Lookup[256] = +{ + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0A, 0x0A, 0x0A, 0x0A, 0x16, 0x16, 0x16, 0x16, 0x0D, 0x0D, 0x13, 0x13, 0x0C, 0x0C, 0x14, 0x14, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, + 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, + 0x09, 0x09, 0x09, 0x09, 0x17, 0x17, 0x17, 0x17, 0x0F, 0x11, 0x0E, 0x12, 0x0B, 0x0B, 0x15, 0x15, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F +}; + +static const uint8_t SpectrumA61Lookup[128] = +{ + 0x13, 0x13, 0x13, 0x13, 0x2D, 0x2D, 0x2D, 0x2D, 0x1F, 0x1F, 0x21, 0x21, 0x1E, 0x1E, 0x22, 0x22, + 0x10, 0x10, 0x10, 0x10, 0x30, 0x30, 0x30, 0x30, 0x08, 0x08, 0x38, 0x38, 0x07, 0x07, 0x39, 0x39, + 0x12, 0x12, 0x12, 0x12, 0x2E, 0x2E, 0x2E, 0x2E, 0x1D, 0x1D, 0x23, 0x23, 0x1C, 0x1C, 0x24, 0x24, + 0x06, 0x06, 0x3A, 0x3A, 0x1B, 0x1B, 0x25, 0x25, 0x11, 0x11, 0x11, 0x11, 0x2F, 0x2F, 0x2F, 0x2F, + 0x05, 0x05, 0x3B, 0x3B, 0x1A, 0x1A, 0x26, 0x26, 0x04, 0x04, 0x3C, 0x3C, 0x19, 0x19, 0x27, 0x27, + 0x03, 0x03, 0x3D, 0x3D, 0x02, 0x02, 0x3E, 0x3E, 0x18, 0x18, 0x28, 0x28, 0x0F, 0x31, 0x0E, 0x32, + 0x01, 0x01, 0x3F, 0x3F, 0x17, 0x17, 0x29, 0x29, 0x0D, 0x33, 0x00, 0x00, 0x16, 0x16, 0x2A, 0x2A, + 0x0C, 0x34, 0x0B, 0x35, 0x15, 0x15, 0x2B, 0x2B, 0x14, 0x14, 0x2C, 0x2C, 0x0A, 0x36, 0x09, 0x37 +}; + +static const uint8_t SpectrumA62Lookup[128] = +{ + 0x17, 0x17, 0x29, 0x29, 0x0F, 0x0F, 0x31, 0x31, 0x04, 0x04, 0x04, 0x04, 0x3C, 0x3C, 0x3C, 0x3C, + 0x03, 0x03, 0x03, 0x03, 0x3D, 0x3D, 0x3D, 0x3D, 0x16, 0x16, 0x2A, 0x2A, 0x0E, 0x0E, 0x32, 0x32, + 0x02, 0x02, 0x02, 0x02, 0x3E, 0x3E, 0x3E, 0x3E, 0x1F, 0x21, 0x1E, 0x22, 0x15, 0x15, 0x2B, 0x2B, + 0x0D, 0x0D, 0x33, 0x33, 0x0C, 0x0C, 0x34, 0x34, 0x01, 0x01, 0x01, 0x01, 0x3F, 0x3F, 0x3F, 0x3F, + 0x14, 0x14, 0x2C, 0x2C, 0x1D, 0x23, 0x1C, 0x24, 0x0B, 0x0B, 0x35, 0x35, 0x13, 0x13, 0x2D, 0x2D, + 0x00, 0x00, 0x00, 0x00, 0x0A, 0x0A, 0x36, 0x36, 0x12, 0x12, 0x2E, 0x2E, 0x1B, 0x25, 0x1A, 0x26, + 0x09, 0x09, 0x37, 0x37, 0x10, 0x10, 0x30, 0x30, 0x08, 0x08, 0x38, 0x38, 0x11, 0x11, 0x2F, 0x2F, + 0x07, 0x07, 0x39, 0x39, 0x19, 0x27, 0x18, 0x28, 0x06, 0x06, 0x3A, 0x3A, 0x05, 0x05, 0x3B, 0x3B +}; + +static const uint8_t SpectrumA63Lookup[256] = +{ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, + 0x0F, 0x0F, 0x0F, 0x0F, 0x31, 0x31, 0x31, 0x31, 0x19, 0x19, 0x27, 0x27, 0x18, 0x18, 0x28, 0x28, + 0x12, 0x12, 0x12, 0x12, 0x2E, 0x2E, 0x2E, 0x2E, 0x0E, 0x0E, 0x0E, 0x0E, 0x32, 0x32, 0x32, 0x32, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, + 0x1F, 0x21, 0x1E, 0x22, 0x17, 0x17, 0x29, 0x29, 0x11, 0x11, 0x11, 0x11, 0x2F, 0x2F, 0x2F, 0x2F, + 0x0D, 0x0D, 0x0D, 0x0D, 0x33, 0x33, 0x33, 0x33, 0x10, 0x10, 0x10, 0x10, 0x30, 0x30, 0x30, 0x30, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, + 0x0C, 0x0C, 0x0C, 0x0C, 0x34, 0x34, 0x34, 0x34, 0x16, 0x16, 0x2A, 0x2A, 0x1D, 0x23, 0x1C, 0x24, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, + 0x0B, 0x0B, 0x0B, 0x0B, 0x35, 0x35, 0x35, 0x35, 0x0A, 0x0A, 0x0A, 0x0A, 0x36, 0x36, 0x36, 0x36, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, + 0x15, 0x15, 0x2B, 0x2B, 0x14, 0x14, 0x2C, 0x2C, 0x09, 0x09, 0x09, 0x09, 0x37, 0x37, 0x37, 0x37, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, + 0x1B, 0x25, 0x1A, 0x26, 0x13, 0x13, 0x2D, 0x2D, 0x08, 0x08, 0x08, 0x08, 0x38, 0x38, 0x38, 0x38 +}; + +static const uint8_t SpectrumA64Lookup[512] = +{ + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + 0x1B, 0x1B, 0x25, 0x25, 0x1A, 0x1A, 0x26, 0x26, 0x15, 0x15, 0x15, 0x15, 0x2B, 0x2B, 0x2B, 0x2B, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, + 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, + 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, + 0x14, 0x14, 0x14, 0x14, 0x2C, 0x2C, 0x2C, 0x2C, 0x1F, 0x21, 0x1E, 0x22, 0x19, 0x19, 0x27, 0x27, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, + 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, + 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, + 0x13, 0x13, 0x13, 0x13, 0x2D, 0x2D, 0x2D, 0x2D, 0x18, 0x18, 0x28, 0x28, 0x1D, 0x23, 0x1C, 0x24, + 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, + 0x12, 0x12, 0x12, 0x12, 0x2E, 0x2E, 0x2E, 0x2E, 0x17, 0x17, 0x29, 0x29, 0x16, 0x16, 0x2A, 0x2A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, + 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, + 0x11, 0x11, 0x11, 0x11, 0x2F, 0x2F, 0x2F, 0x2F, 0x0F, 0x0F, 0x0F, 0x0F, 0x31, 0x31, 0x31, 0x31, + 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37 +}; + +static const uint8_t SpectrumA71Lookup[256] = +{ + 0x12, 0x12, 0x6E, 0x6E, 0x3F, 0x3F, 0x41, 0x41, 0x26, 0x26, 0x26, 0x26, 0x5A, 0x5A, 0x5A, 0x5A, + 0x11, 0x11, 0x6F, 0x6F, 0x3E, 0x3E, 0x42, 0x42, 0x3D, 0x3D, 0x43, 0x43, 0x10, 0x10, 0x70, 0x70, + 0x25, 0x25, 0x25, 0x25, 0x5B, 0x5B, 0x5B, 0x5B, 0x3C, 0x3C, 0x44, 0x44, 0x0F, 0x0F, 0x71, 0x71, + 0x20, 0x20, 0x20, 0x20, 0x60, 0x60, 0x60, 0x60, 0x3B, 0x3B, 0x45, 0x45, 0x0E, 0x0E, 0x72, 0x72, + 0x24, 0x24, 0x24, 0x24, 0x5C, 0x5C, 0x5C, 0x5C, 0x3A, 0x3A, 0x46, 0x46, 0x0D, 0x0D, 0x73, 0x73, + 0x39, 0x39, 0x47, 0x47, 0x0C, 0x0C, 0x74, 0x74, 0x23, 0x23, 0x23, 0x23, 0x5D, 0x5D, 0x5D, 0x5D, + 0x38, 0x38, 0x48, 0x48, 0x37, 0x37, 0x49, 0x49, 0x0B, 0x0B, 0x75, 0x75, 0x0A, 0x0A, 0x76, 0x76, + 0x22, 0x22, 0x22, 0x22, 0x5E, 0x5E, 0x5E, 0x5E, 0x36, 0x36, 0x4A, 0x4A, 0x09, 0x09, 0x77, 0x77, + 0x21, 0x21, 0x21, 0x21, 0x5F, 0x5F, 0x5F, 0x5F, 0x35, 0x35, 0x4B, 0x4B, 0x34, 0x34, 0x4C, 0x4C, + 0x08, 0x08, 0x78, 0x78, 0x33, 0x33, 0x4D, 0x4D, 0x32, 0x32, 0x4E, 0x4E, 0x07, 0x07, 0x79, 0x79, + 0x05, 0x05, 0x7B, 0x7B, 0x06, 0x06, 0x7A, 0x7A, 0x31, 0x31, 0x4F, 0x4F, 0x04, 0x04, 0x7C, 0x7C, + 0x1F, 0x61, 0x1E, 0x62, 0x30, 0x30, 0x50, 0x50, 0x03, 0x03, 0x7D, 0x7D, 0x1D, 0x63, 0x1C, 0x64, + 0x2F, 0x2F, 0x51, 0x51, 0x02, 0x02, 0x7E, 0x7E, 0x2E, 0x2E, 0x52, 0x52, 0x01, 0x01, 0x7F, 0x7F, + 0x1B, 0x65, 0x1A, 0x66, 0x2D, 0x2D, 0x53, 0x53, 0x00, 0x00, 0x19, 0x67, 0x2C, 0x2C, 0x54, 0x54, + 0x18, 0x68, 0x17, 0x69, 0x2B, 0x2B, 0x55, 0x55, 0x2A, 0x2A, 0x56, 0x56, 0x16, 0x6A, 0x15, 0x6B, + 0x29, 0x29, 0x57, 0x57, 0x14, 0x6C, 0x13, 0x6D, 0x28, 0x28, 0x58, 0x58, 0x27, 0x27, 0x59, 0x59 +}; + +static const uint8_t SpectrumA72Lookup[256] = +{ + 0x2F, 0x2F, 0x51, 0x51, 0x2E, 0x2E, 0x52, 0x52, 0x08, 0x08, 0x08, 0x08, 0x78, 0x78, 0x78, 0x78, + 0x1F, 0x1F, 0x61, 0x61, 0x2D, 0x2D, 0x53, 0x53, 0x07, 0x07, 0x07, 0x07, 0x79, 0x79, 0x79, 0x79, + 0x1E, 0x1E, 0x62, 0x62, 0x1D, 0x1D, 0x63, 0x63, 0x06, 0x06, 0x06, 0x06, 0x7A, 0x7A, 0x7A, 0x7A, + 0x3F, 0x41, 0x3E, 0x42, 0x2C, 0x2C, 0x54, 0x54, 0x05, 0x05, 0x05, 0x05, 0x7B, 0x7B, 0x7B, 0x7B, + 0x1C, 0x1C, 0x64, 0x64, 0x2B, 0x2B, 0x55, 0x55, 0x04, 0x04, 0x04, 0x04, 0x7C, 0x7C, 0x7C, 0x7C, + 0x1B, 0x1B, 0x65, 0x65, 0x1A, 0x1A, 0x66, 0x66, 0x2A, 0x2A, 0x56, 0x56, 0x3D, 0x43, 0x3C, 0x44, + 0x03, 0x03, 0x03, 0x03, 0x7D, 0x7D, 0x7D, 0x7D, 0x19, 0x19, 0x67, 0x67, 0x29, 0x29, 0x57, 0x57, + 0x02, 0x02, 0x02, 0x02, 0x7E, 0x7E, 0x7E, 0x7E, 0x18, 0x18, 0x68, 0x68, 0x3B, 0x45, 0x3A, 0x46, + 0x28, 0x28, 0x58, 0x58, 0x17, 0x17, 0x69, 0x69, 0x27, 0x27, 0x59, 0x59, 0x16, 0x16, 0x6A, 0x6A, + 0x01, 0x01, 0x01, 0x01, 0x7F, 0x7F, 0x7F, 0x7F, 0x39, 0x47, 0x38, 0x48, 0x15, 0x15, 0x6B, 0x6B, + 0x26, 0x26, 0x5A, 0x5A, 0x14, 0x14, 0x6C, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x37, 0x49, 0x36, 0x4A, + 0x25, 0x25, 0x5B, 0x5B, 0x13, 0x13, 0x6D, 0x6D, 0x12, 0x12, 0x6E, 0x6E, 0x24, 0x24, 0x5C, 0x5C, + 0x35, 0x4B, 0x34, 0x4C, 0x11, 0x11, 0x6F, 0x6F, 0x23, 0x23, 0x5D, 0x5D, 0x20, 0x20, 0x60, 0x60, + 0x10, 0x10, 0x70, 0x70, 0x0F, 0x0F, 0x71, 0x71, 0x22, 0x22, 0x5E, 0x5E, 0x33, 0x4D, 0x32, 0x4E, + 0x0E, 0x0E, 0x72, 0x72, 0x0D, 0x0D, 0x73, 0x73, 0x21, 0x21, 0x5F, 0x5F, 0x0C, 0x0C, 0x74, 0x74, + 0x31, 0x4F, 0x30, 0x50, 0x0B, 0x0B, 0x75, 0x75, 0x0A, 0x0A, 0x76, 0x76, 0x09, 0x09, 0x77, 0x77 +}; + +static const uint8_t SpectrumA73Lookup[512] = +{ + 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x71, 0x71, 0x71, 0x71, 0x71, 0x71, 0x71, 0x71, + 0x1F, 0x1F, 0x1F, 0x1F, 0x61, 0x61, 0x61, 0x61, 0x33, 0x33, 0x4D, 0x4D, 0x32, 0x32, 0x4E, 0x4E, + 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x72, 0x72, 0x72, 0x72, 0x72, 0x72, 0x72, 0x72, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x25, 0x25, 0x25, 0x25, 0x5B, 0x5B, 0x5B, 0x5B, 0x1E, 0x1E, 0x1E, 0x1E, 0x62, 0x62, 0x62, 0x62, + 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x73, 0x73, 0x73, 0x73, 0x73, 0x73, 0x73, 0x73, + 0x1D, 0x1D, 0x1D, 0x1D, 0x63, 0x63, 0x63, 0x63, 0x31, 0x31, 0x4F, 0x4F, 0x3F, 0x41, 0x3E, 0x42, + 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x74, 0x74, 0x74, 0x74, 0x74, 0x74, 0x74, 0x74, + 0x24, 0x24, 0x24, 0x24, 0x5C, 0x5C, 0x5C, 0x5C, 0x1C, 0x1C, 0x1C, 0x1C, 0x64, 0x64, 0x64, 0x64, + 0x23, 0x23, 0x23, 0x23, 0x5D, 0x5D, 0x5D, 0x5D, 0x30, 0x30, 0x50, 0x50, 0x2F, 0x2F, 0x51, 0x51, + 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x76, 0x76, 0x76, 0x76, 0x76, 0x76, 0x76, 0x76, + 0x1B, 0x1B, 0x1B, 0x1B, 0x65, 0x65, 0x65, 0x65, 0x22, 0x22, 0x22, 0x22, 0x5E, 0x5E, 0x5E, 0x5E, + 0x3D, 0x43, 0x3C, 0x44, 0x2E, 0x2E, 0x52, 0x52, 0x1A, 0x1A, 0x1A, 0x1A, 0x66, 0x66, 0x66, 0x66, + 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, + 0x20, 0x20, 0x20, 0x20, 0x60, 0x60, 0x60, 0x60, 0x21, 0x21, 0x21, 0x21, 0x5F, 0x5F, 0x5F, 0x5F, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, + 0x19, 0x19, 0x19, 0x19, 0x67, 0x67, 0x67, 0x67, 0x2D, 0x2D, 0x53, 0x53, 0x3B, 0x45, 0x3A, 0x46, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, + 0x18, 0x18, 0x18, 0x18, 0x68, 0x68, 0x68, 0x68, 0x17, 0x17, 0x17, 0x17, 0x69, 0x69, 0x69, 0x69, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, + 0x2C, 0x2C, 0x54, 0x54, 0x39, 0x47, 0x38, 0x48, 0x16, 0x16, 0x16, 0x16, 0x6A, 0x6A, 0x6A, 0x6A, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, + 0x2B, 0x2B, 0x55, 0x55, 0x2A, 0x2A, 0x56, 0x56, 0x15, 0x15, 0x15, 0x15, 0x6B, 0x6B, 0x6B, 0x6B, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, + 0x14, 0x14, 0x14, 0x14, 0x6C, 0x6C, 0x6C, 0x6C, 0x37, 0x49, 0x36, 0x4A, 0x29, 0x29, 0x57, 0x57, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, + 0x13, 0x13, 0x13, 0x13, 0x6D, 0x6D, 0x6D, 0x6D, 0x12, 0x12, 0x12, 0x12, 0x6E, 0x6E, 0x6E, 0x6E, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, + 0x28, 0x28, 0x58, 0x58, 0x35, 0x4B, 0x34, 0x4C, 0x11, 0x11, 0x11, 0x11, 0x6F, 0x6F, 0x6F, 0x6F, + 0x27, 0x27, 0x59, 0x59, 0x26, 0x26, 0x5A, 0x5A, 0x10, 0x10, 0x10, 0x10, 0x70, 0x70, 0x70, 0x70, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F +}; + +static const uint8_t SpectrumA74Lookup[1024] = +{ + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, + 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, + 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, + 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, + 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, + 0x35, 0x35, 0x4B, 0x4B, 0x34, 0x34, 0x4C, 0x4C, 0x2A, 0x2A, 0x2A, 0x2A, 0x56, 0x56, 0x56, 0x56, + 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, + 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, + 0x71, 0x71, 0x71, 0x71, 0x71, 0x71, 0x71, 0x71, 0x71, 0x71, 0x71, 0x71, 0x71, 0x71, 0x71, 0x71, + 0x3F, 0x41, 0x3E, 0x42, 0x33, 0x33, 0x4D, 0x4D, 0x29, 0x29, 0x29, 0x29, 0x57, 0x57, 0x57, 0x57, + 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, + 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, + 0x72, 0x72, 0x72, 0x72, 0x72, 0x72, 0x72, 0x72, 0x72, 0x72, 0x72, 0x72, 0x72, 0x72, 0x72, 0x72, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, + 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, + 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, + 0x73, 0x73, 0x73, 0x73, 0x73, 0x73, 0x73, 0x73, 0x73, 0x73, 0x73, 0x73, 0x73, 0x73, 0x73, 0x73, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, + 0x28, 0x28, 0x28, 0x28, 0x58, 0x58, 0x58, 0x58, 0x32, 0x32, 0x4E, 0x4E, 0x3D, 0x43, 0x3C, 0x44, + 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, + 0x74, 0x74, 0x74, 0x74, 0x74, 0x74, 0x74, 0x74, 0x74, 0x74, 0x74, 0x74, 0x74, 0x74, 0x74, 0x74, + 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x67, 0x67, 0x67, 0x67, 0x67, 0x67, 0x67, 0x67, + 0x27, 0x27, 0x27, 0x27, 0x59, 0x59, 0x59, 0x59, 0x31, 0x31, 0x4F, 0x4F, 0x30, 0x30, 0x50, 0x50, + 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, + 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, + 0x26, 0x26, 0x26, 0x26, 0x5A, 0x5A, 0x5A, 0x5A, 0x3B, 0x45, 0x3A, 0x46, 0x2F, 0x2F, 0x51, 0x51, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x76, 0x76, 0x76, 0x76, 0x76, 0x76, 0x76, 0x76, 0x76, 0x76, 0x76, 0x76, 0x76, 0x76, 0x76, 0x76, + 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, + 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, + 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x69, 0x69, 0x69, 0x69, 0x69, 0x69, 0x69, 0x69, + 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x6A, 0x6A, 0x6A, 0x6A, 0x6A, 0x6A, 0x6A, 0x6A, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, + 0x25, 0x25, 0x25, 0x25, 0x5B, 0x5B, 0x5B, 0x5B, 0x24, 0x24, 0x24, 0x24, 0x5C, 0x5C, 0x5C, 0x5C, + 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x6B, 0x6B, 0x6B, 0x6B, 0x6B, 0x6B, 0x6B, 0x6B, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, + 0x39, 0x47, 0x38, 0x48, 0x2E, 0x2E, 0x52, 0x52, 0x23, 0x23, 0x23, 0x23, 0x5D, 0x5D, 0x5D, 0x5D, + 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, + 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x6D, 0x6D, 0x6D, 0x6D, 0x6D, 0x6D, 0x6D, 0x6D, + 0x2D, 0x2D, 0x53, 0x53, 0x2C, 0x2C, 0x54, 0x54, 0x1F, 0x1F, 0x1F, 0x1F, 0x61, 0x61, 0x61, 0x61, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, + 0x22, 0x22, 0x22, 0x22, 0x5E, 0x5E, 0x5E, 0x5E, 0x37, 0x49, 0x36, 0x4A, 0x2B, 0x2B, 0x55, 0x55, + 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x6E, 0x6E, 0x6E, 0x6E, 0x6E, 0x6E, 0x6E, 0x6E, + 0x1E, 0x1E, 0x1E, 0x1E, 0x62, 0x62, 0x62, 0x62, 0x21, 0x21, 0x21, 0x21, 0x5F, 0x5F, 0x5F, 0x5F, + 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x6F, 0x6F, 0x6F, 0x6F, 0x6F, 0x6F, 0x6F, 0x6F +}; + +static const uint8_t SpectrumB22Lookup[1024] = +{ + 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50,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, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 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0x41, 0x41, 0x41, 0xC3, 0xC3, 0xC3, 0xC3, 0xC1, 0xC1, 0xC1, 0xC1, 0x43, 0x43, 0x43, 0x43, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, + 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, + 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, + 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03 +}; + +static const uint8_t SpectrumB23Lookup[1024] = +{ + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, + 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, + 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, + 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 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D7, 0x55, 0xFF, 0x74, 0xDC, 0xF1, 0x53, 0x4D, 0xC7, 0x54, 0xFC, 0x1D, 0x1D, 0x37, 0x37, + 0x3D, 0x3D, 0x3D, 0x3D, 0x17, 0x17, 0x17, 0x17, 0x35, 0x35, 0x35, 0x35, 0x1F, 0x1F, 0x1F, 0x1F, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0xC1, 0xC1, 0xC1, 0xC1, 0x43, 0x43, 0x43, 0x43, 0x41, 0x41, 0x41, 0x41, 0xC3, 0xC3, 0xC3, 0xC3, + 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0x4C, 0x4C, 0x4C, 0x4C, 0x4C, 0x4C, 0x4C, 0x4C, + 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, + 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, + 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, + 0xD0, 0xD0, 0xD0, 0xD0, 0xD0, 0xD0, 0xD0, 0xD0, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, + 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, + 0x71, 0xD3, 0xC5, 0x4F, 0x44, 0x44, 0xCC, 0xCC, 0x11, 0x11, 0x33, 0x33, 0xF4, 0xF4, 0x5C, 0x5C, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +static const uint8_t SpectrumB24Lookup[1024] = +{ + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, + 0xC1, 0xC1, 0xC1, 0xC1, 0x43, 0x43, 0x43, 0x43, 0xD5, 0x7F, 0xFD, 0x57, 0x5D, 0xF7, 0x75, 0xDF, + 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, + 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0x4C, 0x4C, 0x4C, 0x4C, 0x4C, 0x4C, 0x4C, 0x4C, + 0xD0, 0xD0, 0xD0, 0xD0, 0xD0, 0xD0, 0xD0, 0xD0, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, + 0xDD, 0x77, 0xF5, 0x5F, 0x45, 0xCF, 0x55, 0xFF, 0xD1, 0x73, 0xCD, 0x47, 0x51, 0xF3, 0x7D, 0xD7, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, + 0x74, 0xDC, 0x54, 0xFC, 0x1D, 0x37, 0x71, 0xD3, 0xF1, 0x53, 0x15, 0x3F, 0xC5, 0x4F, 0x4D, 0xC7, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, + 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, + 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, + 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0xD4, 0x7C, 0xF4, 0x5C, 0x44, 0x44, 0xCC, 0xCC, 0x35, 0x35, 0x1F, 0x1F, 0x3D, 0x3D, 0x17, 0x17, + 0x11, 0x11, 0x33, 0x33, 0x41, 0x41, 0xC3, 0xC3, 0x14, 0x14, 0x14, 0x14, 0x3C, 0x3C, 0x3C, 0x3C, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, + 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +static const uint8_t SpectrumB32Lookup[512] = +{ + 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, + 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, + 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, + 0x13, 0x13, 0x13, 0x13, 0x35, 0x35, 0x35, 0x35, 0x19, 0x19, 0x19, 0x19, 0x2F, 0x2F, 0x2F, 0x2F, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, + 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, + 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, + 0x2A, 0x2A, 0x1E, 0x1E, 0x2B, 0x1D, 0x1B, 0x2D, 0x29, 0x29, 0x29, 0x29, 0x1F, 0x1F, 0x1F, 0x1F, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, + 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, + 0x0B, 0x0B, 0x0B, 0x0B, 0x3D, 0x3D, 0x3D, 0x3D, 0x1A, 0x1A, 0x2E, 0x2E, 0x33, 0x33, 0x15, 0x15, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + 0x12, 0x12, 0x12, 0x12, 0x36, 0x36, 0x36, 0x36, 0x32, 0x32, 0x32, 0x32, 0x16, 0x16, 0x16, 0x16, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06 +}; + +static const uint8_t SpectrumB33Lookup[1024] = +{ + 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, + 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, + 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, + 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, + 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, + 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, + 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, + 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, + 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, + 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, + 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, + 0x33, 0x33, 0x33, 0x33, 0x15, 0x15, 0x15, 0x15, 0x1B, 0x2D, 0x2B, 0x1D, 0x1A, 0x1A, 0x2E, 0x2E, + 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, + 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, + 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, + 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, + 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, + 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, + 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, + 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, + 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x19, 0x19, 0x19, 0x19, 0x2F, 0x2F, 0x2F, 0x2F, 0x2A, 0x2A, 0x1E, 0x1E, 0x13, 0x13, 0x35, 0x35, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, + 0x29, 0x29, 0x29, 0x29, 0x1F, 0x1F, 0x1F, 0x1F, 0x0B, 0x0B, 0x0B, 0x0B, 0x3D, 0x3D, 0x3D, 0x3D, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +static const uint8_t SpectrumB34Lookup[1024] = +{ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, + 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, + 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, + 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x3B, 0x3B, 0x3B, 0x3B, 0x0D, 0x0D, 0x0D, 0x0D, 0x1B, 0x2D, 0x2B, 0x1D, 0x1A, 0x2E, 0x33, 0x15, + 0x12, 0x12, 0x12, 0x12, 0x36, 0x36, 0x36, 0x36, 0x32, 0x32, 0x32, 0x32, 0x16, 0x16, 0x16, 0x16, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, + 0x18, 0x18, 0x18, 0x18, 0x28, 0x28, 0x28, 0x28, 0x13, 0x35, 0x2A, 0x1E, 0x19, 0x19, 0x2F, 0x2F, + 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, + 0x0B, 0x0B, 0x3D, 0x3D, 0x29, 0x29, 0x1F, 0x1F, 0x03, 0x03, 0x03, 0x03, 0x05, 0x05, 0x05, 0x05, + 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, + 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, + 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, + 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F +}; + +static const uint8_t SpectrumB42Lookup[1024] = +{ + 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0xEF, 0xEF, 0xEF, 0xEF, 0xEF, 0xEF, 0xEF, 0xEF, + 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0xEC, 0xEC, 0xEC, 0xEC, 0xEC, 0xEC, 0xEC, 0xEC, + 0x77, 0x99, 0x97, 0x79, 0x76, 0x9A, 0xA7, 0x69, 0xF7, 0xF7, 0xF7, 0xF7, 0x19, 0x19, 0x19, 0x19, + 0x70, 0x70, 0x70, 0x70, 0x90, 0x90, 0x90, 0x90, 0x96, 0x7A, 0x67, 0xA9, 0x57, 0xB9, 0xB7, 0x59, + 0x35, 0x35, 0x35, 0x35, 0xDB, 0xDB, 0xDB, 0xDB, 0xD5, 0xD5, 0xD5, 0xD5, 0x3B, 0x3B, 0x3B, 0x3B, + 0xE4, 0xE4, 0xE4, 0xE4, 0xE4, 0xE4, 0xE4, 0xE4, 0x2C, 0x2C, 0x2C, 0x2C, 0x2C, 0x2C, 0x2C, 0x2C, + 0xE1, 0xE1, 0xE1, 0xE1, 0xE1, 0xE1, 0xE1, 0xE1, 0x2F, 0x2F, 0x2F, 0x2F, 0x2F, 0x2F, 0x2F, 0x2F, + 0xA6, 0x6A, 0x66, 0xAA, 0x95, 0x7B, 0x75, 0x9B, 0x72, 0x72, 0x9E, 0x9E, 0xA5, 0x6B, 0x94, 0x7C, + 0x51, 0x51, 0x51, 0x51, 0x51, 0x51, 0x51, 0x51, 0xBF, 0xBF, 0xBF, 0xBF, 0xBF, 0xBF, 0xBF, 0xBF, + 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0xFB, 0xFB,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D0, 0x44, 0x44, 0xCC, 0xCC, 0xA4, 0x6C, 0x64, 0xAC, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x03, 0x03, 0x03, 0x0D, 0x0D, 0x0D, 0x0D, 0x17, 0x17, 0xF9, 0xF9, 0xE6, 0xE6, 0x2A, 0x2A, + 0x53, 0x53, 0xBD, 0xBD, 0xB5, 0x5B, 0xC6, 0x4A, 0x06, 0x06, 0x06, 0x06, 0x0A, 0x0A, 0x0A, 0x0A, + 0x42, 0x42, 0x42, 0x42, 0xCE, 0xCE, 0xCE, 0xCE, 0xB3, 0xB3, 0x5D, 0x5D, 0x46, 0xCA, 0x55, 0xBB, + 0xC2, 0xC2, 0xC2, 0xC2, 0x4E, 0x4E, 0x4E, 0x4E, 0xC4, 0xC4, 0x4C, 0x4C, 0x31, 0x31, 0xDF, 0xDF +}; + +static const uint8_t SpectrumB43Lookup[1024] = +{ + 0xC1, 0xC1, 0xC1, 0xC1, 0xC1, 0xC1, 0xC1, 0xC1, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xD0, 0xD0, 0xD0, 0xD0, 0x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x42, 0x42, 0x42, 0x42, 0xCE, 0xCE, 0xCE, 0xCE, 0x51, 0x51, 0x51, 0x51, 0xBF, 0xBF, 0xBF, 0xBF, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x07, 0x07, 0x09, 0x09, 0x61, 0x61, 0xAF, 0xAF, 0x24, 0x24, 0x24, 0x24, 0xEC, 0xEC, 0xEC, 0xEC, + 0xC2, 0xC2, 0xC2, 0xC2, 0x4E, 0x4E, 0x4E, 0x4E, 0xB1, 0xB1, 0xB1, 0xB1, 0x5F, 0x5F, 0x5F, 0x5F, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, + 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, + 0x15, 0x15, 0x15, 0x15, 0xFB, 0xFB, 0xFB, 0xFB, 0xF5, 0xF5, 0xF5, 0xF5, 0x1B, 0x1B, 0x1B, 0x1B, + 0xE4, 0xE4, 0xE4, 0xE4, 0x2C, 0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0x41, 0xCF, 0xCF, 0xCF, 0xCF, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, + 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F +}; + +static const uint8_t SpectrumB44Lookup[1024] = +{ + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, + 0x97, 0x79, 0x77, 0x99, 0x67, 0xA9, 0xA7, 0x69, 0x96, 0x7A, 0x76, 0x9A, 0x75, 0x9B, 0x66, 0xAA, + 0x05, 0x05, 0x05, 0x05, 0x0B, 0x0B, 0x0B, 0x0B, 0xB7, 0x59, 0x57, 0xB9, 0xA6, 0x6A, 0x95, 0x7B, + 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, + 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0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0x3D, 0xD4, 0x3C, 0xC3, 0x4D, 0x34, 0xDC, 0x51, 0xBF, 0xB1, 0x5F, + 0x41, 0x41, 0x41, 0x41, 0xCF, 0xCF, 0xCF, 0xCF, 0x15, 0xFB, 0xF5, 0x1B, 0xC2, 0x4E, 0xE4, 0x2C, + 0xC1, 0xC1, 0xC1, 0xC1, 0x4F, 0x4F, 0x4F, 0x4F, 0x14, 0x14, 0x14, 0x14, 0xFC, 0xFC, 0xFC, 0xFC, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, + 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, + 0x13, 0x13, 0x13, 0x13, 0xFD, 0xFD, 0xFD, 0xFD, 0x31, 0x31, 0x31, 0x31, 0xDF, 0xDF, 0xDF, 0xDF, + 0xD1, 0xD1, 0xD1, 0xD1, 0x3F, 0x3F, 0x3F, 0x3F, 0xF4, 0xF4, 0xF4, 0xF4, 0x1C, 0x1C, 0x1C, 0x1C, + 0x42, 0xCE, 0xD2, 0x3E, 0x24, 0x24, 0xEC, 0xEC, 0xF3, 0xF3, 0xF3, 0xF3, 0x1D, 0x1D, 0x1D, 0x1D, + 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0xEF, 0xEF, 0xEF, 0xEF, 0xEF, 0xEF, 0xEF, 0xEF, + 0xE1, 0xE1, 0xE1, 0xE1, 0xE1, 0xE1, 0xE1, 0xE1, 0x2F, 0x2F, 0x2F, 0x2F, 0x2F, 0x2F, 0x2F, 0x2F, + 0x40, 0x40, 0x40, 0x40, 0xC0, 0xC0, 0xC0, 0xC0, 0x50, 0x50, 0xB0, 0xB0, 0x32, 0x32, 0xDE, 0xDE, + 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, + 0xF2, 0xF2, 0xF2, 0xF2, 0xF2, 0xF2, 0xF2, 0xF2, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, + 0x30, 0x30, 0x30, 0x30, 0xD0, 0xD0, 0xD0, 0xD0, 0xE2, 0xE2, 0xE2, 0xE2, 0x2E, 0x2E, 0x2E, 0x2E, + 0x22, 0x22, 0x22, 0x22, 0xEE, 0xEE, 0xEE, 0xEE, 0xE3, 0xE3, 0x2D, 0x2D, 0x23, 0x23, 0xED, 0xED, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, + 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0 +}; + +static const uint8_t SpectrumB52Lookup[128] = +{ + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, + 0x05, 0x05, 0x05, 0x05, 0x1B, 0x1B, 0x1B, 0x1B, 0x0A, 0x0A, 0x0A, 0x0A, 0x16, 0x16, 0x16, 0x16, + 0x0D, 0x0D, 0x13, 0x13, 0x07, 0x07, 0x19, 0x19, 0x04, 0x04, 0x04, 0x04, 0x1C, 0x1C, 0x1C, 0x1C, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, + 0x09, 0x09, 0x09, 0x09, 0x17, 0x17, 0x17, 0x17, 0x0C, 0x0C, 0x14, 0x14, 0x0F, 0x11, 0x0E, 0x12, + 0x08, 0x08, 0x08, 0x08, 0x18, 0x18, 0x18, 0x18, 0x06, 0x06, 0x1A, 0x1A, 0x0B, 0x0B, 0x15, 0x15, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F +}; + +static const uint8_t SpectrumB53Lookup[256] = +{ + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, + 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, + 0x07, 0x07, 0x07, 0x07, 0x19, 0x19, 0x19, 0x19, 0x0D, 0x0D, 0x13, 0x13, 0x0C, 0x0C, 0x14, 0x14, + 0x0A, 0x0A, 0x0A, 0x0A, 0x16, 0x16, 0x16, 0x16, 0x06, 0x06, 0x06, 0x06, 0x1A, 0x1A, 0x1A, 0x1A, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, + 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, + 0x0F, 0x11, 0x0E, 0x12, 0x0B, 0x0B, 0x15, 0x15, 0x09, 0x09, 0x09, 0x09, 0x17, 0x17, 0x17, 0x17, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, + 0x08, 0x08, 0x08, 0x08, 0x18, 0x18, 0x18, 0x18, 0x05, 0x05, 0x05, 0x05, 0x1B, 0x1B, 0x1B, 0x1B +}; + +static const uint8_t SpectrumB54Lookup[512] = +{ + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, + 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, + 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x0D, 0x0D, 0x13, 0x13, 0x0C, 0x0C, 0x14, 0x14, 0x0A, 0x0A, 0x0A, 0x0A, 0x16, 0x16, 0x16, 0x16, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 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07, 0x19, 0x19, 0x19, 0x19, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +static const uint8_t SpectrumB62Lookup[256] = +{ + 0x0B, 0x0B, 0x0B, 0x0B, 0x35, 0x35, 0x35, 0x35, 0x15, 0x15, 0x15, 0x15, 0x2B, 0x2B, 0x2B, 0x2B, + 0x1B, 0x1B, 0x25, 0x25, 0x1A, 0x1A, 0x26, 0x26, 0x0A, 0x0A, 0x0A, 0x0A, 0x36, 0x36, 0x36, 0x36, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, + 0x14, 0x14, 0x14, 0x14, 0x2C, 0x2C, 0x2C, 0x2C, 0x09, 0x09, 0x09, 0x09, 0x37, 0x37, 0x37, 0x37, + 0x0F, 0x0F, 0x31, 0x31, 0x19, 0x19, 0x27, 0x27, 0x13, 0x13, 0x13, 0x13, 0x2D, 0x2D, 0x2D, 0x2D, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, + 0x0E, 0x0E, 0x32, 0x32, 0x18, 0x18, 0x28, 0x28, 0x08, 0x08, 0x08, 0x08, 0x38, 0x38, 0x38, 0x38, + 0x12, 0x12, 0x12, 0x12, 0x2E, 0x2E, 0x2E, 0x2E, 0x1F, 0x21, 0x1E, 0x22, 0x0D, 0x0D, 0x33, 0x33, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, + 0x17, 0x17, 0x29, 0x29, 0x0C, 0x0C, 0x34, 0x34, 0x07, 0x07, 0x07, 0x07, 0x39, 0x39, 0x39, 0x39, + 0x10, 0x10, 0x10, 0x10, 0x30, 0x30, 0x30, 0x30, 0x11, 0x11, 0x11, 0x11, 0x2F, 0x2F, 0x2F, 0x2F, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, + 0x16, 0x16, 0x2A, 0x2A, 0x1D, 0x23, 0x1C, 0x24, 0x06, 0x06, 0x06, 0x06, 0x3A, 0x3A, 0x3A, 0x3A +}; + +static const uint8_t SpectrumB63Lookup[512] = +{ + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x2F, 0x2F, 0x2F, 0x2F, 0x2F, 0x2F, 0x2F, 0x2F, + 0x15, 0x15, 0x15, 0x15, 0x2B, 0x2B, 0x2B, 0x2B, 0x0E, 0x0E, 0x0E, 0x0E, 0x32, 0x32, 0x32, 0x32, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, + 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, + 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, + 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, + 0x19, 0x19, 0x27, 0x27, 0x1F, 0x21, 0x1E, 0x22, 0x14, 0x14, 0x14, 0x14, 0x2C, 0x2C, 0x2C, 0x2C, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, + 0x0D, 0x0D, 0x0D, 0x0D, 0x33, 0x33, 0x33, 0x33, 0x13, 0x13, 0x13, 0x13, 0x2D, 0x2D, 0x2D, 0x2D, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, + 0x18, 0x18, 0x28, 0x28, 0x1D, 0x23, 0x1C, 0x24, 0x0C, 0x0C, 0x0C, 0x0C, 0x34, 0x34, 0x34, 0x34, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, + 0x12, 0x12, 0x12, 0x12, 0x2E, 0x2E, 0x2E, 0x2E, 0x17, 0x17, 0x29, 0x29, 0x16, 0x16, 0x2A, 0x2A, + 0x0B, 0x0B, 0x0B, 0x0B, 0x35, 0x35, 0x35, 0x35, 0x0F, 0x0F, 0x31, 0x31, 0x1B, 0x25, 0x1A, 0x26, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, + 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F +}; + +static const uint8_t SpectrumB64Lookup[1024] = +{ + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, + 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, + 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, + 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, + 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x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, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, + 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, 0x3B, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, + 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E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, 0x39, 0x39, 0x39, + 0x13, 0x13, 0x13, 0x13, 0x2D, 0x2D, 0x2D, 0x2D, 0x17, 0x17, 0x29, 0x29, 0x16, 0x16, 0x2A, 0x2A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, + 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +static const uint8_t SpectrumB72Lookup[512] = +{ + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, + 0x2A, 0x2A, 0x2A, 0x2A, 0x56, 0x56, 0x56, 0x56, 0x15, 0x15, 0x15, 0x15, 0x6B, 0x6B, 0x6B, 0x6B, + 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, + 0x29, 0x29, 0x29, 0x29, 0x57, 0x57, 0x57, 0x57, 0x14, 0x14, 0x14, 0x14, 0x6C, 0x6C, 0x6C, 0x6C, + 0x35, 0x35, 0x4B, 0x4B, 0x1F, 0x1F, 0x61, 0x61, 0x28, 0x28, 0x28, 0x28, 0x58, 0x58, 0x58, 0x58, + 0x34, 0x34, 0x4C, 0x4C, 0x33, 0x33, 0x4D, 0x4D, 0x13, 0x13, 0x13, 0x13, 0x6D, 0x6D, 0x6D, 0x6D, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x76, 0x76, 0x76, 0x76, 0x76, 0x76, 0x76, 0x76, + 0x1E, 0x1E, 0x62, 0x62, 0x1D, 0x1D, 0x63, 0x63, 0x12, 0x12, 0x12, 0x12, 0x6E, 0x6E, 0x6E, 0x6E, + 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, + 0x27, 0x27, 0x27, 0x27, 0x59, 0x59, 0x59, 0x59, 0x11, 0x11, 0x11, 0x11, 0x6F, 0x6F, 0x6F, 0x6F, + 0x1C, 0x1C, 0x64, 0x64, 0x32, 0x32, 0x4E, 0x4E, 0x26, 0x26, 0x26, 0x26, 0x5A, 0x5A, 0x5A, 0x5A, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, + 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, + 0x31, 0x31, 0x4F, 0x4F, 0x30, 0x30, 0x50, 0x50, 0x10, 0x10, 0x10, 0x10, 0x70, 0x70, 0x70, 0x70, + 0x25, 0x25, 0x25, 0x25, 0x5B, 0x5B, 0x5B, 0x5B, 0x3F, 0x41, 0x3E, 0x42, 0x1B, 0x1B, 0x65, 0x65, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, + 0x24, 0x24, 0x24, 0x24, 0x5C, 0x5C, 0x5C, 0x5C, 0x1A, 0x1A, 0x66, 0x66, 0x2F, 0x2F, 0x51, 0x51, + 0x3D, 0x43, 0x3C, 0x44, 0x2E, 0x2E, 0x52, 0x52, 0x0F, 0x0F, 0x0F, 0x0F, 0x71, 0x71, 0x71, 0x71, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, + 0x19, 0x19, 0x67, 0x67, 0x2D, 0x2D, 0x53, 0x53, 0x23, 0x23, 0x23, 0x23, 0x5D, 0x5D, 0x5D, 0x5D, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, + 0x0E, 0x0E, 0x0E, 0x0E, 0x72, 0x72, 0x72, 0x72, 0x3B, 0x45, 0x3A, 0x46, 0x18, 0x18, 0x68, 0x68, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, + 0x20, 0x20, 0x20, 0x20, 0x60, 0x60, 0x60, 0x60, 0x22, 0x22, 0x22, 0x22, 0x5E, 0x5E, 0x5E, 0x5E, + 0x0D, 0x0D, 0x0D, 0x0D, 0x73, 0x73, 0x73, 0x73, 0x17, 0x17, 0x69, 0x69, 0x2C, 0x2C, 0x54, 0x54, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, + 0x39, 0x47, 0x38, 0x48, 0x2B, 0x2B, 0x55, 0x55, 0x0C, 0x0C, 0x0C, 0x0C, 0x74, 0x74, 0x74, 0x74, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x21, 0x21, 0x21, 0x21, 0x5F, 0x5F, 0x5F, 0x5F, 0x16, 0x16, 0x6A, 0x6A, 0x37, 0x49, 0x36, 0x4A +}; + +static const uint8_t SpectrumB73Lookup[1024] = +{ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, + 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, + 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x6D, 0x6D, 0x6D, 0x6D, 0x6D, 0x6D, 0x6D, 0x6D, + 0x1D, 0x1D, 0x1D, 0x1D, 0x63, 0x63, 0x63, 0x63, 0x33, 0x33, 0x4D, 0x4D, 0x3E, 0x42, 0x3F, 0x41, + 0x1C, 0x1C, 0x1C, 0x1C, 0x64, 0x64, 0x64, 0x64, 0x29, 0x29, 0x29, 0x29, 0x57, 0x57, 0x57, 0x57, + 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x5F, 0x5F, 0x5F, 0x5F, 0x5F, 0x5F, 0x5F, 0x5F, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x76, 0x76, 0x76, 0x76, 0x76, 0x76, 0x76, 0x76, 0x76, 0x76, 0x76, 0x76, 0x76, 0x76, 0x76, 0x76, + 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x6E, 0x6E, 0x6E, 0x6E, 0x6E, 0x6E, 0x6E, 0x6E, + 0x28, 0x28, 0x28, 0x28, 0x58, 0x58, 0x58, 0x58, 0x1B, 0x1B, 0x1B, 0x1B, 0x65, 0x65, 0x65, 0x65, + 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, + 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, + 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x6F, 0x6F, 0x6F, 0x6F, 0x6F, 0x6F, 0x6F, 0x6F, + 0x32, 0x32, 0x4E, 0x4E, 0x3D, 0x43, 0x3C, 0x44, 0x1A, 0x1A, 0x1A, 0x1A, 0x66, 0x66, 0x66, 0x66, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, + 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, + 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, + 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, + 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, + 0x27, 0x27, 0x27, 0x27, 0x59, 0x59, 0x59, 0x59, 0x31, 0x31, 0x4F, 0x4F, 0x30, 0x30, 0x50, 0x50, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, + 0x19, 0x19, 0x19, 0x19, 0x67, 0x67, 0x67, 0x67, 0x26, 0x26, 0x26, 0x26, 0x5A, 0x5A, 0x5A, 0x5A, + 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x71, 0x71, 0x71, 0x71, 0x71, 0x71, 0x71, 0x71, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, + 0x3B, 0x45, 0x3A, 0x46, 0x2F, 0x2F, 0x51, 0x51, 0x18, 0x18, 0x18, 0x18, 0x68, 0x68, 0x68, 0x68, + 0x25, 0x25, 0x25, 0x25, 0x5B, 0x5B, 0x5B, 0x5B, 0x17, 0x17, 0x17, 0x17, 0x69, 0x69, 0x69, 0x69, + 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x72, 0x72, 0x72, 0x72, 0x72, 0x72, 0x72, 0x72, + 0x2E, 0x2E, 0x52, 0x52, 0x39, 0x47, 0x38, 0x48, 0x24, 0x24, 0x24, 0x24, 0x5C, 0x5C, 0x5C, 0x5C, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, + 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, + 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, + 0x2D, 0x2D, 0x53, 0x53, 0x1F, 0x1F, 0x61, 0x61, 0x16, 0x16, 0x16, 0x16, 0x6A, 0x6A, 0x6A, 0x6A, + 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x73, 0x73, 0x73, 0x73, 0x73, 0x73, 0x73, 0x73, + 0x15, 0x15, 0x15, 0x15, 0x6B, 0x6B, 0x6B, 0x6B, 0x37, 0x49, 0x36, 0x4A, 0x2C, 0x2C, 0x54, 0x54, + 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x74, 0x74, 0x74, 0x74, 0x74, 0x74, 0x74, 0x74, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, + 0x23, 0x23, 0x23, 0x23, 0x5D, 0x5D, 0x5D, 0x5D, 0x2B, 0x2B, 0x55, 0x55, 0x1E, 0x1E, 0x62, 0x62, + 0x14, 0x14, 0x14, 0x14, 0x6C, 0x6C, 0x6C, 0x6C, 0x35, 0x4B, 0x34, 0x4C, 0x2A, 0x2A, 0x56, 0x56, + 0x22, 0x22, 0x22, 0x22, 0x5E, 0x5E, 0x5E, 0x5E, 0x20, 0x20, 0x20, 0x20, 0x60, 0x60, 0x60, 0x60, + 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75 +}; + +static const uint8_t SpectrumB74Lookup[1024] = +{ + 0x1C, 0x1C, 0x1C, 0x1C, 0x64, 0x64, 0x64, 0x64, 0x1B, 0x1B, 0x1B, 0x1B, 0x65, 0x65, 0x65, 0x65, + 0x24, 0x24, 0x24, 0x24, 0x5C, 0x5C, 0x5C, 0x5C, 0x3F, 0x41, 0x3D, 0x43, 0x3E, 0x42, 0x3C, 0x44, + 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x6D, 0x6D, 0x6D, 0x6D, 0x6D, 0x6D, 0x6D, 0x6D, + 0x3B, 0x45, 0x3A, 0x46, 0x39, 0x47, 0x38, 0x48, 0x37, 0x49, 0x35, 0x4B, 0x36, 0x4A, 0x34, 0x4C, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, + 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, 0x7B, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x33, 0x4D, 0x32, 0x4E, 0x31, 0x4F, 0x30, 0x50, 0x2F, 0x51, 0x2E, 0x52, 0x2B, 0x2B, 0x55, 0x55, + 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x6E, 0x6E, 0x6E, 0x6E, 0x6E, 0x6E, 0x6E, 0x6E, + 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, + 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, 0x75, + 0x1A, 0x1A, 0x1A, 0x1A, 0x66, 0x66, 0x66, 0x66, 0x23, 0x23, 0x23, 0x23, 0x5D, 0x5D, 0x5D, 0x5D, + 0x19, 0x19, 0x19, 0x19, 0x67, 0x67, 0x67, 0x67, 0x2A, 0x2A, 0x56, 0x56, 0x29, 0x29, 0x57, 0x57, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x76, 0x76, 0x76, 0x76, 0x76, 0x76, 0x76, 0x76, 0x76, 0x76, 0x76, 0x76, 0x76, 0x76, 0x76, 0x76, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, + 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, + 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x6F, 0x6F, 0x6F, 0x6F, 0x6F, 0x6F, 0x6F, 0x6F, + 0x22, 0x22, 0x22, 0x22, 0x5E, 0x5E, 0x5E, 0x5E, 0x18, 0x18, 0x18, 0x18, 0x68, 0x68, 0x68, 0x68, + 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, + 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, + 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, + 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, + 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, + 0x20, 0x20, 0x20, 0x20, 0x60, 0x60, 0x60, 0x60, 0x21, 0x21, 0x21, 0x21, 0x5F, 0x5F, 0x5F, 0x5F, + 0x17, 0x17, 0x17, 0x17, 0x69, 0x69, 0x69, 0x69, 0x28, 0x28, 0x58, 0x58, 0x1F, 0x1F, 0x61, 0x61, + 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x71, 0x71, 0x71, 0x71, 0x71, 0x71, 0x71, 0x71, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, + 0x27, 0x27, 0x59, 0x59, 0x2D, 0x53, 0x2C, 0x54, 0x16, 0x16, 0x16, 0x16, 0x6A, 0x6A, 0x6A, 0x6A, + 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x72, 0x72, 0x72, 0x72, 0x72, 0x72, 0x72, 0x72, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, + 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, + 0x1E, 0x1E, 0x62, 0x62, 0x26, 0x26, 0x5A, 0x5A, 0x15, 0x15, 0x15, 0x15, 0x6B, 0x6B, 0x6B, 0x6B, + 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x73, 0x73, 0x73, 0x73, 0x73, 0x73, 0x73, 0x73, + 0x1D, 0x1D, 0x63, 0x63, 0x25, 0x25, 0x5B, 0x5B, 0x14, 0x14, 0x14, 0x14, 0x6C, 0x6C, 0x6C, 0x6C, + 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x74, 0x74, 0x74, 0x74, 0x74, 0x74, 0x74, 0x74, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, + 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, + 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E +}; + +static const HuffmanCodebook HuffmanScaleFactorsUnsigned[7] = { + {0}, + { ScaleFactorsA1Bits, ScaleFactorsA1Codes, ScaleFactorsA1Lookup, 1, 0, 1, 2, 1 }, + { ScaleFactorsA2Bits, ScaleFactorsA2Codes, ScaleFactorsA2Lookup, 1, 0, 2, 4, 3 }, + { ScaleFactorsA3Bits, ScaleFactorsA3Codes, ScaleFactorsA3Lookup, 1, 0, 3, 8, 6 }, + { ScaleFactorsA4Bits, ScaleFactorsA4Codes, ScaleFactorsA4Lookup, 1, 0, 4, 16, 8 }, + { ScaleFactorsA5Bits, ScaleFactorsA5Codes, ScaleFactorsA5Lookup, 1, 0, 5, 32, 8 }, + { ScaleFactorsA6Bits, ScaleFactorsA6Codes, ScaleFactorsA6Lookup, 1, 0, 6, 64, 8 } +}; + +static const HuffmanCodebook HuffmanScaleFactorsSigned[6] = { + {0}, + {0}, + { ScaleFactorsB2Bits, ScaleFactorsB2Codes, ScaleFactorsB2Lookup, 1, 0, 2, 4, 2 }, + { ScaleFactorsB3Bits, ScaleFactorsB3Codes, ScaleFactorsB3Lookup, 1, 0, 3, 8, 6 }, + { ScaleFactorsB4Bits, ScaleFactorsB4Codes, ScaleFactorsB4Lookup, 1, 0, 4, 16, 8 }, + { ScaleFactorsB5Bits, ScaleFactorsB5Codes, ScaleFactorsB5Lookup, 1, 0, 5, 32, 8 } +}; + +static const HuffmanCodebook HuffmanSpectrum[2][8][4] = { + { + { + {0}, + {0}, + {0}, + {0} + }, + { + {0}, + {0}, + {0}, + {0} + }, + { + {SpectrumA21Bits, SpectrumA21Codes, SpectrumA21Lookup, 2, 1, 2, 4, 3}, + {SpectrumA22Bits, SpectrumA22Codes, SpectrumA22Lookup, 4, 2, 2, 4, 8}, + {SpectrumA23Bits, SpectrumA23Codes, SpectrumA23Lookup, 4, 2, 2, 4, 9}, + {SpectrumA24Bits, SpectrumA24Codes, SpectrumA24Lookup, 4, 2, 2, 4, 10} + }, + { + {SpectrumA31Bits, SpectrumA31Codes, SpectrumA31Lookup, 2, 1, 3, 8, 7}, + {SpectrumA32Bits, SpectrumA32Codes, SpectrumA32Lookup, 2, 1, 3, 8, 7}, + {SpectrumA33Bits, SpectrumA33Codes, SpectrumA33Lookup, 2, 1, 3, 8, 8}, + {SpectrumA34Bits, SpectrumA34Codes, SpectrumA34Lookup, 2, 1, 3, 8, 10} + }, + { + {SpectrumA41Bits, SpectrumA41Codes, SpectrumA41Lookup, 2, 1, 4, 16, 9}, + {SpectrumA42Bits, SpectrumA42Codes, SpectrumA42Lookup, 2, 1, 4, 16, 10}, + {SpectrumA43Bits, SpectrumA43Codes, SpectrumA43Lookup, 2, 1, 4, 16, 10}, + {SpectrumA44Bits, SpectrumA44Codes, SpectrumA44Lookup, 2, 1, 4, 16, 10} + }, + { + {SpectrumA51Bits, SpectrumA51Codes, SpectrumA51Lookup, 1, 0, 5, 32, 6}, + {SpectrumA52Bits, SpectrumA52Codes, SpectrumA52Lookup, 1, 0, 5, 32, 6}, + {SpectrumA53Bits, SpectrumA53Codes, SpectrumA53Lookup, 1, 0, 5, 32, 7}, + {SpectrumA54Bits, SpectrumA54Codes, SpectrumA54Lookup, 1, 0, 5, 32, 8} + }, + { + {SpectrumA61Bits, SpectrumA61Codes, SpectrumA61Lookup, 1, 0, 6, 64, 7}, + {SpectrumA62Bits, SpectrumA62Codes, SpectrumA62Lookup, 1, 0, 6, 64, 7}, + {SpectrumA63Bits, SpectrumA63Codes, SpectrumA63Lookup, 1, 0, 6, 64, 8}, + {SpectrumA64Bits, SpectrumA64Codes, SpectrumA64Lookup, 1, 0, 6, 64, 9} + }, + { + {SpectrumA71Bits, SpectrumA71Codes, SpectrumA71Lookup, 1, 0, 7, 128, 8}, + {SpectrumA72Bits, SpectrumA72Codes, SpectrumA72Lookup, 1, 0, 7, 128, 8}, + {SpectrumA73Bits, SpectrumA73Codes, SpectrumA73Lookup, 1, 0, 7, 128, 9}, + {SpectrumA74Bits, SpectrumA74Codes, SpectrumA74Lookup, 1, 0, 7, 128, 10} + } + }, + { + { + {0}, + {0}, + {0}, + {0} + }, + { + {0}, + {0}, + {0}, + {0} + }, + { + {0}, + {SpectrumB22Bits, SpectrumB22Codes, SpectrumB22Lookup, 4, 2, 2, 4, 10}, + {SpectrumB23Bits, SpectrumB23Codes, SpectrumB23Lookup, 4, 2, 2, 4, 10}, + {SpectrumB24Bits, SpectrumB24Codes, SpectrumB24Lookup, 4, 2, 2, 4, 10} + }, + { + {0}, + {SpectrumB32Bits, SpectrumB32Codes, SpectrumB32Lookup, 2, 1, 3, 8, 9}, + {SpectrumB33Bits, SpectrumB33Codes, SpectrumB33Lookup, 2, 1, 3, 8, 10}, + {SpectrumB34Bits, SpectrumB34Codes, SpectrumB34Lookup, 2, 1, 3, 8, 10} + }, + { + {0}, + {SpectrumB42Bits, SpectrumB42Codes, SpectrumB42Lookup, 2, 1, 4, 16, 10}, + {SpectrumB43Bits, SpectrumB43Codes, SpectrumB43Lookup, 2, 1, 4, 16, 10}, + {SpectrumB44Bits, SpectrumB44Codes, SpectrumB44Lookup, 2, 1, 4, 16, 10} + }, + { + {0}, + {SpectrumB52Bits, SpectrumB52Codes, SpectrumB52Lookup, 1, 0, 5, 32, 7}, + {SpectrumB53Bits, SpectrumB53Codes, SpectrumB53Lookup, 1, 0, 5, 32, 8}, + {SpectrumB54Bits, SpectrumB54Codes, SpectrumB54Lookup, 1, 0, 5, 32, 9} + }, + { + {0}, + {SpectrumB62Bits, SpectrumB62Codes, SpectrumB62Lookup, 1, 0, 6, 64, 8}, + {SpectrumB63Bits, SpectrumB63Codes, SpectrumB63Lookup, 1, 0, 6, 64, 9}, + {SpectrumB64Bits, SpectrumB64Codes, SpectrumB64Lookup, 1, 0, 6, 64, 10} + }, + { + {0}, + {SpectrumB72Bits, SpectrumB72Codes, SpectrumB72Lookup, 1, 0, 7, 128, 9}, + {SpectrumB73Bits, SpectrumB73Codes, SpectrumB73Lookup, 1, 0, 7, 128, 10}, + {SpectrumB74Bits, SpectrumB74Codes, SpectrumB74Lookup, 1, 0, 7, 128, 10} + } + } +}; diff --git a/C/imdct.c b/C/imdct.c new file mode 100644 index 0000000..29bf3df --- /dev/null +++ b/C/imdct.c @@ -0,0 +1,80 @@ +#include "imdct.h" +#include "tables.h" + +void RunImdct(mdct* mdct, double* input, double* output) +{ + const int size = 1 << mdct->bits; + const int half = size / 2; + double dctOut[MAX_FRAME_SAMPLES]; + const double* window = ImdctWindow[mdct->bits - 6]; + double* previous = mdct->_imdctPrevious; + + Dct4(mdct, input, dctOut); + + for (int i = 0; i < half; i++) + { + output[i] = window[i] * dctOut[i + half] + previous[i]; + output[i + half] = window[i + half] * -dctOut[size - 1 - i] - previous[i + half]; + previous[i] = window[size - 1 - i] * -dctOut[half - i - 1]; + previous[i + half] = window[half - i - 1] * dctOut[i]; + } +} + +void Dct4(mdct* mdct, double* input, double* output) +{ + int MdctBits = mdct->bits; + int MdctSize = 1 << MdctBits; + const int* shuffleTable = ShuffleTables[MdctBits]; + const double* sinTable = SinTables[MdctBits]; + const double* cosTable = CosTables[MdctBits]; + double dctTemp[MAX_FRAME_SAMPLES]; + + int size = MdctSize; + int lastIndex = size - 1; + int halfSize = size / 2; + + for (int i = 0; i < halfSize; i++) + { + int i2 = i * 2; + double a = input[i2]; + double b = input[lastIndex - i2]; + double sin = sinTable[i]; + double cos = cosTable[i]; + dctTemp[i2] = a * cos + b * sin; + dctTemp[i2 + 1] = a * sin - b * cos; + } + int stageCount = MdctBits - 1; + + for (int stage = 0; stage < stageCount; stage++) + { + int blockCount = 1 << stage; + int blockSizeBits = stageCount - stage; + int blockHalfSizeBits = blockSizeBits - 1; + int blockSize = 1 << blockSizeBits; + int blockHalfSize = 1 << blockHalfSizeBits; + sinTable = SinTables[blockHalfSizeBits]; + cosTable = CosTables[blockHalfSizeBits]; + + for (int block = 0; block < blockCount; block++) + { + for (int i = 0; i < blockHalfSize; i++) + { + int frontPos = (block * blockSize + i) * 2; + int backPos = frontPos + blockSize; + double a = dctTemp[frontPos] - dctTemp[backPos]; + double b = dctTemp[frontPos + 1] - dctTemp[backPos + 1]; + double sin = sinTable[i]; + double cos = cosTable[i]; + dctTemp[frontPos] += dctTemp[backPos]; + dctTemp[frontPos + 1] += dctTemp[backPos + 1]; + dctTemp[backPos] = a * cos + b * sin; + dctTemp[backPos + 1] = a * sin - b * cos; + } + } + } + + for (int i = 0; i < MdctSize; i++) + { + output[i] = dctTemp[shuffleTable[i]]; + } +} \ No newline at end of file diff --git a/C/imdct.h b/C/imdct.h new file mode 100644 index 0000000..e8c3bf3 --- /dev/null +++ b/C/imdct.h @@ -0,0 +1,6 @@ +#pragma once + +#include "structures.h" + +void RunImdct(mdct* mdct, double* input, double* output); +void Dct4(mdct* mdct, double* input, double* output); \ No newline at end of file diff --git a/C/libatrac9.c b/C/libatrac9.c new file mode 100644 index 0000000..ee6e177 --- /dev/null +++ b/C/libatrac9.c @@ -0,0 +1,51 @@ +#include "libatrac9.h" +#include "structures.h" +#include +#include +#include "decinit.h" +#include "decoder.h" + +HANDLE_ATRAC9 GetHandle() +{ + struct atrac9_handle* handle = malloc(sizeof(atrac9_handle)); + memset(handle, 0, sizeof(atrac9_handle)); + return handle; +} + +void ReleaseHandle(HANDLE_ATRAC9 handle) +{ + free(handle); +} + +int DecInit(HANDLE_ATRAC9 handle, unsigned char * pConfigData, int wlength) +{ + if (wlength != 16) + { + return -1; + } + + ERROR_CHECK(init_decoder(handle, pConfigData, wlength)); + + return 0; +} + +int DecDecode(HANDLE_ATRAC9 handle, const unsigned char * pStreamBuffer, int * pNByteUsed, void * pPcmBuffer) +{ + at9_status status = Decode(handle, pStreamBuffer, pPcmBuffer, pNByteUsed); + return status; +} + +int GetCodecInfo(HANDLE_ATRAC9 handle, CodecInfo * pCodecInfo) +{ + atrac9_handle* h = handle; + + pCodecInfo->channels = h->config.ChannelCount; + pCodecInfo->channelConfigIndex = h->config.ChannelConfigIndex; + pCodecInfo->samplingRate = h->config.SampleRate; + pCodecInfo->superframeSize = h->config.SuperframeBytes; + pCodecInfo->framesInSuperframe = h->config.FramesPerSuperframe; + pCodecInfo->frameSamples = h->config.FrameSamples; + pCodecInfo->wlength = h->wlength; + memcpy(pCodecInfo->configData, h->config.ConfigData, CONFIG_DATA_SIZE); + return ERR_SUCCESS; +} diff --git a/C/libatrac9.h b/C/libatrac9.h new file mode 100644 index 0000000..d014ddb --- /dev/null +++ b/C/libatrac9.h @@ -0,0 +1,34 @@ +#pragma once +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef COMPILING_DLL +#define DLLEXPORT __declspec(dllexport) +#else +#define DLLEXPORT __declspec(dllimport) +#endif + +typedef void* HANDLE_ATRAC9; + +typedef struct { + int channels; + int channelConfigIndex; + int samplingRate; + int superframeSize; + int framesInSuperframe; + int frameSamples; + int wlength; + unsigned char configData[4]; +} CodecInfo; + +DLLEXPORT HANDLE_ATRAC9 GetHandle(void); +DLLEXPORT void ReleaseHandle(HANDLE_ATRAC9 handle); + +DLLEXPORT int DecInit(HANDLE_ATRAC9 handle, unsigned char *pConfigData, int wlength); +DLLEXPORT int DecDecode(HANDLE_ATRAC9 handle, const unsigned char *pStreamBuffer, int *pNByteUsed, void *pPcmBuffer); +DLLEXPORT int GetCodecInfo(HANDLE_ATRAC9 handle, CodecInfo *pCodecInfo); + +#ifdef __cplusplus +} +#endif diff --git a/C/libatrac9.sln b/C/libatrac9.sln new file mode 100644 index 0000000..8c7c6bf --- /dev/null +++ b/C/libatrac9.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27130.2010 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libatrac9", "libatrac9.vcxproj", "{2425F2CC-BB1B-4069-BC10-1C7F535EF8E8}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2425F2CC-BB1B-4069-BC10-1C7F535EF8E8}.Debug|x64.ActiveCfg = Debug|x64 + {2425F2CC-BB1B-4069-BC10-1C7F535EF8E8}.Debug|x64.Build.0 = Debug|x64 + {2425F2CC-BB1B-4069-BC10-1C7F535EF8E8}.Debug|x86.ActiveCfg = Debug|Win32 + {2425F2CC-BB1B-4069-BC10-1C7F535EF8E8}.Debug|x86.Build.0 = Debug|Win32 + {2425F2CC-BB1B-4069-BC10-1C7F535EF8E8}.Release|x64.ActiveCfg = Release|x64 + {2425F2CC-BB1B-4069-BC10-1C7F535EF8E8}.Release|x64.Build.0 = Release|x64 + {2425F2CC-BB1B-4069-BC10-1C7F535EF8E8}.Release|x86.ActiveCfg = Release|Win32 + {2425F2CC-BB1B-4069-BC10-1C7F535EF8E8}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {BB003D83-77D8-4E7B-896D-7C9ADA458F73} + EndGlobalSection +EndGlobal diff --git a/C/libatrac9.vcxproj b/C/libatrac9.vcxproj new file mode 100644 index 0000000..6e3214c --- /dev/null +++ b/C/libatrac9.vcxproj @@ -0,0 +1,159 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {2425F2CC-BB1B-4069-BC10-1C7F535EF8E8} + libatrac9 + 10.0.16299.0 + libatrac9 + + + + DynamicLibrary + true + v141 + MultiByte + + + DynamicLibrary + false + v141 + true + MultiByte + + + DynamicLibrary + true + v141 + MultiByte + + + DynamicLibrary + false + v141 + true + MultiByte + + + + + + + + + + + + + + + + + + + + + + + Level3 + Disabled + true + true + _WINDLL;COMPILING_DLL;%(PreprocessorDefinitions) + CompileAsC + + + + + Level3 + Disabled + true + true + CompileAsC + _WINDLL;COMPILING_DLL;%(PreprocessorDefinitions) + + + + + Level3 + MaxSpeed + true + true + true + true + CompileAsC + _WINDLL;COMPILING_DLL;%(PreprocessorDefinitions) + Sync + + + true + true + + + + + Level3 + MaxSpeed + true + true + true + true + CompileAsC + _WINDLL;COMPILING_DLL;%(PreprocessorDefinitions) + + + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/C/libatrac9.vcxproj.filters b/C/libatrac9.vcxproj.filters new file mode 100644 index 0000000..b80e062 --- /dev/null +++ b/C/libatrac9.vcxproj.filters @@ -0,0 +1,96 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/C/quantization.c b/C/quantization.c new file mode 100644 index 0000000..6d95e62 --- /dev/null +++ b/C/quantization.c @@ -0,0 +1,54 @@ +#include "quantization.h" +#include +#include "tables.h" + +void DequantizeSpectra(block* block) +{ + for (int i = 0; i < block->ChannelCount; i++) + { + channel* channel = &block->Channels[i]; + memset(channel->Spectra, 0, sizeof(channel->Spectra)); + + for (int j = 0; j < channel->CodedQuantUnits; j++) + { + DequantizeQuantUnit(channel, j); + } + } +} + + void DequantizeQuantUnit(channel* channel, int band) +{ + const int subBandIndex = QuantUnitToCoeffIndex[band]; + const int subBandCount = QuantUnitToCoeffCount[band]; + const double stepSize = QuantizerStepSize[channel->Precisions[band]]; + const double stepSizeFine = QuantizerFineStepSize[channel->PrecisionsFine[band]]; + + for (int sb = 0; sb < subBandCount; sb++) + { + const double coarse = channel->QuantizedSpectra[subBandIndex + sb] * stepSize; + const double fine = channel->QuantizedSpectraFine[subBandIndex + sb] * stepSizeFine; + channel->Spectra[subBandIndex + sb] = coarse + fine; + } +} + +void ScaleSpectrumBlock(block* block) + { + for (int i = 0; i < block->ChannelCount; i++) + { + ScaleSpectrumChannel(&block->Channels[i]); + } + } + +void ScaleSpectrumChannel(channel* channel) +{ + const int quantUnitCount = channel->Block->QuantizationUnitCount; + double* spectra = channel->Spectra; + + for (int i = 0; i < quantUnitCount; i++) + { + for (int sb = QuantUnitToCoeffIndex[i]; sb < QuantUnitToCoeffIndex[i + 1]; sb++) + { + spectra[sb] *= SpectrumScale[channel->ScaleFactors[i]]; + } + } + } \ No newline at end of file diff --git a/C/quantization.h b/C/quantization.h new file mode 100644 index 0000000..d9de74a --- /dev/null +++ b/C/quantization.h @@ -0,0 +1,8 @@ +#pragma once + +#include "structures.h" + +void DequantizeSpectra(block* block); +void DequantizeQuantUnit(channel* channel, int band); +void ScaleSpectrumBlock(block* block); +void ScaleSpectrumChannel(channel* channel); \ No newline at end of file diff --git a/C/scale_factors.c b/C/scale_factors.c new file mode 100644 index 0000000..ee81241 --- /dev/null +++ b/C/scale_factors.c @@ -0,0 +1,146 @@ +#include +#include "huffCodes.h" +#include "scale_factors.h" +#include "tables.h" +#include "utility.h" + +at9_status read_scale_factors(channel * channel, bit_reader_cxt * br) +{ + memset(channel->ScaleFactors, 0, sizeof(channel->ScaleFactors)); + + channel->ScaleFactorCodingMode = read_int(br, 2); + if (channel->ChannelIndex == 0) + { + switch (channel->ScaleFactorCodingMode) + { + case 0: + ReadVlcDeltaOffset(channel, br); + break; + case 1: + ReadClcOffset(channel, br); + break; + case 2: + if (channel->Block->FirstInSuperframe) return ERR_UNPACK_SCALE_FACTOR_MODE_INVALID; + ReadVlcDistanceToBaseline(channel, br, channel->ScaleFactorsPrev, channel->Block->QuantizationUnitsPrev); + break; + case 3: + if (channel->Block->FirstInSuperframe) return ERR_UNPACK_SCALE_FACTOR_MODE_INVALID; + ReadVlcDeltaOffsetWithBaseline(channel, br, channel->ScaleFactorsPrev, channel->Block->QuantizationUnitsPrev); + break; + } + } + else + { + switch (channel->ScaleFactorCodingMode) + { + case 0: + ReadVlcDeltaOffset(channel, br); + break; + case 1: + ReadVlcDistanceToBaseline(channel, br, channel->Block->Channels[0].ScaleFactors, channel->Block->ExtensionUnit); + break; + case 2: + ReadVlcDeltaOffsetWithBaseline(channel, br, channel->Block->Channels[0].ScaleFactors, channel->Block->ExtensionUnit); + break; + case 3: + if (channel->Block->FirstInSuperframe) return ERR_UNPACK_SCALE_FACTOR_MODE_INVALID; + ReadVlcDistanceToBaseline(channel, br, channel->ScaleFactorsPrev, channel->Block->QuantizationUnitsPrev); + break; + } + } + + for (int i = 0; i < channel->Block->ExtensionUnit; i++) + { + if (channel->ScaleFactors[i] < 0 || channel->ScaleFactors[i] > 31) + { + return ERR_UNPACK_SCALE_FACTOR_OOB; + } + } + + memcpy(channel->ScaleFactorsPrev, channel->ScaleFactors, sizeof(channel->ScaleFactors)); + + return ERR_SUCCESS; +} + +void ReadClcOffset(channel* channel, bit_reader_cxt* br) +{ + const int maxBits = 5; + int* sf = channel->ScaleFactors; + const int bitLength = read_int(br, 2) + 2; + const int baseValue = bitLength < maxBits ? read_int(br, maxBits) : 0; + + for (int i = 0; i < channel->Block->ExtensionUnit; i++) + { + sf[i] = read_int(br, bitLength) + baseValue; + } +} + +void ReadVlcDeltaOffset(channel* channel, bit_reader_cxt* br) +{ + const int weightIndex = read_int(br, 3); + const unsigned char* weights = ScaleFactorWeights[weightIndex]; + + int* sf = channel->ScaleFactors; + const int baseValue = read_int(br, 5); + const int bitLength = read_int(br, 2) + 3; + const HuffmanCodebook* codebook = &HuffmanScaleFactorsUnsigned[bitLength]; + + sf[0] = read_int(br, bitLength); + + for (int i = 1; i < channel->Block->ExtensionUnit; i++) + { + const int delta = ReadHuffmanValue(codebook, br, 0); + sf[i] = (sf[i - 1] + delta) & (codebook->ValueMax - 1); + } + + for (int i = 0; i < channel->Block->ExtensionUnit; i++) + { + sf[i] += baseValue - weights[i]; + } +} + +void ReadVlcDistanceToBaseline(channel* channel, bit_reader_cxt* br, int* baseline, int baselineLength) +{ + int* sf = channel->ScaleFactors; + const int bit_length = read_int(br, 2) + 2; + const HuffmanCodebook* codebook = &HuffmanScaleFactorsSigned[bit_length]; + const int unitCount = min(channel->Block->ExtensionUnit, baselineLength); + + for (int i = 0; i < unitCount; i++) + { + const int distance = ReadHuffmanValue(codebook, br, TRUE); + sf[i] = (baseline[i] + distance) & 31; + } + + for (int i = unitCount; i < channel->Block->ExtensionUnit; i++) + { + sf[i] = read_int(br, 5); + } +} + +void ReadVlcDeltaOffsetWithBaseline(channel* channel, bit_reader_cxt* br, int* baseline, int baselineLength) +{ + int* sf = channel->ScaleFactors; + const int baseValue = read_offset_binary(br, 5); + const int bitLength = read_int(br, 2) + 1; + const HuffmanCodebook* codebook = &HuffmanScaleFactorsUnsigned[bitLength]; + const int unitCount = min(channel->Block->ExtensionUnit, baselineLength); + + sf[0] = read_int(br, bitLength); + + for (int i = 1; i < unitCount; i++) + { + const int delta = ReadHuffmanValue(codebook, br, FALSE); + sf[i] = (sf[i - 1] + delta) & (codebook->ValueMax - 1); + } + + for (int i = 0; i < unitCount; i++) + { + sf[i] += baseValue + baseline[i]; + } + + for (int i = unitCount; i < channel->Block->ExtensionUnit; i++) + { + sf[i] = read_int(br, 5); + } +} diff --git a/C/scale_factors.h b/C/scale_factors.h new file mode 100644 index 0000000..557c834 --- /dev/null +++ b/C/scale_factors.h @@ -0,0 +1,8 @@ +#pragma once +#include "bit_allocation.h" + +at9_status read_scale_factors(channel* channel, bit_reader_cxt* br); +void ReadClcOffset(channel* channel, bit_reader_cxt* br); +void ReadVlcDeltaOffset(channel* channel, bit_reader_cxt* br); +void ReadVlcDistanceToBaseline(channel* channel, bit_reader_cxt* br, int* baseline, int baselineLength); +void ReadVlcDeltaOffsetWithBaseline(channel* channel, bit_reader_cxt* br, int* baseline, int baselineLength); diff --git a/C/structures.h b/C/structures.h new file mode 100644 index 0000000..cd0d930 --- /dev/null +++ b/C/structures.h @@ -0,0 +1,142 @@ +#pragma once + +#define CONFIG_DATA_SIZE 4 +#define MAX_BLOCK_COUNT 5 +#define MAX_BLOCK_CHANNEL_COUNT 2 +#define MAX_FRAME_SAMPLES 256 +#define MAX_BEX_VALUES 4 + +#define MAX_QUANT_UNITS 30 + +typedef struct frame frame; +typedef struct block block; + +typedef enum BlockType { + Mono = 0, + Stereo = 1, + LFE = 2 +} BlockType; + +typedef struct { + int BlockCount; + int ChannelCount; + enum BlockType Types[MAX_BLOCK_COUNT]; +} ChannelConfig; + +typedef struct { + unsigned char ConfigData[CONFIG_DATA_SIZE]; + int SampleRateIndex; + int ChannelConfigIndex; + int FrameBytes; + int SuperframeIndex; + + ChannelConfig ChannelConfig; + int ChannelCount; + int SampleRate; + int HighSampleRate; + int FramesPerSuperframe; + int FrameSamplesPower; + int FrameSamples; + int SuperframeBytes; + int SuperframeSamples; +} ConfigData; + +typedef struct { + unsigned short stateA; + unsigned short stateB; + unsigned short stateC; + unsigned short stateD; +} rng_cxt; + +typedef struct { + int bits; + int size; + double scale; + double _imdctPrevious[MAX_FRAME_SAMPLES]; + double* window; + double* sinTable; + double* cosTable; +} mdct; + +typedef struct { + frame* Frame; + block* Block; + ConfigData* config; + int ChannelIndex; + + mdct mdct; + + double Pcm[MAX_FRAME_SAMPLES]; + double Spectra[MAX_FRAME_SAMPLES]; + + int CodedQuantUnits; + int ScaleFactorCodingMode; + + int ScaleFactors[31]; + int ScaleFactorsPrev[31]; + + int Precisions[MAX_QUANT_UNITS]; + int PrecisionsFine[MAX_QUANT_UNITS]; + int PrecisionMask[MAX_QUANT_UNITS]; + + int CodebookSet[MAX_QUANT_UNITS]; + + int QuantizedSpectra[MAX_FRAME_SAMPLES]; + int QuantizedSpectraFine[MAX_FRAME_SAMPLES]; + + int BexMode; + int BexValueCount; + int BexValues[MAX_BEX_VALUES]; + + rng_cxt rng; +} channel; + +struct block { + frame* Frame; + ConfigData* config; + enum BlockType BlockType; + int BlockIndex; + channel Channels[MAX_BLOCK_CHANNEL_COUNT]; + int ChannelCount; + int FirstInSuperframe; + int ReuseBandParams; + + int BandCount; + int StereoBand; + int ExtensionBand; + int QuantizationUnitCount; + int StereoQuantizationUnit; + int ExtensionUnit; + int QuantizationUnitsPrev; + + int Gradient[31]; + int GradientMode; + int GradientStartUnit; + int GradientStartValue; + int GradientEndUnit; + int GradientEndValue; + int GradientBoundary; + + int PrimaryChannelIndex; + int HasJointStereoSigns; + int JointStereoSigns[MAX_QUANT_UNITS]; + + int BandExtensionEnabled; + int HasExtensionData; + int BexDataLength; + int BexMode; +}; + +struct frame { + ConfigData* config; + int FrameIndex; + block Blocks[MAX_BLOCK_COUNT]; + int frameNum; +}; + +typedef struct { + int initialized; + int wlength; + ConfigData config; + frame frame; +} atrac9_handle; diff --git a/C/tables.h b/C/tables.h new file mode 100644 index 0000000..c345980 --- /dev/null +++ b/C/tables.h @@ -0,0 +1,642 @@ +#pragma once + +#include "structures.h" + +static const ChannelConfig ChannelConfigs[6] = +{ + {1, 1, Mono}, + {2, 2, Mono, Mono}, + {1, 2, Stereo}, + {4, 6, Stereo, Mono, LFE, Stereo}, + {5, 8, Stereo, Mono, LFE, Stereo, Stereo}, + {2, 4, Stereo, Stereo}, +}; + +static const int MaxHuffPrecision[2] = { 7, 1 }; +static const int MinBandCount[2] = { 3, 1 }; +static const int MaxExtensionBand[2] = { 18, 16 }; + +static const int SamplingRateIndexToFrameSamplesPower[16] = +{ 6, 6, 7, 7, 7, 8, 8, 8, 6, 6, 7, 7, 7, 8, 8, 8 }; + +static const int MaxBandCount[16] = +{ 8, 8, 12, 12, 12, 18, 18, 18, 8, 8, 12, 12, 12, 16, 16, 16 }; + +static const int BandToQuantUnitCount[19] = +{ 0, 4, 8, 10, 12, 13, 14, 15, 16, 18, 20, 21, 22, 23, 24, 25, 26, 28, 30 }; + +static const int QuantUnitToCoeffCount[30] = +{ + 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 8, 8, 8, + 8, 8, 8, 8, 8, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16 +}; + +static const int QuantUnitToCoeffIndex[31] = +{ + 0, 2, 4, 6, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56, + 64, 72, 80, 88, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240, 256 +}; + +static const int QuantUnitToCodebookIndex[30] = +{ + 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, + 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 +}; + +static const int SampleRates[16] = +{ + 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000, + 44100, 48000, 64000, 88200, 96000, 128000, 176400, 192000 +}; + +static const unsigned char GradientCurves[48][48] = { + { 1 }, + { 1, 16 }, + { 1, 7, 25 }, + { 1, 4, 16, 27 }, + { 1, 3, 10, 21, 28 }, + { 1, 3, 7, 16, 25, 29 }, + { 1, 2, 5, 11, 20, 26, 29 }, + { 1, 2, 4, 9, 16, 23, 27, 29 }, + { 1, 2, 3, 7, 12, 19, 25, 28, 29 }, + { 1, 2, 3, 5, 10, 16, 21, 26, 28, 29 }, + { 1, 2, 3, 5, 8, 12, 19, 23, 26, 28, 29 }, + { 1, 2, 3, 4, 7, 11, 16, 21, 25, 27, 29, 30 }, + { 1, 1, 2, 4, 5, 9, 13, 18, 22, 26, 27, 29, 30 }, + { 1, 1, 2, 3, 5, 8, 11, 16, 20, 23, 26, 28, 29, 30 }, + { 1, 1, 2, 3, 4, 7, 10, 13, 18, 21, 25, 27, 28, 29, 30 }, + { 1, 1, 2, 3, 4, 6, 9, 12, 16, 20, 23, 26, 27, 28, 29, 30 }, + { 1, 1, 2, 3, 4, 5, 7, 10, 13, 18, 21, 24, 26, 27, 28, 29, 30 }, + { 1, 1, 2, 3, 3, 5, 7, 9, 12, 16, 19, 22, 25, 26, 28, 29, 29, 30 }, + { 1, 1, 2, 2, 3, 4, 6, 8, 11, 13, 18, 20, 23, 25, 27, 28, 29, 29, 30 }, + { 1, 1, 2, 2, 3, 4, 5, 7, 10, 12, 16, 19, 21, 24, 26, 27, 28, 29, 29, 30 }, + { 1, 1, 2, 2, 3, 4, 5, 7, 9, 11, 13, 18, 20, 22, 25, 26, 27, 28, 29, 29, 30 }, + { 1, 1, 2, 2, 3, 3, 5, 6, 8, 10, 12, 16, 19, 21, 23, 25, 26, 28, 28, 29, 29, + 30 }, + { 1, 1, 2, 2, 3, 3, 4, 5, 7, 9, 11, 13, 18, 20, 22, 24, 26, 27, 28, 28, 29, + 29, 30 }, + { 1, 1, 2, 2, 3, 3, 4, 5, 7, 9, 11, 13, 16, 19, 21, 23, 25, 26, 27, 28, 29, + 29, 30, 30 }, + { 1, 1, 1, 2, 2, 3, 4, 5, 6, 8, 10, 12, 15, 16, 19, 21, 23, 25, 26, 27, 28, + 29, 29, 30, 30 }, + { 1, 1, 1, 2, 2, 3, 4, 4, 5, 7, 9, 11, 13, 16, 18, 20, 22, 24, 26, 27, 27, + 28, 29, 29, 30, 30 }, + { 1, 1, 1, 2, 2, 3, 3, 4, 5, 7, 8, 10, 12, 15, 16, 19, 21, 23, 25, 26, 27, + 28, 28, 29, 29, 30, 30 }, + { 1, 1, 1, 2, 2, 3, 3, 4, 5, 6, 8, 9, 11, 13, 16, 18, 20, 22, 23, 25, 26, 27, + 28, 28, 29, 29, 30, 30 }, + { 1, 1, 1, 2, 2, 3, 3, 4, 5, 5, 7, 9, 10, 12, 15, 16, 19, 21, 22, 24, 26, 26, + 27, 28, 28, 29, 29, 30, 30 }, + { 1, 1, 1, 2, 2, 3, 3, 4, 4, 5, 7, 8, 10, 11, 13, 16, 18, 20, 21, 23, 25, 26, + 27, 27, 28, 29, 29, 29, 30, 30 }, + { 1, 1, 1, 2, 2, 2, 3, 3, 4, 5, 6, 8, 9, 11, 12, 15, 16, 19, 20, 22, 23, 25, + 26, 27, 28, 28, 29, 29, 29, 30, 30 }, + { 1, 1, 1, 2, 2, 2, 3, 3, 4, 5, 6, 7, 9, 10, 12, 13, 16, 18, 20, 21, 23, 24, + 26, 26, 27, 28, 28, 29, 29, 29, 30, 30 }, + { 1, 1, 1, 2, 2, 2, 3, 3, 4, 5, 5, 7, 8, 9, 11, 12, 15, 16, 19, 20, 22, 23, + 25, 26, 26, 27, 28, 28, 29, 29, 29, 30, 30 }, + { 1, 1, 1, 2, 2, 2, 3, 3, 4, 4, 5, 6, 7, 9, 10, 12, 13, 16, 18, 19, 21, 22, + 24, 25, 26, 27, 27, 28, 28, 29, 29, 29, 30, 30 }, + { 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 5, 6, 7, 8, 10, 11, 12, 15, 16, 19, 20, 21, + 23, 24, 25, 26, 27, 28, 28, 28, 29, 29, 29, 30, 30 }, + { 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 5, 5, 7, 8, 9, 11, 12, 13, 16, 18, 19, 21, + 22, 23, 25, 26, 26, 27, 28, 28, 29, 29, 29, 30, 30, 30 }, + { 1, 1, 1, 1, 2, 2, 2, 3, 3, 4, 4, 5, 6, 7, 9, 10, 11, 13, 15, 16, 18, 20, + 21, 22, 24, 25, 26, 27, 27, 28, 28, 29, 29, 29, 30, 30, 30 }, + { 1, 1, 1, 1, 2, 2, 2, 3, 3, 4, 4, 5, 6, 7, 8, 9, 11, 12, 13, 16, 18, 19, 20, + 22, 23, 24, 25, 26, 27, 27, 28, 28, 29, 29, 29, 30, 30, 30 }, + { 1, 1, 1, 1, 2, 2, 2, 3, 3, 4, 4, 5, 5, 7, 8, 9, 10, 11, 13, 15, 16, 18, 20, + 21, 22, 23, 25, 26, 26, 27, 27, 28, 28, 29, 29, 29, 30, 30, 30 }, + { 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 5, 5, 6, 7, 9, 10, 11, 12, 13, 16, 18, 19, + 20, 21, 23, 24, 25, 26, 26, 27, 28, 28, 28, 29, 29, 29, 30, 30, 30 }, + { 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 6, 7, 8, 9, 10, 12, 13, 15, 16, 18, + 19, 21, 22, 23, 24, 25, 26, 27, 27, 28, 28, 28, 29, 29, 29, 30, 30, 30 }, + { 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 7, 8, 9, 10, 11, 12, 13, 16, 18, + 19, 20, 21, 22, 23, 25, 26, 26, 27, 27, 28, 28, 29, 29, 29, 29, 30, 30, + 30 }, + { 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 4, 4, 5, 5, 6, 7, 8, 9, 11, 12, 13, 15, 16, + 18, 19, 20, 22, 23, 24, 25, 26, 26, 27, 27, 28, 28, 29, 29, 29, 29, 30, 30, + 30 }, + { 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 5, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 26, 27, 28, 28, 28, 29, 29, 29, 29, 30, + 30, 30 }, + { 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 7, 8, 9, 10, 11, 12, 13, 15, + 16, 18, 19, 20, 21, 22, 23, 25, 26, 26, 27, 27, 28, 28, 28, 29, 29, 29, 29, + 30, 30, 30 }, + { 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 16, 18, 19, 20, 21, 22, 23, 24, 25, 26, 26, 27, 27, 28, 28, 28, 29, 29, 29, + 29, 30, 30, 30 }, + { 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 15, 16, 18, 19, 20, 21, 22, 23, 24, 25, 26, 26, 27, 27, 28, 28, 28, 29, 29, + 29, 29, 30, 30, 30 }, + { 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 15, 16, 18, 19, 20, 21, 22, 23, 24, 25, 26, 26, 27, 27, 28, 28, 28, 29, 29, + 29, 29, 30, 30, 30, 30 } +}; + +static const unsigned char ScaleFactorWeights[8][32] = { + { 0, 0, 0, 1, 1, 2, 2, 2, 2, 2, 2, 3, 2, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 6, 6, + 7, 7, 8, 10, 12, 12, 12 }, + { 3, 2, 2, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 2, 3, + 3, 4, 5, 7, 10, 10, 10 }, + { 0, 2, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, + 7, 7, 8, 9, 12, 12, 12 }, + { 0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 8, 8, 10, + 11, 11, 12, 13, 13, 13, 13 }, + { 0, 2, 2, 3, 3, 4, 4, 5, 4, 5, 5, 5, 5, 6, 7, 8, 8, 8, 8, 9, 9, 9, 10, 10, + 11, 12, 12, 13, 13, 14, 14, 14 }, + { 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 4, 4, 5, + 6, 7, 7, 9, 11, 11, 11 }, + { 0, 5, 8, 10, 11, 11, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 12, 12, 12, 12, 13, 15, 15, 15 }, + { 0, 2, 3, 4, 5, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 11, 11, + 11, 12, 12, 12, 12, 13, 13, 15, 15, 15 } +}; + +static const double SpectrumScale[] = +{ + 3.0517578125e-5, 6.1035156250e-5, 1.2207031250e-4, 2.4414062500e-4, + 4.8828125000e-4, 9.7656250000e-4, 1.9531250000e-3, 3.9062500000e-3, + 7.8125000000e-3, 1.5625000000e-2, 3.1250000000e-2, 6.2500000000e-2, + 1.2500000000e-1, 2.5000000000e-1, 5.0000000000e-1, 1.0000000000e+0, + 2.0000000000e+0, 4.0000000000e+0, 8.0000000000e+0, 1.6000000000e+1, + 3.2000000000e+1, 6.4000000000e+1, 1.2800000000e+2, 2.5600000000e+2, + 5.1200000000e+2, 1.0240000000e+3, 2.0480000000e+3, 4.0960000000e+3, + 8.1920000000e+3, 1.6384000000e+4, 3.2768000000e+4, 6.5536000000e+4 +}; + +static const double QuantizerInverseStepSize[] = +{ + 0.5, 1.5, 3.5, 7.5, 15.5, 31.5, 63.5, 127.5, + 255.5, 511.5, 1023.5, 2047.5, 4095.5, 8191.5, 16383.5, 32767.5 +}; + +static const double QuantizerStepSize[] = +{ + 2.0000000000000000e+0, 6.6666666666666663e-1, 2.8571428571428570e-1, 1.3333333333333333e-1, + 6.4516129032258063e-2, 3.1746031746031744e-2, 1.5748031496062992e-2, 7.8431372549019607e-3, + 3.9138943248532287e-3, 1.9550342130987292e-3, 9.7703957010258913e-4, 4.8840048840048840e-4, + 2.4417043096081065e-4, 1.2207776353537203e-4, 6.1037018951994385e-5, 3.0518043793392844e-5 +}; + +static const double QuantizerFineStepSize[] = +{ + 3.0518043793392844e-05, 1.0172681264464281e-05, 4.3597205419132631e-06, 2.0345362528928561e-06, + 9.8445302559331759e-07, 4.8441339354591809e-07, 2.4029955742829012e-07, 1.1967860311134448e-07, + 5.9722199204291275e-08, 2.9831909866464167e-08, 1.4908668194134265e-08, 7.4525137468602791e-09, + 3.7258019525568114e-09, 1.8627872668859698e-09, 9.3136520869755679e-10, 4.6567549848772173e-10 +}; + +static const double ImdctWindow[3][256] = +{ + { + 1.5063601381680520e-4, 1.3584474462543723e-3, 3.7886177320335095e-3, 7.4703503843107054e-3, + 1.2447713421893925e-2, 1.8779928743902802e-2, 2.6541711957177316e-2, 3.5823617534646725e-2, + 4.6732325615097686e-2, 5.9390783134218215e-2, 7.3938082263507912e-2, 9.0528922524202596e-2, + 1.0933245918379739e-1, 1.3053029043162839e-1, 1.5431328196962155e-1, 1.8087687549234890e-1, + 2.1041448667730642e-1, 2.4310858398841248e-1, 2.7911907387439294e-1, 3.1856872996596264e-1, + 3.6152562795443521e-1, 4.0798291770561540e-1, 4.5783680167276436e-1, 5.1086428598490341e-1, + 5.6670306751604915e-1, 6.2483668296959261e-1, 6.8458855955238673e-1, 7.4512859813279642e-1, + 8.0549512595071404e-1, 8.6463333603715664e-1, 9.2144879049936534e-1, 9.7487163368853114e-1, + 1.0239245475428549e+0, 1.0677859781525272e+0, 1.1058403504640593e+0, 1.1377089681197508e+0, + 1.1632585999272456e+0, 1.1825885024539857e+0, 1.1959998581789721e+0, 1.2039536211881783e+0, + 1.2070233145307432e+0, 1.2058486131649040e+0, 1.2010940425977306e+0, 1.1934153504838110e+0, + 1.1834344842439808e+0, 1.1717228717811341e+0, 1.1587919249501784e+0, 1.1450893197640399e+0, + 1.1309995494487093e+0, 1.1168473822408471e+0, 1.1029030881588375e+0, 1.0893885582131881e+0, + 1.0764836829527871e+0, 1.0643325635250040e+0, 1.0530492907625166e+0, 1.0427231479840364e+0, + 1.0334231771880351e+0, 1.0252021034645231e+0, 1.0180996458407172e+0, 1.0121452604998511e+0, + 1.0073603692144730e+0, 1.0037601255634609e+0, 1.0013547666740490e+0, 1.0001505906450658e+0 + }, { + 3.7651915440994232e-5, 3.3903736493218477e-4, 9.4271596562609417e-4, 1.8505048571780937e-3, + 3.0651340559987531e-3, 4.5902515284472088e-3, 6.4304297938873409e-3, 8.5911739140682852e-3, + 1.1078930682637963e-2, 1.3901098781352234e-2, 1.7066039616689482e-2, 2.0583088491103220e-2, + 2.4462565695958088e-2, 2.8715787037224924e-2, 3.3355073219146852e-2, 3.8393757414250607e-2, + 4.3846190239227485e-2, 4.9727741234403468e-2, 5.6054795808958245e-2, 6.2844746464207860e-2, + 7.0115976942893413e-2, 7.7887837773809712e-2, 8.6180611489131392e-2, 9.5015465588190032e-2, + 1.0441439110899919e-1, 1.1440012445165516e-1, 1.2499604988161275e-1, 1.3622607993355360e-1, + 1.4811451074825102e-1, 1.6068584921843129e-1, 1.7396460871118313e-1, 1.8797507009352904e-1, + 2.0274100483757931e-1, 2.1828535714932726e-1, 2.3462988238128749e-1, 2.5179473948771497e-1, + 2.6979803599809959e-1, 2.8865532495679624e-1, 3.0837905453917885e-1, 3.2897797263820194e-1, + 3.5045649064171047e-1, 3.7281401289878474e-1, 3.9604424099221475e-1, 4.2013446485772571e-1, + 4.4506485595071510e-1, 4.7080778095190723e-1, 4.9732715777574310e-1, 5.2457787870593686e-1, + 5.5250532809467989e-1, 5.8104502395207014e-1, 6.1012241362349240e-1, 6.3965285330398725e-1, + 6.6954179909221967e-1, 6.9968523342026989e-1, 7.2997034487883472e-1, 7.6027647168828361e-1, + 7.9047630950129577e-1, 8.2043737319873378e-1, 8.5002369037661385e-1, 8.7909769200424248e-1, + 9.0752225407332920e-1, 9.3516283382959753e-1, 9.6188963623878732e-1, 9.8757974143721583e-1, + 1.0121191226072481e+0, 1.0354044862860237e+0, 1.0573448735328910e+0, 1.0778629702922595e+0, + 1.0968960880396657e+0, 1.1143967904987269e+0, 1.1303331578280613e+0, 1.1446886951223105e+0, + 1.1574619063379246e+0, 1.1686655669886925e+0, 1.1783257385311958e+0, 1.1864805739134745e+0, + 1.1931789671968236e+0, 1.1984791006306033e+0, 1.2024469404108813e+0, 1.2051547280715558e+0, + 1.2066795086022493e+0, 1.2071017295371607e+0, 1.2065039379557967e+0, 1.2049695950523571e+0, + 1.2025820210455416e+0, 1.1994234769930983e+0, 1.1955743847246600e+0, 1.1911126817016218e+0, + 1.1861133041685319e+0, 1.1806477894334932e+0, 1.1747839864214937e+0, 1.1685858626755936e+0, + 1.1621133956159084e+0, 1.1554225359834911e+0, 1.1485652318799691e+0, 1.1415895025598750e+0, + 1.1345395520508252e+0, 1.1274559136920683e+0, 1.1203756177344357e+0, 1.1133323751882473e+0, + 1.1063567721065632e+0, 1.0994764694261203e+0, 1.0927164043428366e+0, 1.0860989899652926e+0, + 1.0796443106658165e+0, 1.0733703111362594e+0, 1.0672929776585733e+0, 1.0614265105249636e+0, + 1.0557834868958031e+0, 1.0503750136731993e+0, 1.0452108702017300e+0, 1.0402996407927114e+0, + 1.0356488372113455e+0, 1.0312650113735067e+0, 1.0271538585764670e+0, 1.0233203116405181e+0, + 1.0197686263706869e+0, 1.0165024587632581e+0, 1.0135249343839337e+0, 1.0108387103358234e+0, + 1.0084460302183964e+0, 1.0063487724548694e+0, 1.0045484923368146e+0, 1.0030464581022487e+0, + 1.0018436813281120e+0, 1.0009409418806117e+0, 1.0003388076279887e+0, 1.0000376490803209e+0 + }, { + 9.4125358861057580e-6, 8.4723454567934287e-5, 2.3540199944993968e-4, 4.6156161284434405e-4, + 7.6337252627811040e-4, 1.1410618417977527e-3, 1.5949136397635877e-3, 2.1252691126038246e-3, + 2.7325267238603361e-3, 3.4171423917127887e-3, 4.1796296960223351e-3, 5.0205601077783681e-3, + 5.9405632396719189e-3, 6.9403271163487401e-3, 8.0205984627170716e-3, 9.1821830084947605e-3, + 1.0425945806983514e-2, 1.1752811565843454e-2, 1.3163764987419446e-2, 1.4659851115929995e-2, + 1.6242175688578154e-2, 1.7911905487372128e-2, 1.9670268688158944e-2, 2.1518555203066853e-2, + 2.3458117012231147e-2, 2.5490368480329692e-2, 2.7616786653092303e-2, 2.9838911528555608e-2, + 3.2158346297426151e-2, 3.4576757546475517e-2, 3.7095875418430582e-2, 3.9717493721334048e-2, + 4.2443469979832761e-2, 4.5275725420312357e-2, 4.8216244881222385e-2, 5.1267076639338320e-2, + 5.4430332142078826e-2, 5.7708185635340262e-2, 6.1102873675624066e-2, 6.4616694514523759e-2, + 6.8252007342895715e-2, 7.2011231381276714e-2, 7.5896844802323671e-2, 7.9911383470241099e-2, + 8.4057439481337801e-2, 8.8337659489012607e-2, 9.2754742795618184e-2, 9.7311439192797680e-2, + 1.0201054653103089e-1, 1.0685490799828457e-1, 1.1184740908682539e-1, 1.1699097422645341e-1, + 1.2228856306163924e-1, 1.2774316634932814e-1, 1.3335780145351064e-1, 1.3913550741207273e-1, + 1.4507933955094346e-1, 1.5119236362017258e-1, 1.5747764942631495e-1, 1.6393826393539396e-1, + 1.7057726382078942e-1, 1.7739768743066411e-1, 1.8440254615004589e-1, 1.9159481513343729e-1, + 1.9897742338487026e-1, 2.0655324316369295e-1, 2.1432507869609080e-1, 2.2229565417446207e-1, + 2.3046760102930014e-1, 2.3884344446123953e-1, 2.4742558922441760e-1, 2.5621630465634182e-1, + 2.6521770895405600e-1, 2.7443175270160086e-1, 2.8386020165960929e-1, 2.9350461883436230e-1, + 3.0336634585081029e-1, 3.1344648366192157e-1, 3.2374587263528420e-1, 3.3426507206713507e-1, + 3.4500433918392642e-1, 3.5596360770212615e-1, 3.6714246602814504e-1, 3.7854013519204033e-1, + 3.9015544662088664e-1, 4.0198681987032736e-1, 4.1403224044573772e-1, 4.2628923785747552e-1, + 4.3875486406774339e-1, 4.5142567249943838e-1, 4.6429769778983110e-1, 4.7736643648376575e-1, + 4.9062682887207903e-1, 5.0407324219080429e-1, 5.1769945540522078e-1, 5.3149864580960171e-1, + 5.4546337767832298e-1, 5.5958559320651569e-1, 5.7385660597837662e-1, 5.8826709719829806e-1, + 6.0280711491388439e-1, 6.1746607645042140e-1, 6.3223277426326774e-1, 6.4709538539776845e-1, + 6.6204148472553526e-1, 6.7705806210126773e-1, 6.9213154355570450e-1, 7.0724781660791802e-1, + 7.2239225974418442e-1, 7.3754977607134042e-1, 7.5270483111028141e-1, 7.6784149465049434e-1, + 7.8294348653984391e-1, 7.9799422623585203e-1, 8.1297688589617634e-1, 8.2787444673767518e-1, + 8.4266975834616653e-1, 8.5734560057365039e-1, 8.7188474761721291e-1, 8.8627003383497205e-1, + 9.0048442082009783e-1, 9.1451106522491854e-1, 9.2833338680417532e-1, 9.4193513613017210e-1, + 9.5530046142343950e-1, 9.6841397394092599e-1, 9.8126081136987864e-1, 9.9382669868953555e-1, + 1.0060980059844091e+0, 1.0180618027220363e+0, 1.0297059080441424e+0, 1.0410189366626670e+0, + 1.0519903400002633e+0, 1.0626104422678846e+0, 1.0728704712289712e+0, 1.0827625834595000e+0, + 1.0922798839747383e+0, 1.1014164401558058e+0, 1.1101672899710839e+0, 1.1185284445480093e+0, + 1.1264968852089079e+0, 1.1340705551393566e+0, 1.1412483459082730e+0, 1.1480300791048799e+0, + 1.1544164833982939e+0, 1.1604091673602994e+0, 1.1660105884206766e+0, 1.1712240183469862e+0, + 1.1760535056570971e+0, 1.1805038353829482e+0, 1.1845804866083633e+0, 1.1882895882024833e+0, + 1.1916378731638992e+0, 1.1946326319794081e+0, 1.1972816653859069e+0, 1.1995932369049056e+0, + 1.2015760254970136e+0, 1.2032390786591391e+0, 1.2045917662605969e+0, 1.2056437353864047e+0, + 1.2064048664272926e+0, 1.2068852306268385e+0, 1.2070950492671089e+0, 1.2070446546456641e+0, + 1.2067444529690747e+0, 1.2062048892615329e+0, 1.2054364143619665e+0, 1.2044494540594373e+0, + 1.2032543803947247e+0, 1.2018614851359353e+0, 1.2002809554178011e+0, 1.1985228515180752e+0, + 1.1965970867300784e+0, 1.1945134092779761e+0, 1.1922813862107031e+0, 1.1899103892015168e+0, + 1.1874095821728761e+0, 1.1847879106605945e+0, 1.1820540928268801e+0, 1.1792166120288408e+0, + 1.1762837108471988e+0, 1.1732633864791515e+0, 1.1701633873994670e+0, 1.1669912111948835e+0, + 1.1637541034785324e+0, 1.1604590577934164e+0, 1.1571128164167324e+0, 1.1537218719800488e+0, + 1.1502924698238557e+0, 1.1468306110087907e+0, 1.1433420559098040e+0, 1.1398323283235916e+0, + 1.1363067200237802e+0, 1.1327702957024974e+0, 1.1292278982411037e+0, 1.1256841542569240e+0, + 1.1221434798768233e+0, 1.1186100866923183e+0, 1.1150879878546791e+0, 1.1115810042720471e+0, + 1.1080927708740320e+0, 1.1046267429125149e+0, 1.1011862022704582e+0, 1.0977742637534329e+0, + 1.0943938813413197e+0, 1.0910478543801592e+0, 1.0877388336965346e+0, 1.0844693276190560e+0, + 1.0812417078935614e+0, 1.0780582154805316e+0, 1.0749209662249377e+0, 1.0718319563903185e+0, + 1.0687930680503352e+0, 1.0658060743323419e+0, 1.0628726445087104e+0, 1.0599943489327022e+0, + 1.0571726638166488e+0, 1.0544089758510451e+0, 1.0517045866639296e+0, 1.0490607171205948e+0, + 1.0464785114642610e+0, 1.0439590412988613e+0, 1.0415033094155353e+0, 1.0391122534648085e+0, + 1.0367867494767635e+0, 1.0345276152317773e+0, 1.0323356134846211e+0, 1.0302114550449104e+0, + 1.0281558017170187e+0, 1.0261692691026814e+0, 1.0242524292695903e+0, 1.0224058132893159e+0, + 1.0206299136479189e+0, 1.0189251865326008e+0, 1.0172920539977235e+0, 1.0157309060134747e+0, + 1.0142421024004051e+0, 1.0128259746529766e+0, 1.0114828276551826e+0, 1.0102129412911960e+0, + 1.0090165719538935e+0, 1.0078939539539893e+0, 1.0068453008323810e+0, 1.0058708065781889e+0, + 1.0049706467548214e+0, 1.0041449795362705e+0, 1.0033939466556858e+0, 1.0027176742681361e+0, + 1.0021162737293055e+0, 1.0015898422917326e+0, 1.0011384637200291e+0, 1.0007622088263692e+0, + 1.0004611359273783e+0, 1.0002352912233887e+0, 1.0000847091008724e+0, 1.0000094123586978e+0 + } +}; + +static const double SinTables[9][256] = +{ + { + 7.0710678118654746e-1 + }, { + 3.8268343236508978e-1, 9.2387953251128674e-1 + }, { + 1.9509032201612825e-1, 8.3146961230254524e-1, 9.8078528040323043e-1, 5.5557023301960218e-1 + }, { + 9.8017140329560604e-2, 4.7139673682599764e-1, 7.7301045336273699e-1, 9.5694033573220894e-1, + 9.9518472667219693e-1, 8.8192126434835505e-1, 6.3439328416364549e-1, 2.9028467725446239e-1 + }, { + 4.9067674327418015e-2, 2.4298017990326387e-1, 4.2755509343028208e-1, 5.9569930449243336e-1, + 7.4095112535495911e-1, 8.5772861000027212e-1, 9.4154406518302081e-1, 9.8917650996478101e-1, + 9.9879545620517241e-1, 9.7003125319454397e-1, 9.0398929312344345e-1, 8.0320753148064494e-1, + 6.7155895484701855e-1, 5.1410274419322177e-1, 3.3688985339222033e-1, 1.4673047445536180e-1 + }, { + 2.4541228522912288e-2, 1.2241067519921620e-1, 2.1910124015686980e-1, 3.1368174039889152e-1, + 4.0524131400498986e-1, 4.9289819222978404e-1, 5.7580819141784534e-1, 6.5317284295377676e-1, + 7.2424708295146689e-1, 7.8834642762660623e-1, 8.4485356524970701e-1, 8.9322430119551532e-1, + 9.3299279883473885e-1, 9.6377606579543984e-1, 9.8527764238894122e-1, 9.9729045667869021e-1, + 9.9969881869620425e-1, 9.9247953459870997e-1, 9.7570213003852857e-1, 9.4952818059303667e-1, + 9.1420975570353069e-1, 8.7008699110871146e-1, 8.1758481315158371e-1, 7.5720884650648468e-1, + 6.8954054473706705e-1, 6.1523159058062693e-1, 5.3499761988709715e-1, 4.4961132965460687e-1, + 3.5989503653498833e-1, 2.6671275747489848e-1, 1.7096188876030122e-1, 7.3564563599667732e-2 + }, { + 1.2271538285719925e-2, 6.1320736302208578e-2, 1.1022220729388306e-1, 1.5885814333386145e-1, + 2.0711137619221856e-1, 2.5486565960451457e-1, 3.0200594931922808e-1, 3.4841868024943456e-1, + 3.9399204006104810e-1, 4.3861623853852766e-1, 4.8218377207912272e-1, 5.2458968267846895e-1, + 5.6573181078361312e-1, 6.0551104140432555e-1, 6.4383154288979139e-1, 6.8060099779545302e-1, + 7.1573082528381859e-1, 7.4913639452345926e-1, 7.8073722857209438e-1, 8.1045719825259477e-1, + 8.3822470555483797e-1, 8.6397285612158670e-1, 8.8763962040285393e-1, 9.0916798309052227e-1, + 9.2850608047321548e-1, 9.4560732538052128e-1, 9.6043051941556579e-1, 9.7293995220556007e-1, + 9.8310548743121629e-1, 9.9090263542778001e-1, 9.9631261218277800e-1, 9.9932238458834954e-1, + 9.9992470183914450e-1, 9.9811811290014918e-1, 9.9390697000235606e-1, 9.8730141815785843e-1, + 9.7831737071962765e-1, 9.6697647104485207e-1, 9.5330604035419386e-1, 9.3733901191257496e-1, + 9.1911385169005777e-1, 8.9867446569395393e-1, 8.7607009419540660e-1, 8.5135519310526520e-1, + 8.2458930278502518e-1, 7.9583690460888357e-1, 7.6516726562245907e-1, 7.3265427167241282e-1, + 6.9837624940897292e-1, 6.6241577759017201e-1, 6.2485948814238634e-1, 5.8579785745643898e-1, + 5.4532498842204635e-1, 5.0353838372571769e-1, 4.6053871095824023e-1, 4.1642956009763715e-1, + 3.7131719395183771e-1, 3.2531029216226326e-1, 2.7851968938505317e-1, 2.3105810828067133e-1, + 1.8303988795514090e-1, 1.3458070850712628e-1, 8.5797312344440158e-2, 3.6807222941358832e-2 + }, { + 6.1358846491544753e-3, 3.0674803176636626e-2, 5.5195244349689934e-2, 7.9682437971430126e-2, + 1.0412163387205459e-1, 1.2849811079379317e-1, 1.5279718525844344e-1, 1.7700422041214875e-1, + 2.0110463484209190e-1, 2.2508391135979283e-1, 2.4892760574572015e-1, 2.7262135544994898e-1, + 2.9615088824362379e-1, 3.1950203081601569e-1, 3.4266071731199438e-1, 3.6561299780477385e-1, + 3.8834504669882625e-1, 4.1084317105790391e-1, 4.3309381885315196e-1, 4.5508358712634384e-1, + 4.7679923006332209e-1, 4.9822766697278187e-1, 5.1935599016558964e-1, 5.4017147272989285e-1, + 5.6066157619733603e-1, 5.8081395809576453e-1, 6.0061647938386897e-1, 6.2005721176328910e-1, + 6.3912444486377573e-1, 6.5780669329707864e-1, 6.7609270357531592e-1, 6.9397146088965400e-1, + 7.1143219574521643e-1, 7.2846439044822520e-1, 7.4505778544146595e-1, 7.6120238548426178e-1, + 7.7688846567323244e-1, 7.9210657730021239e-1, 8.0684755354379922e-1, 8.2110251499110465e-1, + 8.3486287498638001e-1, 8.4812034480329712e-1, 8.6086693863776731e-1, 8.7309497841829009e-1, + 8.8479709843093779e-1, 8.9596624975618511e-1, 9.0659570451491533e-1, 9.1667905992104270e-1, + 9.2621024213831127e-1, 9.3518350993894750e-1, 9.4359345816196039e-1, 9.5143502096900834e-1, + 9.5870347489587160e-1, 9.6539444169768940e-1, 9.7150389098625178e-1, 9.7702814265775439e-1, + 9.8196386910955524e-1, 9.8630809724459867e-1, 9.9005821026229712e-1, 9.9321194923479450e-1, + 9.9576741446765982e-1, 9.9772306664419164e-1, 9.9907772775264536e-1, 9.9983058179582340e-1, + 9.9998117528260111e-1, 9.9952941750109314e-1, 9.9847558057329477e-1, 9.9682029929116578e-1, + 9.9456457073425542e-1, 9.9170975366909953e-1, 9.8825756773074946e-1, 9.8421009238692903e-1, + 9.7956976568544052e-1, 9.7433938278557586e-1, 9.6852209427441738e-1, 9.6212140426904158e-1, + 9.5514116830577067e-1, 9.4758559101774120e-1, 9.3945922360218992e-1, 9.3076696107898371e-1, + 9.2151403934204201e-1, 9.1170603200542988e-1, 9.0134884704602203e-1, 8.9044872324475799e-1, + 8.7901222642863353e-1, 8.6704624551569276e-1, 8.5455798836540053e-1, 8.4155497743689844e-1, + 8.2804504525775580e-1, 8.1403632970594852e-1, 7.9953726910790524e-1, 7.8455659715557513e-1, + 7.6910333764557959e-1, 7.5318679904361252e-1, 7.3681656887737002e-1, 7.2000250796138177e-1, + 7.0275474445722519e-1, 6.8508366777270036e-1, 6.6699992230363758e-1, 6.4851440102211255e-1, + 6.2963823891492721e-1, 6.1038280627630970e-1, 5.9075970185887416e-1, 5.7078074588696726e-1, + 5.5045797293660492e-1, 5.2980362468629483e-1, 5.0883014254310732e-1, 4.8755016014843588e-1, + 4.6597649576796618e-1, 4.4412214457042931e-1, 4.2200027079979985e-1, 3.9962419984564707e-1, + 3.7700741021641815e-1, 3.5416352542049040e-1, 3.3110630575987648e-1, 3.0784964004153503e-1, + 2.8440753721127210e-1, 2.6079411791527585e-1, 2.3702360599436717e-1, 2.1311031991609142e-1, + 1.8906866414980636e-1, 1.6491312048997014e-1, 1.4065823933284954e-1, 1.1631863091190471e-1, + 9.1908956497132752e-2, 6.7443919563664176e-2, 4.2938256934941021e-2, 1.8406729905805101e-2 + }, { + 3.0679567629659761e-3, 1.5339206284988100e-2, 2.7608145778965740e-2, 3.9872927587739811e-2, + 5.2131704680283324e-2, 6.4382630929857465e-2, 7.6623861392031492e-2, 8.8853552582524600e-2, + 1.0106986275482782e-1, 1.1327095217756435e-1, 1.2545498341154623e-1, 1.3762012158648604e-1, + 1.4976453467732151e-1, 1.6188639378011183e-1, 1.7398387338746382e-1, 1.8605515166344663e-1, + 1.9809841071795356e-1, 2.1011183688046961e-1, 2.2209362097320351e-1, 2.3404195858354343e-1, + 2.4595505033579459e-1, 2.5783110216215899e-1, 2.6966832557291509e-1, 2.8146493792575794e-1, + 2.9321916269425863e-1, 3.0492922973540237e-1, 3.1659337555616585e-1, 3.2820984357909250e-1, + 3.3977688440682685e-1, 3.5129275608556709e-1, 3.6275572436739723e-1, 3.7416406297145793e-1, + 3.8551605384391885e-1, 3.9680998741671031e-1, 4.0804416286497869e-1, 4.1921688836322391e-1, + 4.3032648134008261e-1, 4.4137126873171667e-1, 4.5234958723377089e-1, 4.6325978355186015e-1, + 4.7410021465054997e-1, 4.8486924800079106e-1, 4.9556526182577254e-1, 5.0618664534515523e-1, + 5.1673179901764987e-1, 5.2719913478190128e-1, 5.3758707629564539e-1, 5.4789405917310019e-1, + 5.5811853122055610e-1, 5.6825895267013149e-1, 5.7831379641165559e-1, 5.8828154822264522e-1, + 5.9816070699634227e-1, 6.0794978496777363e-1, 6.1764730793780387e-1, 6.2725181549514408e-1, + 6.3676186123628420e-1, 6.4617601298331628e-1, 6.5549285299961535e-1, 6.6471097820334479e-1, + 6.7382900037875604e-1, 6.8284554638524808e-1, 6.9175925836415775e-1, 7.0056879394324834e-1, + 7.0927282643886558e-1, 7.1787004505573171e-1, 7.2635915508434601e-1, 7.3473887809596339e-1, + 7.4300795213512172e-1, 7.5116513190968637e-1, 7.5920918897838796e-1, 7.6713891193582040e-1, + 7.7495310659487382e-1, 7.8265059616657573e-1, 7.9023022143731003e-1, 7.9769084094339104e-1, + 8.0503133114296366e-1, 8.1225058658520388e-1, 8.1934752007679690e-1, 8.2632106284566342e-1, + 8.3317016470191319e-1, 8.3989379419599941e-1, 8.4649093877405202e-1, 8.5296060493036363e-1, + 8.5930181835700836e-1, 8.6551362409056898e-1, 8.7159508665595109e-1, 8.7754529020726124e-1, + 8.8336333866573158e-1, 8.8904835585466457e-1, 8.9459948563138258e-1, 9.0001589201616028e-1, + 9.0529675931811882e-1, 9.1044129225806714e-1, 9.1544871608826783e-1, 9.2031827670911048e-1, + 9.2504924078267758e-1, 9.2964089584318133e-1, 9.3409255040425887e-1, 9.3840353406310806e-1, + 9.4257319760144687e-1, 9.4660091308328353e-1, 9.5048607394948170e-1, 9.5422809510910567e-1, + 9.5782641302753291e-1, 9.6128048581132064e-1, 9.6458979328981265e-1, 9.6775383709347551e-1, + 9.7077214072895035e-1, 9.7364424965081187e-1, 9.7636973133002114e-1, 9.7894817531906220e-1, + 9.8137919331375456e-1, 9.8366241921173025e-1, 9.8579750916756737e-1, 9.8778414164457218e-1, + 9.8962201746320078e-1, 9.9131085984611544e-1, 9.9285041445986510e-1, 9.9424044945318790e-1, + 9.9548075549192694e-1, 9.9657114579055484e-1, 9.9751145614030345e-1, 9.9830154493389289e-1, + 9.9894129318685687e-1, 9.9943060455546173e-1, 9.9976940535121528e-1, 9.9995764455196390e-1, + 9.9999529380957619e-1, 9.9988234745421256e-1, 9.9961882249517864e-1, 9.9920475861836389e-1, + 9.9864021818026527e-1, 9.9792528619859600e-1, 9.9706007033948296e-1, 9.9604470090125197e-1, + 9.9487933079480562e-1, 9.9356413552059530e-1, 9.9209931314219180e-1, 9.9048508425645698e-1, + 9.8872169196032378e-1, 9.8680940181418553e-1, 9.8474850180190421e-1, 9.8253930228744124e-1, + 9.8018213596811743e-1, 9.7767735782450993e-1, 9.7502534506699412e-1, 9.7222649707893638e-1, + 9.6928123535654853e-1, 9.6619000344541262e-1, 9.6295326687368388e-1, 9.5957151308198452e-1, + 9.5604525134999652e-1, 9.5237501271976588e-1, 9.4856134991573038e-1, 9.4460483726148026e-1, + 9.4050607059326830e-1, 9.3626566717027826e-1, 9.3188426558166815e-1, 9.2736252565040111e-1, + 9.2270112833387852e-1, 9.1790077562139050e-1, 9.1296219042839821e-1, 9.0788611648766615e-1, + 9.0267331823725883e-1, 8.9732458070541832e-1, 8.9184070939234272e-1, 8.8622253014888064e-1, + 8.8047088905216087e-1, 8.7458665227817622e-1, 8.6857070597134101e-1, 8.6242395611104061e-1, + 8.5614732837519458e-1, 8.4974176800085266e-1, 8.4320823964184544e-1, 8.3654772722351201e-1, + 8.2976123379452305e-1, 8.2284978137582632e-1, 8.1581441080673378e-1, 8.0865618158817509e-1, + 8.0137617172314035e-1, 7.9397547755433728e-1, 7.8645521359908588e-1, 7.7881651238147609e-1, + 7.7106052426181371e-1, 7.6318841726338127e-1, 7.5520137689653655e-1, 7.4710060598018013e-1, + 7.3888732446061522e-1, 7.3056276922782759e-1, 7.2212819392921546e-1, 7.1358486878079375e-1, + 7.0493408037590510e-1, 6.9617713149146310e-1, 6.8731534089175927e-1, 6.7835004312986136e-1, + 6.6928258834663601e-1, 6.6011434206742048e-1, 6.5084668499638099e-1, 6.4148101280858316e-1, + 6.3201873593980906e-1, 6.2246127937415008e-1, 6.1281008242940982e-1, 6.0306659854034839e-1, + 5.9323229503980002e-1, 5.8330865293769851e-1, 5.7329716669804209e-1, 5.6319934401383409e-1, + 5.5301670558002758e-1, 5.4275078486451589e-1, 5.3240312787719801e-1, 5.2197529293715450e-1, + 5.1146885043797052e-1, 5.0088538261124094e-1, 4.9022648328829138e-1, 4.7949375766015329e-1, + 4.6868882203582785e-1, 4.5781330359887717e-1, 4.4686884016237416e-1, 4.3585707992225553e-1, + 4.2477968120910886e-1, 4.1363831223843461e-1, 4.0243465085941860e-1, 3.9117038430225404e-1, + 3.7984720892405138e-1, 3.6846682995337260e-1, 3.5703096123343031e-1, 3.4554132496398898e-1, + 3.3399965144200938e-1, 3.2240767880106985e-1, 3.1076715274961153e-1, 2.9907982630804053e-1, + 2.8734745954472962e-1, 2.7557181931095831e-1, 2.6375467897483157e-1, 2.5189781815421719e-1, + 2.4000302244874178e-1, 2.2807208317088606e-1, 2.1610679707621944e-1, 2.0410896609281684e-1, + 1.9208039704989247e-1, 1.8002290140569957e-1, 1.6793829497473128e-1, 1.5582839765426537e-1, + 1.4369503315029464e-1, 1.3154002870288334e-1, 1.1936521481099163e-1, 1.0717242495680916e-1, + 9.4963495329638908e-2, 8.2740264549375636e-2, 7.0504573389613856e-2, 5.8258264500435794e-2, + 4.6003182130914706e-2, 3.3741171851377705e-2, 2.1474080275469667e-2, 9.2037547820600207e-3 + } +}; +static const double CosTables[9][256] = +{ + { + +7.0710678118654757e-1 + }, { + +9.2387953251128674e-1, -3.8268343236508973e-1 + }, { + +9.8078528040323043e-1, +5.5557023301960229e-1, -1.9509032201612819e-1, -8.3146961230254535e-1 + }, { + +9.9518472667219693e-1, +8.8192126434835505e-1, +6.3439328416364549e-1, +2.9028467725446233e-1, + -9.8017140329560645e-2, -4.7139673682599770e-1, -7.7301045336273699e-1, -9.5694033573220882e-1 + }, { + +9.9879545620517241e-1, +9.7003125319454397e-1, +9.0398929312344334e-1, +8.0320753148064494e-1, + +6.7155895484701833e-1, +5.1410274419322166e-1, +3.3688985339222005e-1, +1.4673047445536175e-1, + -4.9067674327418008e-2, -2.4298017990326387e-1, -4.2755509343028186e-1, -5.9569930449243336e-1, + -7.4095112535495888e-1, -8.5772861000027201e-1, -9.4154406518302070e-1, -9.8917650996478101e-1 + }, { + +9.9969881869620425e-1, +9.9247953459870997e-1, +9.7570213003852857e-1, +9.4952818059303667e-1, + +9.1420975570353069e-1, +8.7008699110871146e-1, +8.1758481315158371e-1, +7.5720884650648457e-1, + +6.8954054473706694e-1, +6.1523159058062682e-1, +5.3499761988709726e-1, +4.4961132965460660e-1, + +3.5989503653498828e-1, +2.6671275747489842e-1, +1.7096188876030136e-1, +7.3564563599667454e-2, + -2.4541228522912142e-2, -1.2241067519921615e-1, -2.1910124015686966e-1, -3.1368174039889141e-1, + -4.0524131400498975e-1, -4.9289819222978398e-1, -5.7580819141784534e-1, -6.5317284295377653e-1, + -7.2424708295146678e-1, -7.8834642762660623e-1, -8.4485356524970712e-1, -8.9322430119551521e-1, + -9.3299279883473885e-1, -9.6377606579543984e-1, -9.8527764238894122e-1, -9.9729045667869021e-1 + }, { + +9.9992470183914450e-1, +9.9811811290014918e-1, +9.9390697000235606e-1, +9.8730141815785843e-1, + +9.7831737071962765e-1, +9.6697647104485207e-1, +9.5330604035419386e-1, +9.3733901191257496e-1, + +9.1911385169005777e-1, +8.9867446569395382e-1, +8.7607009419540660e-1, +8.5135519310526520e-1, + +8.2458930278502529e-1, +7.9583690460888357e-1, +7.6516726562245896e-1, +7.3265427167241282e-1, + +6.9837624940897292e-1, +6.6241577759017178e-1, +6.2485948814238645e-1, +5.8579785745643886e-1, + +5.4532498842204646e-1, +5.0353838372571758e-1, +4.6053871095824001e-1, +4.1642956009763732e-1, + +3.7131719395183760e-1, +3.2531029216226298e-1, +2.7851968938505306e-1, +2.3105810828067128e-1, + +1.8303988795514106e-1, +1.3458070850712622e-1, +8.5797312344439880e-2, +3.6807222941358991e-2, + -1.2271538285719823e-2, -6.1320736302208530e-2, -1.1022220729388306e-1, -1.5885814333386128e-1, + -2.0711137619221845e-1, -2.5486565960451452e-1, -3.0200594931922808e-1, -3.4841868024943440e-1, + -3.9399204006104799e-1, -4.3861623853852738e-1, -4.8218377207912272e-1, -5.2458968267846873e-1, + -5.6573181078361323e-1, -6.0551104140432543e-1, -6.4383154288979128e-1, -6.8060099779545302e-1, + -7.1573082528381859e-1, -7.4913639452345915e-1, -7.8073722857209449e-1, -8.1045719825259466e-1, + -8.3822470555483808e-1, -8.6397285612158670e-1, -8.8763962040285382e-1, -9.0916798309052238e-1, + -9.2850608047321548e-1, -9.4560732538052117e-1, -9.6043051941556579e-1, -9.7293995220556007e-1, + -9.8310548743121629e-1, -9.9090263542778001e-1, -9.9631261218277800e-1, -9.9932238458834954e-1 + }, { + +9.9998117528260111e-1, +9.9952941750109314e-1, +9.9847558057329477e-1, +9.9682029929116567e-1, + +9.9456457073425542e-1, +9.9170975366909953e-1, +9.8825756773074946e-1, +9.8421009238692903e-1, + +9.7956976568544052e-1, +9.7433938278557586e-1, +9.6852209427441738e-1, +9.6212140426904158e-1, + +9.5514116830577078e-1, +9.4758559101774109e-1, +9.3945922360218992e-1, +9.3076696107898371e-1, + +9.2151403934204201e-1, +9.1170603200542988e-1, +9.0134884704602203e-1, +8.9044872324475788e-1, + +8.7901222642863353e-1, +8.6704624551569265e-1, +8.5455798836540053e-1, +8.4155497743689844e-1, + +8.2804504525775580e-1, +8.1403632970594841e-1, +7.9953726910790501e-1, +7.8455659715557524e-1, + +7.6910333764557970e-1, +7.5318679904361252e-1, +7.3681656887736990e-1, +7.2000250796138165e-1, + +7.0275474445722530e-1, +6.8508366777270036e-1, +6.6699992230363747e-1, +6.4851440102211255e-1, + +6.2963823891492710e-1, +6.1038280627630948e-1, +5.9075970185887428e-1, +5.7078074588696737e-1, + +5.5045797293660481e-1, +5.2980362468629483e-1, +5.0883014254310699e-1, +4.8755016014843605e-1, + +4.6597649576796613e-1, +4.4412214457042926e-1, +4.2200027079979979e-1, +3.9962419984564679e-1, + +3.7700741021641831e-1, +3.5416352542049051e-1, +3.3110630575987643e-1, +3.0784964004153498e-1, + +2.8440753721127182e-1, +2.6079411791527557e-1, +2.3702360599436734e-1, +2.1311031991609136e-1, + +1.8906866414980628e-1, +1.6491312048997009e-1, +1.4065823933284924e-1, +1.1631863091190488e-1, + +9.1908956497132696e-2, +6.7443919563664106e-2, +4.2938256934940959e-2, +1.8406729905804820e-2, + -6.1358846491543929e-3, -3.0674803176636459e-2, -5.5195244349689913e-2, -7.9682437971430015e-2, + -1.0412163387205460e-1, -1.2849811079379311e-1, -1.5279718525844330e-1, -1.7700422041214875e-1, + -2.0110463484209182e-1, -2.2508391135979267e-1, -2.4892760574572012e-1, -2.7262135544994887e-1, + -2.9615088824362384e-1, -3.1950203081601564e-1, -3.4266071731199427e-1, -3.6561299780477385e-1, + -3.8834504669882619e-1, -4.1084317105790380e-1, -4.3309381885315190e-1, -4.5508358712634372e-1, + -4.7679923006332192e-1, -4.9822766697278159e-1, -5.1935599016558964e-1, -5.4017147272989285e-1, + -5.6066157619733592e-1, -5.8081395809576442e-1, -6.0061647938386875e-1, -6.2005721176328921e-1, + -6.3912444486377573e-1, -6.5780669329707864e-1, -6.7609270357531581e-1, -6.9397146088965378e-1, + -7.1143219574521654e-1, -7.2846439044822520e-1, -7.4505778544146595e-1, -7.6120238548426167e-1, + -7.7688846567323233e-1, -7.9210657730021217e-1, -8.0684755354379933e-1, -8.2110251499110465e-1, + -8.3486287498638001e-1, -8.4812034480329712e-1, -8.6086693863776709e-1, -8.7309497841829009e-1, + -8.8479709843093779e-1, -8.9596624975618511e-1, -9.0659570451491533e-1, -9.1667905992104259e-1, + -9.2621024213831138e-1, -9.3518350993894761e-1, -9.4359345816196039e-1, -9.5143502096900834e-1, + -9.5870347489587149e-1, -9.6539444169768929e-1, -9.7150389098625178e-1, -9.7702814265775439e-1, + -9.8196386910955524e-1, -9.8630809724459856e-1, -9.9005821026229701e-1, -9.9321194923479450e-1, + -9.9576741446765982e-1, -9.9772306664419164e-1, -9.9907772775264536e-1, -9.9983058179582340e-1 + }, { + +9.9999529380957619e-1, +9.9988234745421256e-1, +9.9961882249517864e-1, +9.9920475861836389e-1, + +9.9864021818026527e-1, +9.9792528619859600e-1, +9.9706007033948296e-1, +9.9604470090125197e-1, + +9.9487933079480562e-1, +9.9356413552059530e-1, +9.9209931314219180e-1, +9.9048508425645709e-1, + +9.8872169196032378e-1, +9.8680940181418553e-1, +9.8474850180190421e-1, +9.8253930228744124e-1, + +9.8018213596811743e-1, +9.7767735782450993e-1, +9.7502534506699412e-1, +9.7222649707893627e-1, + +9.6928123535654853e-1, +9.6619000344541250e-1, +9.6295326687368388e-1, +9.5957151308198452e-1, + +9.5604525134999641e-1, +9.5237501271976588e-1, +9.4856134991573027e-1, +9.4460483726148026e-1, + +9.4050607059326830e-1, +9.3626566717027826e-1, +9.3188426558166815e-1, +9.2736252565040111e-1, + +9.2270112833387863e-1, +9.1790077562139050e-1, +9.1296219042839821e-1, +9.0788611648766626e-1, + +9.0267331823725883e-1, +8.9732458070541832e-1, +8.9184070939234272e-1, +8.8622253014888064e-1, + +8.8047088905216075e-1, +8.7458665227817611e-1, +8.6857070597134090e-1, +8.6242395611104061e-1, + +8.5614732837519447e-1, +8.4974176800085255e-1, +8.4320823964184544e-1, +8.3654772722351201e-1, + +8.2976123379452305e-1, +8.2284978137582643e-1, +8.1581441080673378e-1, +8.0865618158817498e-1, + +8.0137617172314024e-1, +7.9397547755433717e-1, +7.8645521359908577e-1, +7.7881651238147598e-1, + +7.7106052426181382e-1, +7.6318841726338127e-1, +7.5520137689653655e-1, +7.4710060598018013e-1, + +7.3888732446061511e-1, +7.3056276922782759e-1, +7.2212819392921535e-1, +7.1358486878079364e-1, + +7.0493408037590499e-1, +6.9617713149146299e-1, +6.8731534089175916e-1, +6.7835004312986158e-1, + +6.6928258834663601e-1, +6.6011434206742048e-1, +6.5084668499638099e-1, +6.4148101280858316e-1, + +6.3201873593980906e-1, +6.2246127937415008e-1, +6.1281008242940971e-1, +6.0306659854034828e-1, + +5.9323229503979980e-1, +5.8330865293769829e-1, +5.7329716669804232e-1, +5.6319934401383409e-1, + +5.5301670558002758e-1, +5.4275078486451600e-1, +5.3240312787719801e-1, +5.2197529293715439e-1, + +5.1146885043797052e-1, +5.0088538261124094e-1, +4.9022648328829110e-1, +4.7949375766015301e-1, + +4.6868882203582796e-1, +4.5781330359887729e-1, +4.4686884016237433e-1, +4.3585707992225547e-1, + +4.2477968120910881e-1, +4.1363831223843456e-1, +4.0243465085941854e-1, +3.9117038430225398e-1, + +3.7984720892405111e-1, +3.6846682995337232e-1, +3.5703096123343003e-1, +3.4554132496398915e-1, + +3.3399965144200949e-1, +3.2240767880107002e-1, +3.1076715274961147e-1, +2.9907982630804048e-1, + +2.8734745954472957e-1, +2.7557181931095825e-1, +2.6375467897483151e-1, +2.5189781815421691e-1, + +2.4000302244874150e-1, +2.2807208317088579e-1, +2.1610679707621960e-1, +2.0410896609281701e-1, + +1.9208039704989238e-1, +1.8002290140569951e-1, +1.6793829497473123e-1, +1.5582839765426532e-1, + +1.4369503315029458e-1, +1.3154002870288328e-1, +1.1936521481099135e-1, +1.0717242495680887e-1, + +9.4963495329639061e-2, +8.2740264549375803e-2, +7.0504573389614009e-2, +5.8258264500435732e-2, + +4.6003182130914644e-2, +3.3741171851377642e-2, +2.1474080275469605e-2, +9.2037547820599599e-3, + -3.0679567629660156e-3, -1.5339206284988098e-2, -2.7608145778965698e-2, -3.9872927587739727e-2, + -5.2131704680283192e-2, -6.4382630929857285e-2, -7.6623861392031506e-2, -8.8853552582524559e-2, + -1.0106986275482775e-1, -1.1327095217756424e-1, -1.2545498341154607e-1, -1.3762012158648607e-1, + -1.4976453467732151e-1, -1.6188639378011177e-1, -1.7398387338746371e-1, -1.8605515166344649e-1, + -1.9809841071795362e-1, -2.1011183688046961e-1, -2.2209362097320348e-1, -2.3404195858354332e-1, + -2.4595505033579448e-1, -2.5783110216215882e-1, -2.6966832557291509e-1, -2.8146493792575794e-1, + -2.9321916269425857e-1, -3.0492922973540226e-1, -3.1659337555616573e-1, -3.2820984357909255e-1, + -3.3977688440682685e-1, -3.5129275608556704e-1, -3.6275572436739711e-1, -3.7416406297145788e-1, + -3.8551605384391890e-1, -3.9680998741671031e-1, -4.0804416286497863e-1, -4.1921688836322407e-1, + -4.3032648134008272e-1, -4.4137126873171673e-1, -4.5234958723377089e-1, -4.6325978355186015e-1, + -4.7410021465054991e-1, -4.8486924800079101e-1, -4.9556526182577237e-1, -5.0618664534515512e-1, + -5.1673179901764965e-1, -5.2719913478190106e-1, -5.3758707629564562e-1, -5.4789405917310019e-1, + -5.5811853122055610e-1, -5.6825895267013149e-1, -5.7831379641165548e-1, -5.8828154822264522e-1, + -5.9816070699634216e-1, -6.0794978496777352e-1, -6.1764730793780376e-1, -6.2725181549514386e-1, + -6.3676186123628431e-1, -6.4617601298331639e-1, -6.5549285299961546e-1, -6.6471097820334490e-1, + -6.7382900037875604e-1, -6.8284554638524797e-1, -6.9175925836415764e-1, -7.0056879394324822e-1, + -7.0927282643886547e-1, -7.1787004505573160e-1, -7.2635915508434579e-1, -7.3473887809596350e-1, + -7.4300795213512172e-1, -7.5116513190968648e-1, -7.5920918897838807e-1, -7.6713891193582029e-1, + -7.7495310659487382e-1, -7.8265059616657562e-1, -7.9023022143730992e-1, -7.9769084094339093e-1, + -8.0503133114296344e-1, -8.1225058658520377e-1, -8.1934752007679701e-1, -8.2632106284566353e-1, + -8.3317016470191319e-1, -8.3989379419599952e-1, -8.4649093877405202e-1, -8.5296060493036363e-1, + -8.5930181835700836e-1, -8.6551362409056898e-1, -8.7159508665595087e-1, -8.7754529020726113e-1, + -8.8336333866573169e-1, -8.8904835585466457e-1, -8.9459948563138270e-1, -9.0001589201616017e-1, + -9.0529675931811870e-1, -9.1044129225806714e-1, -9.1544871608826772e-1, -9.2031827670911048e-1, + -9.2504924078267747e-1, -9.2964089584318121e-1, -9.3409255040425876e-1, -9.3840353406310817e-1, + -9.4257319760144687e-1, -9.4660091308328353e-1, -9.5048607394948170e-1, -9.5422809510910556e-1, + -9.5782641302753291e-1, -9.6128048581132064e-1, -9.6458979328981265e-1, -9.6775383709347540e-1, + -9.7077214072895024e-1, -9.7364424965081187e-1, -9.7636973133002114e-1, -9.7894817531906220e-1, + -9.8137919331375456e-1, -9.8366241921173025e-1, -9.8579750916756737e-1, -9.8778414164457218e-1, + -9.8962201746320078e-1, -9.9131085984611544e-1, -9.9285041445986510e-1, -9.9424044945318790e-1, + -9.9548075549192694e-1, -9.9657114579055484e-1, -9.9751145614030345e-1, -9.9830154493389289e-1, + -9.9894129318685687e-1, -9.9943060455546173e-1, -9.9976940535121528e-1, -9.9995764455196390e-1 + } +}; + +static const int ShuffleTables[9][256] = +{ + { + 0x00 + }, { + 0x00, 0x01 + }, { + 0x00, 0x02, 0x03, 0x01 + }, { + 0x00, 0x04, 0x06, 0x02, 0x03, 0x07, 0x05, 0x01 + }, { + 0x00, 0x08, 0x0C, 0x04, 0x06, 0x0E, 0x0A, 0x02, 0x03, 0x0B, 0x0F, 0x07, 0x05, 0x0D, 0x09, 0x01 + }, { + 0x00, 0x10, 0x18, 0x08, 0x0C, 0x1C, 0x14, 0x04, 0x06, 0x16, 0x1E, 0x0E, 0x0A, 0x1A, 0x12, 0x02, + 0x03, 0x13, 0x1B, 0x0B, 0x0F, 0x1F, 0x17, 0x07, 0x05, 0x15, 0x1D, 0x0D, 0x09, 0x19, 0x11, 0x01 + }, { + 0x00, 0x20, 0x30, 0x10, 0x18, 0x38, 0x28, 0x08, 0x0C, 0x2C, 0x3C, 0x1C, 0x14, 0x34, 0x24, 0x04, + 0x06, 0x26, 0x36, 0x16, 0x1E, 0x3E, 0x2E, 0x0E, 0x0A, 0x2A, 0x3A, 0x1A, 0x12, 0x32, 0x22, 0x02, + 0x03, 0x23, 0x33, 0x13, 0x1B, 0x3B, 0x2B, 0x0B, 0x0F, 0x2F, 0x3F, 0x1F, 0x17, 0x37, 0x27, 0x07, + 0x05, 0x25, 0x35, 0x15, 0x1D, 0x3D, 0x2D, 0x0D, 0x09, 0x29, 0x39, 0x19, 0x11, 0x31, 0x21, 0x01 + }, { + 0x00, 0x40, 0x60, 0x20, 0x30, 0x70, 0x50, 0x10, 0x18, 0x58, 0x78, 0x38, 0x28, 0x68, 0x48, 0x08, + 0x0C, 0x4C, 0x6C, 0x2C, 0x3C, 0x7C, 0x5C, 0x1C, 0x14, 0x54, 0x74, 0x34, 0x24, 0x64, 0x44, 0x04, + 0x06, 0x46, 0x66, 0x26, 0x36, 0x76, 0x56, 0x16, 0x1E, 0x5E, 0x7E, 0x3E, 0x2E, 0x6E, 0x4E, 0x0E, + 0x0A, 0x4A, 0x6A, 0x2A, 0x3A, 0x7A, 0x5A, 0x1A, 0x12, 0x52, 0x72, 0x32, 0x22, 0x62, 0x42, 0x02, + 0x03, 0x43, 0x63, 0x23, 0x33, 0x73, 0x53, 0x13, 0x1B, 0x5B, 0x7B, 0x3B, 0x2B, 0x6B, 0x4B, 0x0B, + 0x0F, 0x4F, 0x6F, 0x2F, 0x3F, 0x7F, 0x5F, 0x1F, 0x17, 0x57, 0x77, 0x37, 0x27, 0x67, 0x47, 0x07, + 0x05, 0x45, 0x65, 0x25, 0x35, 0x75, 0x55, 0x15, 0x1D, 0x5D, 0x7D, 0x3D, 0x2D, 0x6D, 0x4D, 0x0D, + 0x09, 0x49, 0x69, 0x29, 0x39, 0x79, 0x59, 0x19, 0x11, 0x51, 0x71, 0x31, 0x21, 0x61, 0x41, 0x01 + }, { + 0x00, 0x80, 0xC0, 0x40, 0x60, 0xE0, 0xA0, 0x20, 0x30, 0xB0, 0xF0, 0x70, 0x50, 0xD0, 0x90, 0x10, + 0x18, 0x98, 0xD8, 0x58, 0x78, 0xF8, 0xB8, 0x38, 0x28, 0xA8, 0xE8, 0x68, 0x48, 0xC8, 0x88, 0x08, + 0x0C, 0x8C, 0xCC, 0x4C, 0x6C, 0xEC, 0xAC, 0x2C, 0x3C, 0xBC, 0xFC, 0x7C, 0x5C, 0xDC, 0x9C, 0x1C, + 0x14, 0x94, 0xD4, 0x54, 0x74, 0xF4, 0xB4, 0x34, 0x24, 0xA4, 0xE4, 0x64, 0x44, 0xC4, 0x84, 0x04, + 0x06, 0x86, 0xC6, 0x46, 0x66, 0xE6, 0xA6, 0x26, 0x36, 0xB6, 0xF6, 0x76, 0x56, 0xD6, 0x96, 0x16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git a/C/unpack.c b/C/unpack.c new file mode 100644 index 0000000..1dc5313 --- /dev/null +++ b/C/unpack.c @@ -0,0 +1,328 @@ +#include "tables.h" +#include "unpack.h" +#include "bit_allocation.h" +#include +#include "scale_factors.h" +#include "utility.h" +#include "huffCodes.h" + +at9_status UnpackFrame(frame* frame, bit_reader_cxt* br) +{ + const int block_count = frame->config->ChannelConfig.BlockCount; + + for (int i = 0; i < block_count; i++) + { + ERROR_CHECK(UnpackBlock(&frame->Blocks[i], br)); + } + return ERR_SUCCESS; +} + +at9_status UnpackBlock(block* block, bit_reader_cxt* br) +{ + ERROR_CHECK(ReadBlockHeader(block, br)); + + if (block->BlockType == LFE) + { + ERROR_CHECK(UnpackLfeBlock(block, br)); + } + else + { + ERROR_CHECK(UnpackStandardBlock(block, br)); + } + + align_position(br, 8); + return ERR_SUCCESS; +} + +at9_status ReadBlockHeader(block* block, bit_reader_cxt* br) +{ + int firstInSuperframe = block->Frame->FrameIndex == 0; + block->FirstInSuperframe = !read_int(br, 1); + block->ReuseBandParams = read_int(br, 1); + + if (block->FirstInSuperframe && block->ReuseBandParams && block->BlockType != LFE) + { + return ERR_UNPACK_REUSE_BAND_PARAMS_INVALID; + } + + return ERR_SUCCESS; +} + +at9_status UnpackStandardBlock(block* block, bit_reader_cxt* br) +{ + if (!block->ReuseBandParams) + { + ERROR_CHECK(ReadBandParams(block, br)); + } + + ERROR_CHECK(ReadGradientParams(block, br)); + ERROR_CHECK(CreateGradient(block)); + ERROR_CHECK(ReadStereoParams(block, br)); + ERROR_CHECK(ReadExtensionParams(block, br)); + + for (int i = 0; i < block->ChannelCount; i++) + { + channel* channel = &block->Channels[i]; + UpdateCodedUnits(channel); + + ERROR_CHECK(read_scale_factors(channel, br)); + CalculateMask(channel); + CalculatePrecisions(channel); + CalculateSpectrumCodebookIndex(channel); + + ERROR_CHECK(ReadSpectra(channel, br)); + ERROR_CHECK(ReadSpectraFine(channel, br)); + } + + block->QuantizationUnitsPrev = block->BandExtensionEnabled ? block->ExtensionUnit : block->QuantizationUnitCount; + return ERR_SUCCESS; +} + +at9_status ReadBandParams(block* block, bit_reader_cxt* br) +{ + const int minBandCount = MinBandCount[block->config->HighSampleRate]; + const int maxExtensionBand = MaxExtensionBand[block->config->HighSampleRate]; + block->BandCount = read_int(br, 4) + minBandCount; + block->QuantizationUnitCount = BandToQuantUnitCount[block->BandCount]; + + if (block->BandCount < minBandCount || block->BandCount > + MaxBandCount[block->config->SampleRateIndex]) + { + return ERR_SUCCESS; + } + + if (block->BlockType == Stereo) + { + block->StereoBand = read_int(br, 4); + block->StereoBand += minBandCount; + block->StereoQuantizationUnit = BandToQuantUnitCount[block->StereoBand]; + } + else + { + block->StereoBand = block->BandCount; + } + + block->BandExtensionEnabled = read_int(br, 1); + if (block->BandExtensionEnabled) + { + block->ExtensionBand = read_int(br, 4); + block->ExtensionBand += minBandCount; + + if (block->ExtensionBand < block->BandCount || block->ExtensionBand > maxExtensionBand) + { + return ERR_UNPACK_BAND_PARAMS_INVALID; + } + + block->ExtensionUnit = BandToQuantUnitCount[block->ExtensionBand]; + } + else + { + block->ExtensionBand = block->BandCount; + block->ExtensionUnit = block->QuantizationUnitCount; + } + + return ERR_SUCCESS; +} + +at9_status ReadGradientParams(block* block, bit_reader_cxt* br) +{ + block->GradientMode = read_int(br, 2); + if (block->GradientMode > 0) + { + block->GradientEndUnit = 31; + block->GradientEndValue = 31; + block->GradientStartUnit = read_int(br, 5); + block->GradientStartValue = read_int(br, 5); + } + else + { + block->GradientStartUnit = read_int(br, 6); + block->GradientEndUnit = read_int(br, 6) + 1; + block->GradientStartValue = read_int(br, 5); + block->GradientEndValue = read_int(br, 5); + } + block->GradientBoundary = read_int(br, 4); + + if (block->GradientBoundary > block->QuantizationUnitCount) + { + return ERR_UNPACK_GRAD_BOUNDARY_INVALID; + } + if (block->GradientStartUnit < 1 || block->GradientStartUnit >= 48) + { + return ERR_UNPACK_GRAD_START_UNIT_OOB; + } + if (block->GradientEndUnit < 1 || block->GradientEndUnit >= 48) + { + return ERR_UNPACK_GRAD_END_UNIT_OOB; + } + if (block->GradientStartUnit > block->GradientEndUnit) + { + return ERR_UNPACK_GRAD_END_UNIT_INVALID; + } + if (block->GradientStartValue < 0 || block->GradientStartValue >= 32) + { + return ERR_UNPACK_GRAD_START_VALUE_OOB; + } + if (block->GradientEndValue < 0 || block->GradientEndValue >= 32) + { + return ERR_UNPACK_GRAD_END_VALUE_OOB; + } + + return ERR_SUCCESS; +} + +at9_status ReadStereoParams(block* block, bit_reader_cxt* br) +{ + if (block->BlockType != Stereo) return ERR_SUCCESS; + + block->PrimaryChannelIndex = read_int(br, 1); + block->HasJointStereoSigns = read_int(br, 1); + if (block->HasJointStereoSigns) + { + for (int i = block->StereoQuantizationUnit; i < block->QuantizationUnitCount; i++) + { + block->JointStereoSigns[i] = read_int(br, 1); + } + } + else + { + memset(block->JointStereoSigns, 0, sizeof(block->JointStereoSigns)); + } + + return ERR_SUCCESS; +} + +at9_status ReadExtensionParams(block* block, bit_reader_cxt* br) +{ + if (block->BandExtensionEnabled) + { + return ERR_NOT_IMPLEMENTED; + } + block->HasExtensionData = read_int(br, 1); + + if (!block->HasExtensionData) return ERR_SUCCESS; + + return ERR_NOT_IMPLEMENTED; +} + +void UpdateCodedUnits(channel* channel) +{ + if (channel->Block->PrimaryChannelIndex == channel->ChannelIndex) + { + channel->CodedQuantUnits = channel->Block->QuantizationUnitCount; + } + else + { + channel->CodedQuantUnits = channel->Block->StereoQuantizationUnit; + } +} + +void CalculateSpectrumCodebookIndex(channel* channel) +{ + memset(channel->CodebookSet, 0, sizeof(channel->CodebookSet)); + const int quantUnits = channel->CodedQuantUnits; + int* sf = channel->ScaleFactors; + + if (quantUnits <= 1) return; + if (channel->config->HighSampleRate) return; + + // Temporarily setting this value allows for simpler code by + // making the last value a non-special case. + const int originalScaleTmp = sf[quantUnits]; + sf[quantUnits] = sf[quantUnits - 1]; + + int avg = 0; + if (quantUnits > 12) + { + for (int i = 0; i < 12; i++) + { + avg += sf[i]; + } + avg = (avg + 6) / 12; + } + + for (int i = 8; i < quantUnits; i++) + { + const int prevSf = sf[i - 1]; + const int nextSf = sf[i + 1]; + const int minSf = min(prevSf, nextSf); + if (sf[i] - minSf >= 3 || sf[i] - prevSf + sf[i] - nextSf >= 3) + { + channel->CodebookSet[i] = 1; + } + } + + for (int i = 12; i < quantUnits; i++) + { + if (channel->CodebookSet[i] == 0) + { + const int minSf = min(sf[i - 1], sf[i + 1]); + if (sf[i] - minSf >= 2 && sf[i] >= avg - (QuantUnitToCoeffCount[i] == 16 ? 1 : 0)) + { + channel->CodebookSet[i] = 1; + } + } + } + + sf[quantUnits] = originalScaleTmp; +} + +at9_status ReadSpectra(channel* channel, bit_reader_cxt* br) +{ + int values[16]; + memset(channel->QuantizedSpectra, 0, sizeof(channel->QuantizedSpectra)); + const int maxHuffPrecision = MaxHuffPrecision[channel->config->HighSampleRate]; + + for (int i = 0; i < channel->CodedQuantUnits; i++) + { + const int subbandCount = QuantUnitToCoeffCount[i]; + const int precision = channel->Precisions[i] + 1; + if (precision <= maxHuffPrecision) + { + const HuffmanCodebook* huff = &HuffmanSpectrum[channel->CodebookSet[i]][precision][QuantUnitToCodebookIndex[i]]; + const int groupCount = subbandCount >> huff->ValueCountPower; + for (int j = 0; j < groupCount; j++) + { + values[j] = ReadHuffmanValue(huff, br, FALSE); + } + + DecodeHuffmanValues(channel->QuantizedSpectra, QuantUnitToCoeffIndex[i], subbandCount, huff, values); + } + else + { + const int subbandIndex = QuantUnitToCoeffIndex[i]; + for (int j = subbandIndex; j < QuantUnitToCoeffIndex[i + 1]; j++) + { + channel->QuantizedSpectra[j] = read_signed_int(br, precision); + } + } + } + + return ERR_SUCCESS; +} + +at9_status ReadSpectraFine(channel* channel, bit_reader_cxt* br) +{ + memset(channel->QuantizedSpectraFine, 0, sizeof(channel->QuantizedSpectraFine)); + + for (int i = 0; i < channel->CodedQuantUnits; i++) + { + if (channel->PrecisionsFine[i] > 0) + { + const int overflowBits = channel->PrecisionsFine[i] + 1; + const int startSubband = QuantUnitToCoeffIndex[i]; + const int endSubband = QuantUnitToCoeffIndex[i + 1]; + + for (int j = startSubband; j < endSubband; j++) + { + channel->QuantizedSpectraFine[j] = read_signed_int(br, overflowBits); + } + } + } + return ERR_SUCCESS; +} + +at9_status UnpackLfeBlock(block* block, bit_reader_cxt* br) +{ + return ERR_NOT_IMPLEMENTED; +} diff --git a/C/unpack.h b/C/unpack.h new file mode 100644 index 0000000..50f8bfd --- /dev/null +++ b/C/unpack.h @@ -0,0 +1,20 @@ +#pragma once +#include "bit_reader.h" +#include "error_codes.h" +#include "structures.h" + +at9_status UnpackFrame(frame* frame, bit_reader_cxt* br); +at9_status UnpackBlock(block* block, bit_reader_cxt* br); +at9_status ReadBlockHeader(block* block, bit_reader_cxt* br); +at9_status UnpackStandardBlock(block* block, bit_reader_cxt* br); +at9_status ReadBandParams(block* block, bit_reader_cxt* br); +at9_status ReadGradientParams(block* block, bit_reader_cxt* br); +at9_status ReadStereoParams(block* block, bit_reader_cxt* br); +at9_status ReadExtensionParams(block* block, bit_reader_cxt* br); +void UpdateCodedUnits(channel* channel); +void CalculateSpectrumCodebookIndex(channel* channel); + +at9_status ReadSpectra(channel* channel, bit_reader_cxt* br); +at9_status ReadSpectraFine(channel* channel, bit_reader_cxt* br); + +at9_status UnpackLfeBlock(block* block, bit_reader_cxt* br); diff --git a/C/utility.c b/C/utility.c new file mode 100644 index 0000000..3d3f3ae --- /dev/null +++ b/C/utility.c @@ -0,0 +1,20 @@ +#include "utility.h" +#include + +int max(int a, int b) { return a > b ? a : b; } +int min(int a, int b) { return a > b ? b : a; } + +int SignExtend32(int value, int bits) +{ + const int shift = 8 * sizeof(int) - bits; + return (value << shift) >> shift; +} + +short Clamp16(int value) +{ + if (value > SHRT_MAX) + return SHRT_MAX; + if (value < SHRT_MIN) + return SHRT_MIN; + return (short)value; +} \ No newline at end of file diff --git a/C/utility.h b/C/utility.h new file mode 100644 index 0000000..37e18e8 --- /dev/null +++ b/C/utility.h @@ -0,0 +1,9 @@ +#pragma once + +#define FALSE 0 +#define TRUE 1 + +int max(int a, int b); +int min(int a, int b); +int SignExtend32(int value, int bits); +short Clamp16(int value);