diff --git a/Src/vlb/DataIO.h b/Src/vlb/DataIO.h deleted file mode 100644 index 098ca9a2c..000000000 --- a/Src/vlb/DataIO.h +++ /dev/null @@ -1,40 +0,0 @@ -/* $Header: /cvs/root/winamp/vlb/DataIO.h,v 1.1 2009/04/28 20:21:06 audiodsp Exp $ */ - -/***************************************************************************\ - * - * Copyright 2000-2002 Dolby Laboratories, Inc. All Rights - * Reserved. Do not copy. Do not distribute. - * Confidential information. - * - * filename: DataIO.h - * project : MPEG-2 AAC Decoder - * contents/description: Data I/O include header - * - * $Header: /cvs/root/winamp/vlb/DataIO.h,v 1.1 2009/04/28 20:21:06 audiodsp Exp $ - * -\***************************************************************************/ - -#ifndef DATAIOCONTROL -#define DATAIOCONTROL - -#define DATA_IO_READ 0 -#define DATA_IO_WRITE 1 - -#define DATA_IO_ERROR_NONE 0 -#define DATA_IO_ERROR_INVALID -1 - - -class DataIOControl{ - public: - virtual int IO( void*pvBuffer, - int iSize, - int iCount)=0; - virtual int Seek(long lOffset, int iOrigin)=0; -// virtual int Close()=0; - virtual int EndOf()=0; - virtual int DICGetLastError()=0; - virtual int DICGetDirection()=0; -}; - -#endif - diff --git a/Src/vlb/DolbyPayload.cpp b/Src/vlb/DolbyPayload.cpp deleted file mode 100644 index 60faed90b..000000000 --- a/Src/vlb/DolbyPayload.cpp +++ /dev/null @@ -1,2271 +0,0 @@ -/* $Header: /cvs/root/winamp/vlb/DolbyPayload.cpp,v 1.1 2009/04/28 20:21:07 audiodsp Exp $ */ - -/***************************************************************************\ - * - * Copyright 2000-2002 Dolby Laboratories, Inc. All Rights - * Reserved. Do not copy. Do not distribute. - * Confidential information. - * - * filename: DolbyPayload.cpp - * project : MPEG-2 AAC Decoder - * contents/description: SE bitstream parsing routines - * -\***************************************************************************/ - -#include -#include "DolbyPayload.h" - -/* Table of warnings returned by SE bitstream reading procedure, spectralExtInfo(). - - 142 Invalid Dolby SE version number. This decoder only decodes Dolby SE v1.0. - 143 Invalid Dolby SE version number. This decoder only decodes Dolby SE v1.0- v1.3. - 144 Invalid Dolby SE number of bands to ignore. - 146 Invalid # of Chans for Dolby SEv1.0 (only mono or stereo allowed. Check to see if adts_header.channel_config is valid. - 147 Invalid Dolby SE spectral flatness measure. - 148 Invalid Dolby SE noise shaping index. - 149 Dolby SEv1.0: number of bytes read from bitstream != number of bytes in extension payload! - 242 Attempt to read past end of fill element containing Dolby SE payload - - */ - -/* fDamp */ -float baseband_dynamic_noise_shaping_index_lookup_table [] = { - 1.00f, - 0.98f, - 0.96f, - 0.90f, - 0.84f, - 0.60f, - 0.30f, - 0.00f -}; - -/* DNS (zlevel) values */ -float q_2_unq_power_ratio_lookup_table [] = { - 0.000000f, - 0.030000f, - 0.035755f, - 0.042613f, - 0.050787f, - 0.060529f, - 0.072140f, - 0.085977f, - 0.102470f, - 0.122125f, - 0.145551f, - 0.173471f, - 0.206746f, - 0.246404f, - 0.293669f, - 0.350000f -}; - - -/* Huffman codebooks for LONG,START, and STOP blocks */ - -Huffman se_hcb_long_lores_sorted_by_length[] = { - /* value, length, binary codeword */ - { 15, 2, 2}, - { 14, 2, 3}, - { 13, 3, 2}, - { 16, 3, 3}, - { 17, 4, 3}, - { 12, 5, 4}, - { 18, 5, 5}, - { 10, 6, 5}, - { 11, 6, 6}, - { 19, 6, 7}, - { 20, 7, 5}, - { 21, 7, 6}, - { 7, 7, 7}, - { 8, 7, 8}, - { 9, 7, 9}, - { 22, 8, 4}, - { 23, 8, 5}, - { 24, 8, 6}, - { 5, 8, 7}, - { 6, 8, 8}, - { 0, 8, 9}, - { 3, 9, 1}, - { 4, 9, 2}, - { 25, 9, 3}, - { 26, 9, 4}, - { 27, 9, 5}, - { 2, 9, 6}, - { 1, 9, 7}, - { 28, 10, 1}, - { 29, 11, 0}, - { 30, 11, 1} -}; - -/* this table will be used to determine codewords and codeword lengths once - the index of the codeword is known. N.B. that two tables are really not needed; - there are more efficient ways of looking up the codeword and its length - simultaneously, without two table lookups. However, we will adopt the Huffman decoding - style given in this codec which in general uses two tables to determine codeword and length. */ - - -Huffman_lookup se_hcb_long_lores_sorted_by_index[] = { - /* index, length, codeword */ - { 0, 8, -15}, - { 1, 9, -14}, - { 2, 9, -13}, - { 3, 9, -12}, - { 4, 9, -11}, - { 5, 8, -10}, - { 6, 8, -9}, - { 7, 7, -8}, - { 8, 7, -7}, - { 9, 7, -6}, - { 10, 6, -5}, - { 11, 6, -4}, - { 12, 5, -3}, - { 13, 3, -2}, - { 14, 2, -1}, - { 15, 2, 0}, - { 16, 3, 1}, - { 17, 4, 2}, - { 18, 5, 3}, - { 19, 6, 4}, - { 20, 7, 5}, - { 21, 7, 6}, - { 22, 8, 7}, - { 23, 8, 8}, - { 24, 8, 9}, - { 25, 9, 10}, - { 26, 9, 11}, - { 27, 9, 12}, - { 28, 10, 13}, - { 29, 11, 14}, - { 30, 11, 15} -}; - - - -Huffman se_hcb_long_hires_sorted_by_length[] = { - /* index, length, codeword*/ - { 33, 3, 3}, - { 34, 3, 7}, - { 35, 3, 4}, - { 36, 3, 6}, - { 37, 3, 1}, - { 32, 4, 4}, - { 38, 4, 0}, - { 30, 5, 11}, - { 31, 5, 23}, - { 39, 5, 21}, - { 40, 5, 3}, - { 29, 6, 5}, - { 41, 6, 44}, - { 42, 6, 21}, - { 27, 7, 8}, - { 28, 7, 82}, - { 43, 7, 91}, - { 24, 8, 81}, - { 25, 8, 181}, - { 26, 8, 163}, - { 44, 8, 160}, - { 45, 8, 180}, - { 46, 8, 19}, - { 47, 8, 83}, - { 20, 9, 164}, - { 21, 9, 36}, - { 22, 9, 333}, - { 23, 9, 324}, - { 48, 9, 325}, - { 49, 9, 160}, - { 50, 9, 161}, - { 17, 10, 75}, - { 18, 10, 670}, - { 19, 10, 646}, - { 51, 10, 664}, - { 52, 10, 665}, - { 53, 10, 668}, - { 13, 11, 660}, - { 14, 11, 1342}, - { 15, 11, 1291}, - { 16, 11, 1290}, - { 54, 11, 1289}, - { 55, 11, 1288}, - { 56, 11, 1338}, - { 57, 11, 661}, - { 59, 11, 663}, - { 9, 12, 299}, - { 10, 12, 297}, - { 11, 12, 2591}, - { 12, 12, 2589}, - { 58, 12, 2588}, - { 60, 12, 2686}, - { 61, 12, 2590}, - { 62, 12, 2687}, - { 63, 12, 2679}, - { 64, 12, 1324}, - { 7, 13, 592}, - { 8, 13, 5356}, - { 65, 13, 596}, - { 66, 13, 593}, - { 4, 14, 5300}, - { 5, 14, 1194}, - { 6, 14, 10714}, - { 67, 14, 10715}, - { 68, 14, 5301}, - { 69, 14, 5302}, - { 0, 15, 10606}, - { 1, 15, 2390}, - { 3, 15, 2391}, - { 2, 16, 21214}, - { 70, 16, 21215} -}; - -/* this table will be used to determine codewords and codeword lengths once - the index of the codeword is known. N.B. that two tables are really not needed; - there are more efficient ways of looking up the codeword and its length - simultaneously, without two table lookups. However, we will adopt the Huffman decoding - style given in this codec which in general uses two tables to determine codeword and length. */ - - -Huffman_lookup se_hcb_long_hires_sorted_by_index[] = { - /* index, length, value*/ - { 0, 15, -36}, - { 1, 15, -35}, - { 2, 16, -34}, - { 3, 15, -33}, - { 4, 14, -32}, - { 5, 14, -31}, - { 6, 14, -30}, - { 7, 13, -29}, - { 8, 13, -28}, - { 9, 12, -27}, - { 10, 12, -26}, - { 11, 12, -25}, - { 12, 12, -24}, - { 13, 11, -23}, - { 14, 11, -22}, - { 15, 11, -21}, - { 16, 11, -20}, - { 17, 10, -19}, - { 18, 10, -18}, - { 19, 10, -17}, - { 20, 9, -16}, - { 21, 9, -15}, - { 22, 9, -14}, - { 23, 9, -13}, - { 24, 8, -12}, - { 25, 8, -11}, - { 26, 8, -10}, - { 27, 7, -9}, - { 28, 7, -8}, - { 29, 6, -7}, - { 30, 5, -6}, - { 31, 5, -5}, - { 32, 4, -4}, - { 33, 3, -3}, - { 34, 3, -2}, - { 35, 3, -1}, - { 36, 3, 0}, - { 37, 3, 1}, - { 38, 4, 2}, - { 39, 5, 3}, - { 40, 5, 4}, - { 41, 6, 5}, - { 42, 6, 6}, - { 43, 7, 7}, - { 44, 8, 8}, - { 45, 8, 9}, - { 46, 8, 10}, - { 47, 8, 11}, - { 48, 9, 12}, - { 49, 9, 13}, - { 50, 9, 14}, - { 51, 10, 15}, - { 52, 10, 16}, - { 53, 10, 17}, - { 54, 11, 18}, - { 55, 11, 19}, - { 56, 11, 20}, - { 57, 11, 21}, - { 58, 12, 22}, - { 59, 11, 23}, - { 60, 12, 24}, - { 61, 12, 25}, - { 62, 12, 26}, - { 63, 12, 27}, - { 64, 12, 28}, - { 65, 13, 29}, - { 66, 13, 30}, - { 67, 14, 31}, - { 68, 14, 32}, - { 69, 14, 33}, - { 70, 16, 34} -}; - - -/* Huffman codebooks for SHORT blocks */ - -/* Shortblock Tables derived from shortblock statistics only */ - -Huffman se_hcb_short_hires_sorted_by_length[] = { - /* index, length, codeword*/ - { 31, 3, 3}, - { 32, 3, 1}, - { 33, 3, 2}, - { 27, 4, 15}, - { 28, 4, 13}, - { 29, 4, 11}, - { 30, 4, 9}, - { 34, 4, 10}, - { 35, 4, 0}, - { 24, 5, 2}, - { 25, 5, 24}, - { 26, 5, 16}, - { 36, 5, 28}, - { 22, 6, 59}, - { 23, 6, 50}, - { 37, 6, 34}, - { 38, 6, 6}, - { 19, 7, 14}, - { 20, 7, 102}, - { 21, 7, 70}, - { 39, 7, 116}, - { 18, 8, 207}, - { 40, 8, 142}, - { 41, 8, 31}, - { 15, 9, 60}, - { 16, 9, 412}, - { 17, 9, 287}, - { 42, 9, 413}, - { 12, 10, 122}, - { 13, 10, 939}, - { 14, 10, 938}, - { 43, 10, 936}, - { 44, 10, 942}, - { 45, 10, 941}, - { 11, 11, 246}, - { 46, 11, 1886}, - { 52, 11, 1881}, - { 53, 11, 1880}, - { 7, 12, 494}, - { 8, 12, 2292}, - { 9, 12, 2290}, - { 10, 12, 2289}, - { 47, 12, 2291}, - { 48, 12, 2295}, - { 49, 12, 3748}, - { 50, 12, 2294}, - { 51, 12, 2288}, - { 54, 12, 3751}, - { 55, 12, 3775}, - { 58, 12, 3749}, - { 0, 13, 7501}, - { 5, 13, 7500}, - { 57, 13, 4586}, - { 60, 13, 991}, - { 2, 14, 1981}, - { 3, 14, 1980}, - { 4, 14, 15096}, - { 6, 14, 9175}, - { 59, 14, 9174}, - { 61, 14, 15097}, - { 1, 15, 30197}, - { 56, 15, 30196}, - { 62, 15, 30199}, - { 63, 15, 30198} -}; - -/* this table will be used to determine codewords and codeword lengths once - the index of the codeword is known. N.B. that two tables are really not needed; - there are more efficient ways of looking up the codeword and its length - simultaneously, without two table lookups. However, we will adopt the Huffman decoding - style given in this codec which in general uses two tables to determine codeword and length. */ - -Huffman_lookup se_hcb_short_hires_sorted_by_index[] = { - /* index, length, value*/ - { 0, 13, -34}, - { 1, 15, -33}, - { 2, 14, -32}, - { 3, 14, -31}, - { 4, 14, -30}, - { 5, 13, -29}, - { 6, 14, -28}, - { 7, 12, -27}, - { 8, 12, -26}, - { 9, 12, -25}, - { 10, 12, -24}, - { 11, 11, -23}, - { 12, 10, -22}, - { 13, 10, -21}, - { 14, 10, -20}, - { 15, 9, -19}, - { 16, 9, -18}, - { 17, 9, -17}, - { 18, 8, -16}, - { 19, 7, -15}, - { 20, 7, -14}, - { 21, 7, -13}, - { 22, 6, -12}, - { 23, 6, -11}, - { 24, 5, -10}, - { 25, 5, -9}, - { 26, 5, -8}, - { 27, 4, -7}, - { 28, 4, -6}, - { 29, 4, -5}, - { 30, 4, -4}, - { 31, 3, -3}, - { 32, 3, -2}, - { 33, 3, -1}, - { 34, 4, 0}, - { 35, 4, 1}, - { 36, 5, 2}, - { 37, 6, 3}, - { 38, 6, 4}, - { 39, 7, 5}, - { 40, 8, 6}, - { 41, 8, 7}, - { 42, 9, 8}, - { 43, 10, 9}, - { 44, 10, 10}, - { 45, 10, 11}, - { 46, 11, 12}, - { 47, 12, 13}, - { 48, 12, 14}, - { 49, 12, 15}, - { 50, 12, 16}, - { 51, 12, 17}, - { 52, 11, 18}, - { 53, 11, 19}, - { 54, 12, 20}, - { 55, 12, 21}, - { 56, 15, 22}, - { 57, 13, 23}, - { 58, 12, 24}, - { 59, 14, 25}, - { 60, 13, 26}, - { 61, 14, 27}, - { 62, 15, 28}, - { 63, 15, 29} -}; - -Huffman se_hcb_short_lores_sorted_by_length[] = { - /* index, length, codeword*/ - { 14, 2, 1}, - { 11, 3, 1}, - { 12, 3, 7}, - { 13, 3, 4}, - { 15, 3, 5}, - { 10, 4, 0}, - { 16, 4, 12}, - { 9, 5, 27}, - { 17, 5, 2}, - { 8, 6, 53}, - { 18, 6, 7}, - { 7, 7, 104}, - { 5, 8, 27}, - { 6, 8, 24}, - { 19, 8, 210}, - { 4, 9, 51}, - { 20, 9, 422}, - { 3, 10, 106}, - { 21, 10, 847}, - { 22, 10, 101}, - { 24, 10, 100}, - { 25, 10, 105}, - { 0, 11, 208}, - { 1, 11, 209}, - { 2, 11, 1693}, - { 23, 11, 1692}, - { 27, 11, 215}, - { 26, 12, 428}, - { 28, 12, 429} -}; - -/* this table will be used to determine codewords and codeword lengths once - the index of the codeword is known. N.B. that two tables are really not needed; - there are more efficient ways of looking up the codeword and its length - simultaneously, without two table lookups. However, we will adopt the Huffman decoding - style given in this codec which in general uses two tables to determine codeword and length. */ - -Huffman_lookup se_hcb_short_lores_sorted_by_index[] = { - /* index, length, value*/ - { 0, 11, -15}, - { 1, 11, -14}, - { 2, 11, -13}, - { 3, 10, -12}, - { 4, 9, -11}, - { 5, 8, -10}, - { 6, 8, -9}, - { 7, 7, -8}, - { 8, 6, -7}, - { 9, 5, -6}, - { 10, 4, -5}, - { 11, 3, -4}, - { 12, 3, -3}, - { 13, 3, -2}, - { 14, 2, -1}, - { 15, 3, 0}, - { 16, 4, 1}, - { 17, 5, 2}, - { 18, 6, 3}, - { 19, 8, 4}, - { 20, 9, 5}, - { 21, 10, 6}, - { 22, 10, 7}, - { 23, 11, 8}, - { 24, 10, 9}, - { 25, 10, 10}, - { 26, 12, 11}, - { 27, 11, 12}, - { 28, 12, 13} -}; - -/* Control table for Huffman Codebooks for all blocktypes and resolutions */ - -SE_power_resolution_table_struct SE_power_resolution_table[NUM_BLOCKTYPES][NUM_BANDRES_OPTIONS] = -{ - /* powerResolution, cwLengthLookupTable, cwValueLookupTable, num_codewords */ - - /* SE_power_resolution_table[0][0,1]. Huffman codebooks for blocktype == 0 (LONG_WINDOW) */ - { - {SE_BANDRES_2_67_DB, se_hcb_long_lores_sorted_by_length, se_hcb_long_lores_sorted_by_index, 31}, - {SE_BANDRES_1_33_DB, se_hcb_long_hires_sorted_by_length, se_hcb_long_hires_sorted_by_index, 71} - }, - - /* SE_power_resolution_table[1][0,1]. Huffman codebooks for blocktype == 1 (START_WINDOW) */ - { - {SE_BANDRES_2_67_DB, se_hcb_long_lores_sorted_by_length, se_hcb_long_lores_sorted_by_index, 31}, - {SE_BANDRES_1_33_DB, se_hcb_long_hires_sorted_by_length, se_hcb_long_hires_sorted_by_index, 71} - }, - - /* SE_power_resolution_table[2][0,1]. Huffman codebooks for blocktype == 2 (SHORT_WINDOW) */ - { - {SE_BANDRES_2_67_DB, se_hcb_short_lores_sorted_by_length, se_hcb_short_lores_sorted_by_index, 29}, - {SE_BANDRES_1_33_DB, se_hcb_short_hires_sorted_by_length, se_hcb_short_hires_sorted_by_index, 64} - }, - - /* SE_power_resolution_table[3][0,1]. Huffman codebooks for blocktype == 3 (STOP_WINDOW) */ - { - {SE_BANDRES_2_67_DB, se_hcb_long_lores_sorted_by_length, se_hcb_long_lores_sorted_by_index, 31}, - {SE_BANDRES_1_33_DB, se_hcb_long_hires_sorted_by_length, se_hcb_long_hires_sorted_by_index, 71} - }, - -}; - - - - -// tables for computeSeBandInfo -// LONG,START,STOP blocks only - -unsigned int SE_bands_bw_44_48_1024[] = { - 1,2,2,2,2,2,2,2,2,2, - 2,2,2,2,2,2,2,2,2,2, - 2,3,3,3,3,3,3,3,3,4, - 4,4,4,4,5,5,5,6,6,6, - 7,7,8,8,8,9,9,10,10,11, - 11,12,13,13,14,14,15,16,17,19, - 20,23,25,28,33,39,46,58,74,100, - 147 -}; - -unsigned int SE_bands_bw_32_1024[] = { - 2,2,2,2,2,2,2,2,3,3, - 3,3,3,3,3,3,3,3,3,3, - 3,3,3,3,4,4,4,4,4,4, - 5,5,5,5,6,6,6,6,7,7, - 8,8,9,9,10,10,11,12,13,13, - 14,15,15,16,17,18,19,20,21,22, - 23,24,26,28,31,34,38,43,50,59, - 71,89 -}; - -unsigned int SE_bands_bw_24_22_1024[] = { - 2,3,3,3,3,3,3,3,3,3, - 3,3,3,3,3,3,4,4,4,4, - 4,4,4,4,4,5,5,5,5,5, - 5,6,6,6,7,7,7,8,8,8, - 9,10,10,11,11,12,13,14,15,16, - 16,17,18,19,20,21,22,23,24,25, - 27,28,30,32,34,37,40,44,49,55, - 64 -}; - -unsigned int SE_bands_bw_16_12_11_1024[] = { - 1,4,4,4,4,4,4,4,5,5, - 5,5,5,5,5,5,5,5,5,5, - 5,6,6,6,6,6,7,7,7,7, - 8,8,8,9,9,9,10,10,11,11, - 12,13,14,14,15,16,17,18,20,21, - 22,23,25,26,28,29,31,32,34,35, - 37,38,40,43,45,49 -}; - -unsigned int SE_bands_bw_8_1024[] = { - 8,8,8,8,8,8,8,8,9,9, - 9,9,9,9,9,9,10,10,10,10, - 10,11,11,11,12,12,12,13,13,14, - 14,15,15,16,17,17,18,19,20,21, - 22,24,25,26,28,30,32,34,36,38, - 41,43,46,50 -}; - -SE_Band_Info_struct SE_Band_Info_1024[] = { - /* sr SE_bw_table max_num_se_bands num_ignored_upper_bands */ - {48000, SE_bands_bw_44_48_1024, 71, 1 }, - {44100, SE_bands_bw_44_48_1024, 71, 1 }, - {32000, SE_bands_bw_32_1024, 72, 0 }, - {24000, SE_bands_bw_24_22_1024, 71, 0 }, - {22050, SE_bands_bw_24_22_1024, 71, 0 }, - {16000, SE_bands_bw_16_12_11_1024, 66, 0 }, - {12000, SE_bands_bw_16_12_11_1024, 66, 0 }, - {11025, SE_bands_bw_16_12_11_1024, 66, 0 }, - {8000, SE_bands_bw_8_1024, 54, 0 }, - {0, 0, 0, 0 } -}; - -unsigned int SE_bands_bw_44_48_2048[] = { - 2,3,3,3,3,3,3,3,3,3, - 3,3,3,3,3,3,4,4,4,4, - 4,4,4,4,4,5,5,5,5,5, - 5,6,6,6,7,7,7,8,8,8, - 9,10,10,11,12,12,13,14,15,16, - 17,18,19,20,20,21,22,24,25,26, - 27,29,30,32,35,37,41,45,50,57, - 65,77,92,115,148,201,293 -}; - -unsigned int SE_bands_bw_32_2048[] = { - 2,4,4,4,4,4,4,4,5,5, - 5,5,5,5,5,5,5,5,5,5, - 5,6,6,6,6,6,7,7,7,7, - 8,8,8,9,9,9,10,10,11,12, - 12,13,14,15,15,16,17,19,20,21, - 22,24,25,26,28,29,31,32,34,35, - 37,39,41,43,46,49,52,56,62,68, - 76,86,99,117,141,177 -}; - -unsigned int SE_bands_bw_24_22_2048[] = { - 4,6,6,6,6,6,6,6,6,6, - 6,6,6,6,6,6,7,7,7,7, - 7,7,8,8,8,8,9,9,9,10, - 10,10,11,11,12,12,13,14,14,15, - 16,17,18,19,20,21,23,24,26,27, - 29,31,33,35,37,38,40,42,44,46, - 49,51,53,56,59,63,68,73,79,87, - 97,109,127 -}; - -unsigned int SE_bands_bw_16_12_11_2048[] = { - 3,8,8,8,8,8,8,8,9,9, - 9,9,9,9,9,9,9,10,10,10, - 10,10,11,11,11,12,12,12,13,13, - 14,14,15,15,16,17,18,19,19,20, - 22,23,24,25,27,29,30,32,34,37, - 39,41,44,47,49,52,55,58,61,64, - 67,70,73,77,80,85,90,97 -}; - -unsigned int SE_bands_bw_8_2048[] = { - 14,16,16,16,16,16,16,16,17,17, - 17,17,17,18,18,18,18,19,19,20, - 20,21,21,22,22,23,24,24,25,26, - 27,28,29,30,32,33,35,36,38,40, - 42,45,47,50,53,56,60,63,67,72, - 76,81,86,91,98 -}; - -SE_Band_Info_struct SE_Band_Info_2048[] = { - /* sr SE_bw_table max_num_se_bands num_ignored_upper_bands */ - {48000, SE_bands_bw_44_48_2048, 77, 1 }, - {44100, SE_bands_bw_44_48_2048, 77, 1 }, - {32000, SE_bands_bw_32_2048, 76, 0 }, - {24000, SE_bands_bw_24_22_2048, 73, 0 }, - {22050, SE_bands_bw_24_22_2048, 73, 0 }, - {16000, SE_bands_bw_16_12_11_2048, 68, 0 }, - {12000, SE_bands_bw_16_12_11_2048, 68, 0 }, - {11025, SE_bands_bw_16_12_11_2048, 68, 0 }, - {8000, SE_bands_bw_8_2048, 55, 0 }, - {0, 0, 0, 0 } -}; - -/* Short block tables for which SE band resolution is 1.0 critical bands */ - -// tables for computeSeBandInfo -// SHORT block only, for blocklength = 2048 samples (normal AAC blocklength: USE_AAC_XFORM is #defined) -// created from compute_se_band_info.m with parameters: N=256; Res = 1.0 - -unsigned int SE_bands_bw_44_48_128[] = { - 1,1,1,1,1,1,1,2,2,3, - 3,4,5,5,6,8,11,18,43 -}; - -unsigned int SE_bands_bw_32_128[] = { - 1,1,1,1,2,2,2,2,3,3, - 4,5,6,7,8,10,12,17,30 -}; - -unsigned int SE_bands_bw_24_22_128[] = { - 2,2,2,2,2,2,3,3,4,4, - 5,6,8,9,11,13,16,23 -}; - -unsigned int SE_bands_bw_16_12_11_128[] = { - 1,2,2,2,2,2,3,3,3,4, - 4,5,6,8,10,11,13,16,20 -}; - -unsigned int SE_bands_bw_8_128[] = { - 1,4,4,4,4,4,5,5,6,6, - 7,9,10,13,15,20 -}; - -SE_Band_Info_struct SE_Band_Info_128[] = { - /* sr SE_bw_table max_num_se_bands num_ignored_upper_bands */ - {48000, SE_bands_bw_44_48_128, 19, 0 }, - {44100, SE_bands_bw_44_48_128, 19, 0 }, - {32000, SE_bands_bw_32_128, 19, 0 }, - {24000, SE_bands_bw_24_22_128, 18, 0 }, - {22050, SE_bands_bw_24_22_128, 18, 0 }, - {16000, SE_bands_bw_16_12_11_128, 19, 0 }, - {12000, SE_bands_bw_16_12_11_128, 19, 0 }, - {11025, SE_bands_bw_16_12_11_128, 19, 0 }, - {8000, SE_bands_bw_8_128, 16, 0 }, - {0, 0, 0, 0 } -}; - - -// tables for computeSeBandInfo -// SHORT block only, for blocklength = 2048 samples (normal AAC blocklength: USE_AAC_XFORM is #defined) -// created from compute_se_band_info.m with parameters: N=512; Res = 1.0 - -unsigned int SE_bands_bw_44_48_256[] = { - 2,2,2,2,2,2,3,3,3,4, - 5,6,8,9,11,12,16,21,36,86 -}; - -unsigned int SE_bands_bw_32_256[] = { - 1,2,2,2,2,2,3,3,3,4, - 4,5,6,8,10,12,14,16,19,24, - 34,59 -}; - -unsigned int SE_bands_bw_24_22_256[] = { - 1,3,3,3,3,3,3,4,4,5, - 6,7,9,11,13,15,18,21,25,32, - 46 -}; - -unsigned int SE_bands_bw_16_12_11_256[] = { - 1,4,4,4,4,4,5,5,6,6, - 7,9,10,13,15,19,23,27,31,38 -}; - -unsigned int SE_bands_bw_8_256[] = { - 7,7,7,7,8,8,9,10,11,13, - 15,17,21,25,31,39 -}; - - -SE_Band_Info_struct SE_Band_Info_256[] = { - /* sr SE_bw_table max_num_se_bands num_ignored_upper_bands */ - {48000, SE_bands_bw_44_48_256, 20, 0 }, - {44100, SE_bands_bw_44_48_256, 20, 0 }, - {32000, SE_bands_bw_32_256, 22, 0 }, - {24000, SE_bands_bw_24_22_256, 21, 0 }, - {22050, SE_bands_bw_24_22_256, 21, 0 }, - {16000, SE_bands_bw_16_12_11_256, 20, 0 }, - {12000, SE_bands_bw_16_12_11_256, 20, 0 }, - {11025, SE_bands_bw_16_12_11_256, 20, 0 }, - {8000, SE_bands_bw_8_256, 16, 0 }, - {0, 0, 0, 0 } -}; - - -float random(long *seed) -{ - *seed = (1664525L * *seed) + 1013904223L; - return((float)(*seed) * (1.0f / 2.14749e+9f)); -} - -void noiseGen(float noise[], int nsamp) -{ - int bin; - float sigma = 0., mean = 0.; - static int count = 0, initialized = 0; - static long curNoiseState = 101L; - static float noiseBuf[NOISE_LENGTH]; - -#ifdef TRI_NOISE - static float noiseBuf2[NOISE_LENGTH]; -#endif - - if(initialized == 0) - { - for (bin = 0; bin < NOISE_LENGTH; bin++) - { - noiseBuf[bin] = (float) random(&curNoiseState); - mean += noiseBuf[bin]; - } - mean /= (float) NOISE_LENGTH; - - for (bin = 0; bin < NOISE_LENGTH; bin++) - { - noiseBuf[bin] -= mean; - sigma += noiseBuf[bin] * noiseBuf[bin]; - } - sigma = (float) sqrt(sigma / (double) NOISE_LENGTH); - - for (bin = 0; bin < NOISE_LENGTH; bin++) - { - noiseBuf[bin] /= sigma; - } - -#ifdef TRI_NOISE - sigma = 0.; - mean = 0.; - - for (bin = 0; bin < NOISE_LENGTH; bin++) - { - noiseBuf2[bin] = (float) random(&curNoiseState); - mean += noiseBuf2[bin]; - } - mean /= (float) NOISE_LENGTH; - - for (bin = 0; bin < NOISE_LENGTH; bin++) - { - noiseBuf2[bin] -= mean; - sigma += noiseBuf2[bin] * noiseBuf2[bin]; - } - sigma = (float) sqrt(sigma / (double) NOISE_LENGTH); - - for (bin = 0; bin < NOISE_LENGTH; bin++) - { - noiseBuf2[bin] /= sigma; - } - - for (bin = 0; bin < NOISE_LENGTH; bin++) - { - noiseBuf[bin] = (noiseBuf[bin] + noiseBuf2[bin]) / 2; - } -#endif - - initialized = 1; - } - - for (bin = 0; bin < nsamp; bin++) - { - count++; - count %= NOISE_LENGTH; - noise[bin] = noiseBuf[count]; - } -} - - -/* This function computes the average energy in each SE band for all bands */ -void computeAvgCopyEnergies(float* pfData, - int iCopyStart, - int iCopyStop, - int num_se_bands, - int* piBands, - int halfWindowLength, - int iWindowSequence, - float* avgCopyEnergies) -{ - - int iCopyPtr; - int iDestPtr; - int iBinCounter,iBandCounter; - -#ifdef DEBUG_PRINT_BUFFER_MODEL - // print out buffer model - static int already_printed_out_buffer_model = 0; -#endif - - /* initialize avgCopyEnergies to zero */ - for (iBandCounter=0;iBandCounter iCopyStop) - { - iCopyPtr = iCopyStart + (iDestPtr-iCopyStart) % ((iWindowSequence == 2) ? 2 : 16); - } -#else - // old buffer model for longs - if (iCopyPtr + piBands[iBandCounter] > iCopyStop) - { - iCopyPtr = iCopyStart; - if ((iDestPtr-iCopyPtr)%2) - { - iCopyPtr++; - } - } -#endif - - // simulate band loop in spectral extend - for(iBinCounter=0;iBinCounter= iCopyStop) - { - iCopyPtr = iCopyStart + (iDestPtr-iCopyStart) % ((iWindowSequence == 2) ? 2 : 16); - } - - } /* iBinCounter */ - - avgCopyEnergies[iBandCounter] /= (float) piBands[iBandCounter]; - - - } /* iBandCounter */ - -#ifdef DEBUG_PRINT_BUFFER_MODEL - if (already_printed_out_buffer_model == 1) - { - already_printed_out_buffer_model = 2; - } -#endif - - -} - - - - - - - -#ifdef DNS -void applyDNS( float *pfSpectralData, - DNS_INFORMATION_STRUCT*psDNSInfoStruct, - int iPrevWnd) -{ - int bin, bnd, grp, sec, copyStop, qCount; - const int *sfBand; -#ifdef SIGNAL_SUB - int m; - int copyStart; - int step; - int bufLen; - int segment; - float ns_atten_hi, ns_atten_lo; -#endif - int zeroup, zerodown; - float normCopy[MAX_NUM_WINDOW_GROUPS][DOLBY_BLOCK_LEN_LONG], noiseEnvelope[MAX_NUM_WINDOW_GROUPS][DOLBY_BLOCK_LEN_LONG]; - float power, ratio, qPower; - float startScale, prevScale, *coef; - float slope, intercept, scale, dither; - int winInGrp, windowBinOffset, windowNumber, numNoiseRecords; - static long curNoiseState = 0; - int attenSlopeThreshold; - int startBin; - int moduloCopyOffset; - - // compute some preliminaries. These values do not change - // for all windows in the current frame. - copyStop = psDNSInfoStruct->iLastBin; - coef = pfSpectralData; - sfBand = psDNSInfoStruct->piBandOffsets; - numNoiseRecords = (psDNSInfoStruct->iWindowSequence == 2 ? 8 : 1); - - // initialize noiseEnvelope, the noise mask for zero-valued mdct - // coefficients belonging to sections with non-zero huffman codebooks. - - for (windowNumber=0;windowNumberiWindowSequence != 2) /* Long, or transition block */ - { - copyStart = SS_COPYSTART; - step = SS_STEP_LONG; - bufLen = SS_BUF_LEN_LONG; - attenSlopeThreshold = 19; /* slope change at bin 120 (long block). This is 2.58kHz for fs = 44.1kHz. */ - startBin = START_BIN_LONG; - moduloCopyOffset = 14; /* offset to assure that any holes in the translation are not coincident with - holes in the target spectra. Only a problem with the first pass of the normCopy - modulo buffer */ - ns_atten_hi = NS_ATTEN1_LONG; - ns_atten_lo = NS_ATTEN2_LONG; - } - else /* Short block */ - { - copyStart = SS_COPYSTART / 8; - step = SS_STEP_SHORT; - bufLen = SS_BUF_LEN_SHORT; - attenSlopeThreshold = 4; /* slope change at bin 16 (short block). This is 2.75kHz for fs = 44.1kHz */ - startBin = START_BIN_SHORT; - moduloCopyOffset = 7; /* see definition of moduloCopyOffset above for long blocks */ - ns_atten_hi = NS_ATTEN1_SHORT; - ns_atten_lo = NS_ATTEN2_SHORT; - } - - for(windowNumber = 0; windowNumber < numNoiseRecords; windowNumber++, windowBinOffset += 256) - { - for (bin = 0; bin < bufLen; bin++) - { - normCopy[windowNumber][bin] = coef[windowBinOffset + copyStart + bin]; - } - - for (segment = 0; segment < bufLen / step; segment++) - { - power = 0.; - qCount = 0; - for (m = 0; m < step; m++) - { - if (normCopy[windowNumber][segment * step + m] != 0.) - { - power += normCopy[windowNumber][segment * step + m] * normCopy[windowNumber][segment * step + m]; - qCount++; - } - } - if (qCount) - { - power /= (float) qCount; - power = 1.0f / (float)(sqrt(power)); - } - for (m = 0; m < step; m++) - { - if (normCopy[windowNumber][segment * step + m] == 0.) - { - normCopy[windowNumber][segment * step + m] = 1.5f * random(&curNoiseState); - } - else - { - normCopy[windowNumber][segment * step + m] *= power; - } - } - } - } // windowNumber - -#else - /* Generate unit-variance random noise vector */ - - windowNumber = 0; - numNoiseRecords = (psDNSInfoStruct->iWindowSequence == 2 ? 8 : 1); - - for(windowNumber=0;windowNumberiGroupCount; grp++) - { - // this look increments the windowBinOffset index to reflect the 0th bin of the current - // window in the group. If there is more than one window in the current frame, then - // we are dealing with 8 short windows, and the data for each of these windows will - // be in the coef[] array spaced out at intervals of 256 samples. The interval will be - // 256 samples whether we're dealing with double or single length transforms. - - for (winInGrp = 0; winInGrp < psDNSInfoStruct->iGroupLength[grp]; winInGrp++, windowNumber++, windowBinOffset += 256) - { - for (sec = 0; sec < psDNSInfoStruct->psSectionInfoStruct->aiSectionCount[grp]; sec++) - { - for (bnd = psDNSInfoStruct->psSectionInfoStruct->aaiSectionStart[grp][sec]; - bnd < psDNSInfoStruct->psSectionInfoStruct->aaiSectionEnd[grp][sec]; bnd++) - { - qPower = 0.; - qCount = 0; - - for (bin = sfBand[bnd]; bin < sfBand[bnd+1]; bin++) - { - if (coef[windowBinOffset+bin] != 0.0f) - { - qPower += coef[windowBinOffset+bin] * coef[windowBinOffset+bin]; - qCount++; - } - } /* bin */ - - if (qCount) - { - ratio = psDNSInfoStruct->aafDNSRatio[grp][bnd] * (float) sqrt(qPower / (double) qCount); - - for (bin = sfBand[bnd]; bin < sfBand[bnd+1]; bin++) - { - if (psDNSInfoStruct->iWindowSequence != 2) /* long/transition block */ - { - if ((coef[windowBinOffset+bin] == 0.) && (bin >= startBin)) - { - slope = (0.6f - 0.3f) / (float) (copyStop - startBin); - intercept = 0.3f- (50.0f * slope); - scale = slope * (float) bin + intercept; -#ifdef SIGNAL_SUB - coef[windowBinOffset+bin] = normCopy[windowNumber][bin % bufLen] * scale * ratio; -#else - coef[windowBinOffset+bin] = normCopy[windowNumber][bin] * scale * ratio; -#endif - } - } - else /* short block */ - { - if ((coef[windowBinOffset+bin] == 0.) && (bin >= startBin)) - { -#ifdef SIGNAL_SUB - coef[windowBinOffset+bin] = normCopy[windowNumber][bin % bufLen] * 0.8f * ratio; -#else - coef[windowBinOffset+bin] = normCopy[windowNumber][bin] * 0.3f * ratio; -#endif - } - } - } /* bin */ - } /* if (qCount) */ - } /* bnd */ - } /* sec */ - } /* WinInGrp */ - } /* grp */ - - - /* Compute dither for non-zero huffman codebooks, starting from DC and progressing upwards */ - windowBinOffset = 0; - windowNumber = 0; - - for (grp = 0; grp < psDNSInfoStruct->iGroupCount; grp++) - { - // this look increments the windowBinOffset index to reflect the 0th bin of the current - // window in the group. If there is more than one window in the current frame, then - // we are dealing with 8 short windows, and the data for each of these windows will - // be in the coef[] array spaced out at intervals of 256 samples. The interval will be - // 256 samples whether we're dealing with double or single length transforms. - - for (winInGrp=0;winInGrpiGroupLength[grp];winInGrp++,windowNumber++,windowBinOffset+=256) - { - // initialize state variables for the filter - startScale = 0.; - prevScale = 0.; - - for (bnd = 0; bnd < psDNSInfoStruct->iMaxSFB; bnd++) - { - for (bin = sfBand[bnd]; bin < sfBand[bnd+1]; bin++) - { - if (coef[windowBinOffset + bin] == 0.0f) - { - noiseEnvelope[windowNumber][bin] = startScale * GLOBAL_ATTEN; - startScale *= ((bin >= sfBand[attenSlopeThreshold]) ? ns_atten_hi : ns_atten_lo); - prevScale = 0.0f; - } - else - { - if (prevScale == 0.0f) /* This starts off the dither envelope */ - { - startScale = (float)(fabs(coef[windowBinOffset+bin])) * NSFILT_COEF; - prevScale = startScale; - } - else /* dither is averaged as low-pass process */ - { - startScale = (float)(fabs(coef[windowBinOffset+bin])) * NSFILT_COEF + prevScale * (1.0f - NSFILT_COEF); - prevScale = startScale; - } - } - } /* bin */ - } /* bnd */ - } /* winInGrp */ - } /* grp */ - - - /* Compute dither for non-zero huffman codebooks, starting from Fs/2 and progressing downwards */ - windowBinOffset = 0; - windowNumber = 0; - - for (grp = 0; grp < psDNSInfoStruct->iGroupCount; grp++) - { - for (winInGrp=0;winInGrpiGroupLength[grp];winInGrp++,windowNumber++,windowBinOffset+=256) - { - startScale = 0.; - prevScale = 0.; - - for (bnd = psDNSInfoStruct->iMaxSFB - 1; bnd >= 0; bnd--) - { - for (bin = sfBand[bnd+1] - 1; bin >= sfBand[bnd]; bin--) - { - if (coef[windowBinOffset+bin] == 0.0f) - { - noiseEnvelope[windowNumber][bin] = DSPmax(noiseEnvelope[windowNumber][bin], (startScale * GLOBAL_ATTEN)); - startScale *= ((bin >= sfBand[attenSlopeThreshold]) ? ns_atten_hi : ns_atten_lo); - startScale *= BACKWARD_MASK_COMP; - prevScale = 0.0f; - } - else - { - if (prevScale == 0.0f) /* This starts off the dither envelope */ - { - startScale = (float)(fabs(coef[windowBinOffset+bin])) * NSFILT_COEF; - prevScale = startScale; - } - else /* dither is averaged as low-pass process */ - { - startScale = (float)(fabs(coef[windowBinOffset+bin])) * NSFILT_COEF + prevScale * (1.0f - NSFILT_COEF); - prevScale = startScale; - } - } - } /* bin */ - } /* bnd */ - } /* winInGrp */ - } /* grp */ - - // merge noise records and coefficient records - windowBinOffset = 0; - for(windowNumber=0;windowNumberiLastBin; bin++) - { -#ifdef SIGNAL_SUB - dither = normCopy[windowNumber][(bin + moduloCopyOffset) % bufLen]; -#else - dither = normCopy[windowNumber][bin]; -#endif - dither *= noiseEnvelope[windowNumber][bin]; - - zeroup = ((noiseEnvelope[windowNumber][bin+1] != 0.0f) ? 1 : 0); - zerodown = ((noiseEnvelope[windowNumber][bin-1] != 0.0f) ? 1 : 0); - if ((coef[windowBinOffset+bin] == 0.0) && (zeroup || zerodown)) - { - coef[windowBinOffset+bin] = dither; - if ((psDNSInfoStruct->iWindowSequence == 3) && (iPrevWnd == 1)) /* done to support legacy bitstreams */ - { - coef[windowBinOffset+bin] *= 0.5f; - } - } - } /* bin */ - } /* windowNumber */ -} - -#endif /* DNS */ - - -unsigned char computeSeBandInfo (unsigned int SRate, /* input: Sample Rate */ - unsigned int first_SE_bin, /* input: bin number of the first bin of the extension range */ - SE_Band_Info_struct* pSE_Band_Info_struct, /* input: SE Band info struct ptr */ - int* SE_bands_bw, /* output: SE bandwidths, in bins (array; memory assumed to be already allocated) */ - int* num_SE_bands) -{ - int i; - unsigned int sum_bandwidths = 0; - int band_index = 0; - int distance_low, distance_high; - unsigned int* puiSE_bands_bw; - int band_containing_first_SE_bin; - - /* find the right entry of SE_Band_Info to use based on the input sample rate */ - - while(pSE_Band_Info_struct->sr != SRate) - { - pSE_Band_Info_struct++; - - if(pSE_Band_Info_struct->sr == 0) - { - /* FAILSAFE...rather than just getting stuck in this while() loop until we receive - * an access violation, assume we've received MAX_INCONSISTENT_BLOCKS number of blocks - * indicating double length x-form, when the bitstream is really still single length. - * - * If we've searched the SE_Band_Info_struct and not found a matching SR, assume the - * useAACTransform bit is incorrectly indicating double length transforms (0). So, - * divide SR by 2 and force the pSE_Band_Info_struct pointer to point to the - * 1024 point version. - */ - SRate >>= 1; - - pSE_Band_Info_struct = SE_Band_Info_1024; - - - //printf("SE does not support the given sample rate.\n"); - //exit(342); - } - } - - /* find the closest entry in SE_bands_bw to first_SE_bin. - count the number of se bands.*/ - puiSE_bands_bw = pSE_Band_Info_struct->SE_bands_bw; - - sum_bandwidths = 0; - band_containing_first_SE_bin = 0; - - while(sum_bandwidths < first_SE_bin) - { - distance_low = first_SE_bin - sum_bandwidths; - sum_bandwidths += *puiSE_bands_bw++; - band_containing_first_SE_bin++; - } - - distance_high = first_SE_bin - sum_bandwidths; - if (distance_low < -distance_high) - { - /* Lower band edge was closer to first_SE_bin */ - band_containing_first_SE_bin--; - puiSE_bands_bw--; - } - - *num_SE_bands = pSE_Band_Info_struct->SE_max_num_se_bands - band_containing_first_SE_bin; - - - /* copy the bandwidth information into the Lines array */ - for(i=0;i<*num_SE_bands; i++) - SE_bands_bw[i] = *puiSE_bands_bw++; - - /* perform SE band shrinkage / expansion to make first_SE_bin be the first bin of the first - extension band */ - - i = *num_SE_bands - 1; - - if (distance_low <= -distance_high) - { - /* round-robin decrease band sizes */ - - while(distance_low > 0) - { - SE_bands_bw[i]--; - i--; - if(i<0) i = *num_SE_bands - 1; - distance_low--; - } - - } else { - - /* round-robin decrease band sizes */ - - while(-distance_high > 0) - { - SE_bands_bw[i]++; - i--; - if(i<0) i = *num_SE_bands - 1; - distance_high++; - } - - } - - assert(pSE_Band_Info_struct->SE_num_ignored_upper_bands >= 0); - assert(pSE_Band_Info_struct->SE_num_ignored_upper_bands <= ((1<SE_num_ignored_upper_bands < 0 || - pSE_Band_Info_struct->SE_num_ignored_upper_bands > ((1<SE_num_ignored_upper_bands); -} - -float decompressSEWeights(int logWeight, int resolution) -{ - static int init = 0; - static float invLogTable[2][256]; - int n; - float weight; - - if (!init) - { - for (n = 0; n < 256; n++) - { - invLogTable[SE_BANDRES_2_67_DB][n] = (float) pow(10.0, ((double) n - 32.0) / 3.75); - invLogTable[SE_BANDRES_1_33_DB][n] = (float) pow(10.0, ((double) n - 32.0) / 7.50); - } - init++; - } - - if (logWeight < -32) - { - logWeight = -32; - } - - /* some error checking - return a very small power if there is a problem with the resolution value */ - if (resolution == SE_BANDRES_2_67_DB || resolution == SE_BANDRES_1_33_DB) { - weight = invLogTable[resolution][logWeight + 32]; - } else { - weight = invLogTable[0][0]; - } - - return(weight); -} - -void computeLPC(float*pfData, int order, int iStart, int iStop, float *alpha) -{ - int n, lag; - float rxx[10]; - - /* Compute autocorrelation */ - for (lag = 0; lag < order + 1; lag++) - { - rxx[lag] = 0.f; - for (n = iStart; n < iStop - lag; n++) - { - rxx[lag] += pfData[n] * pfData[n+lag]; - } - } - - if (rxx[0] != 0.f) - { - for (lag = 1; lag < order + 1; lag++) - { - rxx[lag] /= rxx[0]; - } - rxx[0] /= rxx[0]; - } - else - { - rxx[0] = 1.0f; - for (lag = 1; lag < order + 1; lag++) - { - rxx[lag] = 0.f; - } - } - - /* Compute 2nd order predictor coefficients */ - alpha[0] = rxx[1] * (1.0f - rxx[2]) / (1.0f - rxx[1] * rxx[1]); - alpha[1] = (rxx[2] - rxx[1] * rxx[1]) / (1.0f - rxx[1] * rxx[1]); -} - -void synthesisFilter(float *Data, float *alpha, float fDamp, int length) -{ - int k, n; - float power, state[SE_NSHAPE_ORDER] = {0.}; - - power = 0; - alpha[0] *= fDamp; - alpha[1] *= (fDamp * fDamp); - - for (n = 0; n < length; n++) - { - for (k = 0; k < SE_NSHAPE_ORDER; k++) - { - Data[n] += alpha[k] * state[k]; - } - - for (k = SE_NSHAPE_ORDER - 1; k > 0; k--) - { - state[k] = state[k-1]; - } - state[0] = Data[n]; - - power += Data[n] * Data[n]; - } - - /* Re-normalize to unit variance */ - if (power != 0.) - { - power /= (float) length; - power = 1.0f / (float) sqrt(power); - for (n = 0; n < length; n++) - { - Data[n] *= power; - } - } -} - -inline int readPastEndOfFillElement(int cnt, int numBitsRead, int numBitsToRead) -{ - if (numBitsRead + numBitsToRead > cnt * 8) - { - return (1); - } - else - { - return (0); - } -} - -// This function returns -(num_bits_used) if it attempts to read beyond the end of the fill element. -// Otherwise, it returns a positive integer corresponding to the index of the decoded Huffman codeword. -int decodeHuffCw(Huffman *h, - CDolbyBitStream*poBitStream, - int cnt, - int numBitsUsed) -{ - int i, j; - unsigned long cw; - - i = h->len; - - // test for read past end of fill element - if (readPastEndOfFillElement(cnt,numBitsUsed,i)) - { - return (-numBitsUsed); - } - cw = poBitStream->Get(i); - numBitsUsed += i; - - - while (cw != h->cw) - { - h++; - j = h->len-i; - i += j; - cw <<= j; - - // test for read past end of fill element - if (readPastEndOfFillElement(cnt,numBitsUsed,j)) - { - return (-numBitsUsed); - } - - cw |= poBitStream->Get(j); - numBitsUsed += j; - - } - return(h->index); -} - -int spectralExtInfo(int cnt, DOLBY_PAYLOAD_STRUCT *seData,CDolbyBitStream*poBitStream) -{ - int max_sfb[2]; - int n=0; - int num_bits_used; - int num_leftover_bits = 0; - int last_valid_q_2_unq_power_ratio = 0; - long get_bits_return_buffer; - int powerval_index; - int iNumDNSBits; - int iNumSpectFlatBits; - int ch_index,grp_index; - int i; - int num_chans_present; - int num_ref_energy_bits_to_read; - - int start_sfb, end_sfb, sfb_index; - float q_2_unq_power_ratio; - - max_sfb[0]=seData->aiMaxSFB[0]; - max_sfb[1]=seData->aiMaxSFB[1]; - - /* set error flag to zero as a default */ - seData->iDolbyBitStreamWarning = 0; - - /* Account for the bits used to describe the extension type EXT_SE_DATA. - This data has already been read from the datastream */ - num_bits_used = 4; - - /* get version_id */ - - // test for read past end of fill element - if (readPastEndOfFillElement(cnt,num_bits_used,3)) - { - seData->iDolbyBitStreamWarning = 242; - return ((cnt*8) - num_bits_used); - } - - get_bits_return_buffer = poBitStream->Get(3); - num_bits_used += 3; - if (get_bits_return_buffer >= 4) - { - // Invalid Dolby SE version number. This decoder only decodes Dolby SE v1.0- v1.3. - seData->iDolbyBitStreamWarning = 142; - return ((cnt*8) - num_bits_used); - } - - /* get reserved bits */ - // test for read past end of fill element - if (readPastEndOfFillElement(cnt,num_bits_used,2)) - { - seData->iDolbyBitStreamWarning = 242; - return ((cnt*8) - num_bits_used); - } - - get_bits_return_buffer = poBitStream->Get(2); - num_bits_used += 2; - - /* N.B. the reserve bits are not checked against any specific value, - since the reserve bits might depend on the revision number. Since we - are allowing multiple SE versions to be decoded by this decoder, the - reserve bits cannot be known for sure. */ - - - /* Get iSEPowerResolution parameter from bitstream */ - - // test for read past end of fill element - if (readPastEndOfFillElement(cnt,num_bits_used,1)) - { - seData->iDolbyBitStreamWarning = 242; - return ((cnt*8) - num_bits_used); - } - - get_bits_return_buffer = poBitStream->Get(1); - num_bits_used += 1; - seData->iSEPowerResolution = get_bits_return_buffer; - - - /* get single length x-form bit (1 = single length, 0 = double length) */ - // test for read past end of fill element - if (readPastEndOfFillElement(cnt,num_bits_used,1)) - { - seData->iDolbyBitStreamWarning = 242; - return ((cnt*8) - num_bits_used); - } - - get_bits_return_buffer = poBitStream->Get(1); - num_bits_used += 1; - -#ifdef USE_XFORM_HYSTERESIS - static int iConsistentBlockCount = 0; - static int iPreviousDoubleLengthXFormFlag = 2; //Init to invalid value so that first block is considered "consistent" */ -#endif - - if (get_bits_return_buffer) - { - /* Bit set indicates single length x-form */ -#ifdef USE_XFORM_HYSTERESIS - if (iPreviousDoubleLengthXFormFlag == 1) - { - /* Last block indicated double length x-form, current block indicates single. */ - if (++iConsistentBlockCount == XFORM_HYSTERESIS_LENGTH) - { - seData->iUsesDoubleLengthXForm = 0; - - iConsistentBlockCount = 0; - } - else - { - seData->iUsesDoubleLengthXForm = 1; - } - } - else - { - seData->iUsesDoubleLengthXForm = 0; - iConsistentBlockCount = 0; - } -#else - seData->iUsesDoubleLengthXForm = 0; -#endif - } - else - { - /* Bit clear indicates double length */ - -#ifdef USE_XFORM_HYSTERESIS - if (iPreviousDoubleLengthXFormFlag == 0) - { - /* Last block indicated single length x-form, current block indicates double. */ - if (++iConsistentBlockCount == XFORM_HYSTERESIS_LENGTH) - { - seData->iUsesDoubleLengthXForm = 1; - - iConsistentBlockCount = 0; - } - else - { - seData->iUsesDoubleLengthXForm = 0; - } - } - else - { - seData->iUsesDoubleLengthXForm = 1; - iConsistentBlockCount = 0; - } -#else - seData->iUsesDoubleLengthXForm = 1; -#endif - } - -#ifdef USE_XFORM_HYSTERESIS - iPreviousDoubleLengthXFormFlag = seData->iUsesDoubleLengthXForm; -#endif - /* verify that the source bitstream is either mono or stereo */ - num_chans_present = seData->iChannels; - if(num_chans_present < 1 || num_chans_present > 2) - { - // Invalid # of Chans for Dolby SEv1.0 (only mono or stereo allowed. Check to see if adts_header.channel_config is valid. - seData->iDolbyBitStreamWarning = 146; - return ((cnt*8) - num_bits_used); - } - - for(ch_index=0;ch_indexasDNSInfoStruct[ch_index].iWindowSequence == 2) - { - iNumDNSBits = SE_DNS_PWR_BITS_SHORT; - iNumSpectFlatBits = SE_SPECT_FLAT_BITS_SHORT; - } - else - { - iNumDNSBits = SE_DNS_PWR_BITS_LONG; - iNumSpectFlatBits = SE_SPECT_FLAT_BITS_LONG; - } - - /* get number of bands to ignore */ - // test for read past end of fill element - if (readPastEndOfFillElement(cnt,num_bits_used,3)) - { - seData->iDolbyBitStreamWarning = 242; - return ((cnt*8) - num_bits_used); - } - - get_bits_return_buffer = poBitStream->Get(3); - num_bits_used += 3; - if ( (get_bits_return_buffer < 0) || (get_bits_return_buffer > 7) ) - { - // Invalid Dolby SE number of bands to ignore. - seData->iDolbyBitStreamWarning = 144; - return ((cnt*8) - num_bits_used); - } - seData->SE_num_ignored_upper_bands[ch_index] = get_bits_return_buffer; - - for(grp_index=0;grp_indexiGroupCount[ch_index];grp_index++) - { - /* get spectral flatness measure */ - - // test for read past end of fill element - if (readPastEndOfFillElement(cnt,num_bits_used,8)) - { - seData->iDolbyBitStreamWarning = 242; - return ((cnt*8) - num_bits_used); - } - - get_bits_return_buffer = poBitStream->Get(iNumSpectFlatBits); - num_bits_used += iNumSpectFlatBits; - if ( (get_bits_return_buffer < 0) || (get_bits_return_buffer > (1 << iNumSpectFlatBits) - 1) ) - { - // Invalid Dolby SE spectral flatness measure. - seData->iDolbyBitStreamWarning = 147; - return ((cnt*8) - num_bits_used); - } - seData->sfm[ch_index][grp_index] = get_bits_return_buffer; - - /* get baseband_dynamic_noise_shaping_index */ - - // test for read past end of fill element - if (readPastEndOfFillElement(cnt,num_bits_used,3)) - { - seData->iDolbyBitStreamWarning = 242; - return ((cnt*8) - num_bits_used); - } - - if (seData->asDNSInfoStruct[ch_index].iWindowSequence != 2) - { - get_bits_return_buffer = poBitStream->Get(3); - num_bits_used += 3; - if ( (get_bits_return_buffer < 0) || (get_bits_return_buffer > 7) ) - { - // Invalid Dolby SE noise shaping index. - seData->iDolbyBitStreamWarning = 148; - return ((cnt*8) - num_bits_used); - } - seData->fdamp[ch_index][grp_index] = baseband_dynamic_noise_shaping_index_lookup_table[get_bits_return_buffer]; - } - else - { - seData->fdamp[ch_index][grp_index] = baseband_dynamic_noise_shaping_index_lookup_table[0]; - } - - /* get dolby DNS information */ - - /* nsect_export, and sect_export taken directly from huffdec2.c: getics(). - even values for the second index = the hcb values for that section; - odd values for the second index = the last valid sfb index for that section + 1 */ - - for(i=0;iasDNSInfoStruct[ch_index].psSectionInfoStruct->aiSectionCount[grp_index];i++) - { - /* compute starting and ending sfb numbers for this hcb section */ - start_sfb = seData->asDNSInfoStruct[ch_index].psSectionInfoStruct->aaiSectionStart[grp_index][i]; - end_sfb = seData->asDNSInfoStruct[ch_index].psSectionInfoStruct->aaiSectionEnd[grp_index][i]; - - if ((seData->asDNSInfoStruct[ch_index].psSectionInfoStruct->aaiSectionCodebooks[grp_index][i] > 0) && - (seData->asDNSInfoStruct[ch_index].psSectionInfoStruct->aaiSectionCodebooks[grp_index][i] < 12)) - { - // test for read past end of fill element - if (readPastEndOfFillElement(cnt,num_bits_used, iNumDNSBits)) - { - seData->iDolbyBitStreamWarning = 242; - return ((cnt*8) - num_bits_used); - } - - get_bits_return_buffer = poBitStream->Get(iNumDNSBits); - num_bits_used += iNumDNSBits; - if (seData->asDNSInfoStruct[ch_index].iWindowSequence == 2) - { - q_2_unq_power_ratio = q_2_unq_power_ratio_lookup_table[2 * get_bits_return_buffer + 1]; - } - else - { - q_2_unq_power_ratio = q_2_unq_power_ratio_lookup_table[get_bits_return_buffer]; - } - } - else - { - /* For HCB's >0 and <12, q_2_unq_power_ratio for the section should never be used. - However, we'll set the value to 0.0f to be safe, effectively turning DNS off for - this HCB section. */ - q_2_unq_power_ratio = 0.0f; - } - - /* assign the zpower value just read from the bitstream to the sfb's to - which the current section corresponds. */ - - for (sfb_index = start_sfb; sfb_indexasDNSInfoStruct[ch_index].aafDNSRatio[grp_index][sfb_index] = q_2_unq_power_ratio; - } - } - - /* get power normalization values */ - - /* first, determine the number of se bands in the datastream. - to do this, we'll use computeSeBandInfo. */ - - if (max_sfb[ch_index] == 0) - { - seData->num_se_bands[ch_index] = 0; - } - else - { - // decide which lookup table to use when determining - // the se banding structure for the current frame. - // this is a function of transform size and window type - SE_Band_Info_struct* pSE_Band_Info_table_to_use; - if (seData->asDNSInfoStruct[ch_index].iWindowSequence == 2) - { - // SHORT window - if (seData->iUsesDoubleLengthXForm) - { - pSE_Band_Info_table_to_use = SE_Band_Info_256; - } - else - { - pSE_Band_Info_table_to_use = SE_Band_Info_128; - } - } - else - { - // LONG,START,or STOP window - if (seData->iUsesDoubleLengthXForm) - { - pSE_Band_Info_table_to_use = SE_Band_Info_2048; - } - else - { - pSE_Band_Info_table_to_use = SE_Band_Info_1024; - } - } - - computeSeBandInfo ((seData->iUsesDoubleLengthXForm) ? (2 * seData->iSampleRate) : seData->iSampleRate, - seData->aiCopyStop[ch_index], - pSE_Band_Info_table_to_use, - seData->seBands[ch_index][grp_index], - &seData->num_se_bands[ch_index]); - seData->num_se_bands[ch_index] -= seData->SE_num_ignored_upper_bands[ch_index]; - } - - /* read the reference energy */ - // test for read past end of fill element - - if (seData->asDNSInfoStruct[ch_index].iWindowSequence == 2) - { - num_ref_energy_bits_to_read = SE_REF_ENERG_BITS_SHORT; - } - else - { - num_ref_energy_bits_to_read = SE_REF_ENERG_BITS_LONG; - } - - if (readPastEndOfFillElement(cnt,num_bits_used,num_ref_energy_bits_to_read)) - { - seData->iDolbyBitStreamWarning = 242; - return ((cnt*8) - num_bits_used); - } - - get_bits_return_buffer = poBitStream->Get(num_ref_energy_bits_to_read); - num_bits_used += num_ref_energy_bits_to_read; - seData->delta_power_values[ch_index][grp_index][0] = get_bits_return_buffer; - - /* read (num_se_bands[ch_index] - 1) Huffman encoded power values from the bitstream - (we've already read the first, absolute value from the file. */ - - for(i=0;inum_se_bands[ch_index]-1;i++) - { - powerval_index = decodeHuffCw( - SE_power_resolution_table[seData->asDNSInfoStruct[ch_index].iWindowSequence] - [seData->iSEPowerResolution].cwLengthLookupTable, - poBitStream, - cnt, - num_bits_used); - - // check to see if decodeHuffCw wanted to read beyond the end of the Fill element - if (powerval_index < 0) - { - seData->iDolbyBitStreamWarning = 242; - return ((cnt*8) - (-powerval_index)); // -powerval_index is the number of bits already read by decodeHuffCw - } - - seData->delta_power_values[ch_index][grp_index][i+1] = - (SE_power_resolution_table[seData->asDNSInfoStruct[ch_index].iWindowSequence] - [seData->iSEPowerResolution].cwValueLookupTable) - [powerval_index].cw; - - num_bits_used += - (SE_power_resolution_table[seData->asDNSInfoStruct[ch_index].iWindowSequence] - [seData->iSEPowerResolution].cwValueLookupTable) - [powerval_index].len; - } - } /* for (grp...) */ - } /* for ch_index */ - - /* calculate number of bytes used and read fill bits to end on a multiple of 8 */ - num_leftover_bits = num_bits_used % 8; - if (num_leftover_bits != 0) - { - /* debug: at this point, byte_align() could be called - in lieu of the next two lines of code. If byte_align is called, - it should return the number 8 - leftover_bits */ - - // test for read past end of fill element - if (readPastEndOfFillElement(cnt,num_bits_used,8 - num_leftover_bits)) - { - seData->iDolbyBitStreamWarning = 242; - return ((cnt*8) - num_bits_used); - } - - get_bits_return_buffer = poBitStream->Get(8 - num_leftover_bits); - num_bits_used += (8 - num_leftover_bits); - - if (get_bits_return_buffer != 0) - { - /* 243 SE Bitstream synchronization error.*/ - seData->iDolbyBitStreamWarning = 243; - return ((cnt*8) - num_bits_used); - } - } - - /* at this point, n should be an exact integer, since we're at an even byte boundary */ - n = (num_bits_used / 8); - - /* At this point, there might be extra "pad bytes" in the SE data stream. This might - occur if the encoder found that it needed to "purge" some bits from the bit resevoir by including - pad (all zero) bytes in the current FILL element after the SE data. The encoder might have chosen to - do this if it found that the number of bits it wanted to purge was greater than the number of bits needed - to transmit the SE bitstream. - - In this case, just read out the pad bytes until n = cnt. */ - while(n < cnt) - { - // test for read past end of fill element - if (readPastEndOfFillElement(cnt,num_bits_used,8)) - { - seData->iDolbyBitStreamWarning = 242; - return ((cnt*8) - num_bits_used); - } - - get_bits_return_buffer = poBitStream->Get(8); - num_bits_used += 8; - - if (get_bits_return_buffer != 0) - { - /* 243 SE Bitstream synchronization error.*/ - seData->iDolbyBitStreamWarning = 243; - return ((cnt*8) - num_bits_used); - } - n += 1; - } - - /* now, a sanity check: make sure we've read the correct number of bytes from the bitstream! */ - if (n != cnt) - { - // Dolby SEv1.0: number of bytes read from bitstream != number of bytes in extension payload! - seData->iDolbyBitStreamWarning = 149; - return ((cnt*8) - num_bits_used); - } - - // return the number of *bits* left in the payload, after reading all of the SE data. - // if there are no more payload bits, then the return value should be zero. - - return (8*(cnt-n)); -} - -void spectralExtend(float* pfData, - int iCopyStart, - int iCopyStop, - int iSfm, - int iBandCount, - int* piBands, - int* piDeltaPowerValues, - float fDamp, - int iHBlockSize, - int iWnd, - int iSEPowerResolution, - int iPreviousWnd, - float* avgCopyEnergies) -{ - /* SE declarations */ - int iBandCounter; - int iCounter; - int iCopyPtr; - int iDestPtr; - int iDestPtrThisBand; - - float fOneOverHBlockSize = 1.0f / (float) iHBlockSize; - float fCopyEnergy, fDestEnergy; - float fSFM; - float fNoiseRatio; - float fPhase; - float fScale0, fScale1, fNoise[2048], fAlpha[SE_NSHAPE_ORDER]; - int iNoiseOffset; - - /* additional declarations */ - int iCopyWidth; - static int piWeights[MAX_NUM_POWER_VALUES]; - - static unsigned char uchIsOddFrame; - static int iFunctionInitialized = 0; - -#ifdef DEBUG_PRINT_BUFFER_MODEL - // print out buffer model - static int already_printed_out_buffer_model = 0; -#endif - - if (!iFunctionInitialized) - { - uchIsOddFrame = 0; - iFunctionInitialized = 1; - } - - /* Compute some preliminaries */ - - iCopyWidth = iCopyStop - iCopyStart; - noiseGen(fNoise, ((iWnd == 2) ? 256 : 2048)); - - /* Time-Shape the noise prior to injection into extension */ - - computeLPC(pfData, SE_NSHAPE_ORDER, iCopyStart, iCopyStop, fAlpha); - - synthesisFilter(fNoise, fAlpha, fDamp, ((iWnd == 2) ? 256 : 2048)); - - piWeights[0] = piDeltaPowerValues[0] - 32; - - for (iBandCounter=1;iBandCounter iCopyStop) - { - iCopyPtr = iCopyStart + (iDestPtr-iCopyStart) % ((iWnd == 2) ? 2 : 16); - } -#else - // old buffer model for longs - if (iCopyPtr + piBands[iBandCounter] > iCopyStop) - { - iCopyPtr = iCopyStart; - if ((iDestPtr-iCopyPtr)%2) - { - iCopyPtr++; - } - } -#endif - iDestPtrThisBand = iDestPtr; /* Save initial value for next piBand loop */ - - /* First Copy up the data and compute the copied energy: */ - - // replicate spectrum - for(iCounter=0;iCounter= iCopyStop) - { - iCopyPtr = iCopyStart + (iDestPtr-iCopyStart) % ((iWnd == 2) ? 2 : 16); - } - } - -// /* Compute average energy for the band. */ -// fCopyEnergy/=(float)piBands[iBandCounter]; - - // Even though average energies have already been computed, don't divide by zero - fCopyEnergy = avgCopyEnergies[iBandCounter]; - - if(fCopyEnergy==0.0f) fCopyEnergy=1.0f; - fScale0 = (float) sqrt(fDestEnergy / fCopyEnergy); - fScale1 = (float) sqrt(fDestEnergy); - iDestPtr = iDestPtrThisBand; - - for(iCounter=0;iCounter0.0f)?fNoiseRatio:0.0f; - - pfData[iDestPtr] *= (fScale0 * (1.0f - fNoiseRatio)); - pfData[iDestPtr] += (fScale1 * fNoise[iDestPtr] * fNoiseRatio); - fTemp = 2.0f * fNoiseRatio; - pfData[iDestPtr] /= (float) sqrt(1.0f - fTemp + fTemp * fNoiseRatio); - - iDestPtr++; - } - } - - for(;iDestPtr -#include -#include -#include"bitstream.h" - -#define DSPmax(a,b) (((a) > (b)) ? (a) : (b)); -#define DSPmin(a,b) (((a) < (b)) ? (a) : (b)); - -#define DNS -#define SIGNAL_SUB -#define DOLBY_MAX_NUM_SFB 64 -#define DOLBY_BLOCK_LEN_LONG 1024 -#define SS_BUF_LEN_LONG 150 -#define SS_BUF_LEN_SHORT 18 -#define SS_COPYSTART 50 -#define SS_STEP_LONG 10 /* note that SS_STEP_LONG must divide into SS_BUF_LEN_LONG without remainder, - to assure that all values in normCopy array are power normalized.*/ -#define SS_STEP_SHORT 3 /* note that SS_STEP_SHORT must divide into SS_BUF_LEN_SHORT without remainder, - to assure that all values in normCopy array are power normalized.*/ - -#define GLOBAL_ATTEN 0.08f -#define NS_ATTEN1_LONG 0.975f -#define NS_ATTEN2_LONG 0.90f -#define NS_ATTEN1_SHORT 0.90f /* 0.816 would be attenuation factor to apply same per octave attenuation as - short block, but it is desireable to allow gentler rolloff for short blocks. - Thus set to 0.90. */ -#define NS_ATTEN2_SHORT 0.7f /* To apply the same per octave attenuation as long block, the slope would - be too sharp (greater than 6dB from bin to bin), thus allow a gentler slope - for short blocks due to flat nature of short block spectra. */ -#define NSFILT_COEF 0.3f -#define BACKWARD_MASK_COMP 0.95f -#define START_BIN_LONG 50 -#define START_BIN_SHORT (START_BIN_LONG / 8) -#define SE_MAX_NUM_BANDS 80 -#define MAX_NUM_POWER_VALUES SE_MAX_NUM_BANDS - - - -#define SE_BAND_IGNORE_BITS 3 -#define SE_NSHAPE_ORDER 2 -#define NOISE_LENGTH 10000 -#define NUM_BANDRES_OPTIONS 2 -#define SE_BANDRES_2_67_DB 0 -#define SE_BANDRES_1_33_DB 1 -#define NUM_BLOCKTYPES 4 -#define MAX_NUM_WINDOW_GROUPS 8 -#define SE_DNS_PWR_BITS_SHORT 3 -#define SE_DNS_PWR_BITS_LONG 4 -#define SE_SPECT_FLAT_BITS_LONG 8 -#define SE_SPECT_FLAT_BITS_SHORT 4 -#define SE_REF_ENERG_BITS_LONG 8 -#define SE_REF_ENERG_BITS_SHORT 7 - -// buffer model control variables -#define NEW_BUFFER_MODEL /* if #defined, uses the new buffer model which accounts for */ - /* frequency alignment between non-short and short frames */ -//#define DEBUG_PRINT_BUFFER_MODEL /* if #defined, prints out buffer model. Check the exact if statement */ - /* in the code to see whether or not the long or short buffer model is being printed out */ - -#define USE_XFORM_HYSTERESIS -#define XFORM_HYSTERESIS_LENGTH 2 /* Hysteresis for switching SE transform lengths. Relevant - * only if USE_XFORM_HYSTERESIS is #define'd. - * NOTE: Should be between 2 and (2 * NRDB per SE frame) inclusive or - * even a clean switch (from single to double or vice-versa) will - * elicit an unnecessary sound card close/re-open/glitch (twice). - */ - -struct SECTION_INFORMATION_STRUCT{ - int aiSectionCount[MAX_NUM_WINDOW_GROUPS]; - int aaiSectionCodebooks[MAX_NUM_WINDOW_GROUPS][DOLBY_MAX_NUM_SFB]; - int aaiSectionStart[MAX_NUM_WINDOW_GROUPS][DOLBY_MAX_NUM_SFB]; - int aaiSectionEnd[MAX_NUM_WINDOW_GROUPS][DOLBY_MAX_NUM_SFB]; -}; - -struct DNS_INFORMATION_STRUCT{ - int iWindowSequence; - int iGroupCount; - int iGroupLength[MAX_NUM_WINDOW_GROUPS]; - int iMaxSFB; - int iLastBin; - const int *piBandOffsets; - const SECTION_INFORMATION_STRUCT *psSectionInfoStruct; - float aafDNSRatio[MAX_NUM_WINDOW_GROUPS][DOLBY_MAX_NUM_SFB]; -}; - -struct DOLBY_PAYLOAD_STRUCT{ - int iDolbyBitStreamWarning; - int iUsesDoubleLengthXForm; - int iSEPowerResolution; - int iChannels; - int iSampleRateIndex; - int iSampleRate; - int num_se_bands[2]; - int seBands[2][MAX_NUM_WINDOW_GROUPS][SE_MAX_NUM_BANDS]; - int sfm[2][MAX_NUM_WINDOW_GROUPS]; - int delta_power_values[2][MAX_NUM_WINDOW_GROUPS][MAX_NUM_POWER_VALUES]; - float fdamp[2][MAX_NUM_WINDOW_GROUPS]; - int SE_num_ignored_upper_bands[2]; - int aiMaxSFB[2]; - int aiTotalSFB[2]; - int aiCopyStop[2]; - int iGroupLength[2][MAX_NUM_WINDOW_GROUPS]; - int iGroupCount[2]; - - DNS_INFORMATION_STRUCT asDNSInfoStruct[2]; -}; - -struct Huffman -{ - int index; - int len; - unsigned long cw; -} ; - -struct Huffman_lookup -{ - int index; - int len; - int cw; -}; - -typedef struct { - unsigned int sr; - unsigned int* SE_bands_bw; - unsigned char SE_max_num_se_bands; - unsigned char SE_num_ignored_upper_bands; -} SE_Band_Info_struct; - -typedef struct { - int powerResolution; - Huffman* cwLengthLookupTable; - Huffman_lookup* cwValueLookupTable; - int num_codewords; -} SE_power_resolution_table_struct; - - -void applyDNS( float *pfSpectralData, - DNS_INFORMATION_STRUCT*psDNSInfoStruct, - int iPrevWnd); - - -unsigned char computeSeBandInfo (unsigned int SRate, /* input: Sample Rate */ - unsigned int first_SE_bin, /* input: bin number of the first bin of the extension range */ - SE_Band_Info_struct* pSE_Band_Info_struct, /* input: SE band info struct ptr */ - int* SE_bands_bw, /* output: SE bandwidths, in bins (array; memory assumed to be already allocated) */ - int* num_SE_bands); - -int spectralExtInfo( int cnt, - DOLBY_PAYLOAD_STRUCT *seData, - CDolbyBitStream*poBitStream); -void spectralExtend(float* pfData, - int iCopyStart, - int iCopyStop, - int iSfm, - int iBandCount, - int* piBands, - int* delta_power_values, - float fDamp, - int iHBlockSize, - int wnd, - int SEPowerResolution, - int iPreviousWnd, - float* avgCopyEnergies); - -void computeAvgCopyEnergies(float* pfData, - int iCopyStart, - int iCopyStop, - int num_se_bands, - int* piBands, - int halfWindowLength, - int iWindowSequence, - float* avgCopyEnergies); - - -#endif \ No newline at end of file diff --git a/Src/vlb/NSVFactory.cpp b/Src/vlb/NSVFactory.cpp deleted file mode 100644 index e0e3b2e73..000000000 --- a/Src/vlb/NSVFactory.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include "NSVFactory.h" -#include "nsv_vlb.h" -#include "api__vlb.h" -#include "../nsv/nsvlib.h" - -IAudioDecoder *NSVFactory::CreateAudioDecoder(FOURCC format, IAudioOutput **output) -{ - switch (format) - { - case NSV_MAKETYPE('V', 'L', 'B', ' '): - { - VLB_Decoder *dec; - WASABI_API_MEMMGR->New(&dec); - return dec; - } - - default: - return 0; - } -} - - -#define CBCLASS NSVFactory -START_DISPATCH; -CB(SVC_NSVFACTORY_CREATEAUDIODECODER, CreateAudioDecoder) -END_DISPATCH; -#undef CBCLASS \ No newline at end of file diff --git a/Src/vlb/NSVFactory.h b/Src/vlb/NSVFactory.h deleted file mode 100644 index 3fe0b012d..000000000 --- a/Src/vlb/NSVFactory.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef NULLSOFT_VLB_NSVFACTORY_H -#define NULLSOFT_VLB_NSVFACTORY_H - -#include "../nsv/svc_nsvFactory.h" - -class NSVFactory : public svc_nsvFactory -{ -public: - IAudioDecoder *CreateAudioDecoder(FOURCC format, IAudioOutput **output) override; - -protected: - RECVS_DISPATCH; -}; - -#endif \ No newline at end of file diff --git a/Src/vlb/VLBIO.cpp b/Src/vlb/VLBIO.cpp deleted file mode 100644 index 320151806..000000000 --- a/Src/vlb/VLBIO.cpp +++ /dev/null @@ -1,116 +0,0 @@ -#include "VLBIO.h" -#include "vlbout.h" -#include "api__vlb.h" - -/////////////////////////////////////////////////////////////////////// -// -// VLB Data Input Class -// -/////////////////////////////////////////////////////////////////////// - - -void VLBIn::Fill( unsigned char *buf, int nbytes ) -{ - int writepos = pos + size; - - if (writepos >= BUFSIZE) writepos -= BUFSIZE; - - if (writepos + nbytes > BUFSIZE) - { - int l = BUFSIZE - writepos; - memcpy(data + writepos, buf, l); - buf += l; - writepos += l; - size += l; - nbytes -= l; - if (writepos >= BUFSIZE) writepos -= BUFSIZE; - } - - memcpy( data + writepos, buf, nbytes ); - size += nbytes; -} - -int VLBIn::IO( void *buf, int s, int n ) -{ - int nbytes = s * n; - void *obuf = buf; - if ( nbytes > size ) - { - nbytes = size - nbytes % s; - } - if (!nbytes) return 0; - - int bleft = nbytes; - - if (pos + nbytes > BUFSIZE) - { - int l = BUFSIZE - pos; - memcpy(buf, data + pos, l); - bleft -= l; - pos = 0; - buf = (char *)buf + l; - } - - memcpy(buf, data + pos, bleft); - - size -= nbytes; - pos += bleft; - if (pos >= BUFSIZE) pos = 0; - - return nbytes / s; -} - -/////////////////////////////////////////////////////////////////////// -// -// VLB Data Output Class -// -/////////////////////////////////////////////////////////////////////// - -#define ADD_SAMPLE(T,S) { *(T *)(data + ((size + pos) & (OBUFSIZE-1))) = S; size += sizeof(T); } - -#if !defined(__alpha) && !defined(_WIN64) -static __inline long float_to_long(double t) -{ - long r; - __asm fld t - __asm fistp r - return r; -} -#else -#define float_to_long(x) ((long)( x )) -#endif - -int VLBOut::IO( float **buf, int samples ) -{ - if ( iError ) return iError; - - long l; - for ( int i = 0; i < samples; i++ ) - for ( int j = 0; j < format.ucNChannels; j++ ) - { - l = float_to_long( buf[j][i] ); - if ( l > 32767 ) l = 32767; - if ( l < -32768 ) l = -32768; - ADD_SAMPLE(short, (short)l) - } - - return iError; -} - -void VLBOut::PullBytes( unsigned char *buf, int nbytes ) -{ - if (pos + nbytes >= OBUFSIZE) - { - int l = OBUFSIZE - pos; - memcpy(buf, data + pos, l); - pos = 0; - buf += l; - nbytes -= l; - size -= l; - } - - memcpy( buf, data + pos, nbytes ); - size -= nbytes; - pos += nbytes; - if (pos >= OBUFSIZE) pos = 0; -} diff --git a/Src/vlb/VLBIO.h b/Src/vlb/VLBIO.h deleted file mode 100644 index 41c4d3fa7..000000000 --- a/Src/vlb/VLBIO.h +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once -#include "dataio.h" -#include "vlbout.h" -class VLBIn : public DataIOControl -{ -public: - VLBIn() { pos = size = 0; } - virtual int IO( void *buf, int size, int count ); - virtual int Seek( long offset, int origin ) - { - return 0; - } - virtual int Close() { return 0; } - virtual int EndOf( void ) { return 0; } - virtual int DICGetLastError() { return DATA_IO_ERROR_NONE; } - virtual int DICGetDirection() { return DATA_IO_READ; } - int GetInputFree() { return BUFSIZE - size; } - int GetSize() { return size; } - void Fill( unsigned char *buf, int nbytes ); - void Empty() { pos = size = 0; } -private: - unsigned char data[BUFSIZE]; - int size, pos; -}; diff --git a/Src/vlb/VlbDecoder.cpp b/Src/vlb/VlbDecoder.cpp deleted file mode 100644 index dff137c1c..000000000 --- a/Src/vlb/VlbDecoder.cpp +++ /dev/null @@ -1,79 +0,0 @@ -#include "VLBDecoder.h" -VLBDecoder::VLBDecoder() -{ - decoder = 0; -} - -VLBDecoder::~VLBDecoder() -{ - delete decoder; -} - -int VLBDecoder::Open(DataIOControl *paacInput) -{ - if (decoder) - return 1; - - decoder = new CAacDecoderApi(paacInput); - return 0; -} - -void VLBDecoder::Close() -{ - delete decoder; - decoder=0; -} - -long VLBDecoder::Synchronize(AACStreamParameters *paacStreamParameters) -{ - if (decoder) - { - long status = decoder->Synchronize(paacStreamParameters); - if (status == 0) - { - info.ucNChannels = (unsigned char) paacStreamParameters->num_channels; - info.uiSampleRate = paacStreamParameters->sampling_frequency; - - dataout.SetFormatInfo(&info); - } - return status; - } - else - return ERR_SYNC_ERROR; -} - -long VLBDecoder::DecodeFrame(AACStreamParameters *paacStreamParameters) -{ - if (decoder) - return decoder->DecodeFrame(&dataout, paacStreamParameters); - else - return ERR_INVALID_BITSTREAM; -} - -void VLBDecoder::Flush() -{ - dataout.Empty(); -} - -size_t VLBDecoder::Read(void *buffer, size_t bufferlen) -{ - if (dataout.BytesAvail() > 0) - { - size_t l = dataout.BytesAvail(); - if (l > bufferlen) - l = bufferlen; - dataout.PullBytes((unsigned char *)buffer, (int)l); - return l; - } - return 0; -} - -#define CBCLASS VLBDecoder -START_DISPATCH; -CB(OBJ_VLBDECODER_OPEN, Open) -VCB(OBJ_VLBDECODER_CLOSE, Close) -CB(OBJ_VLBDECODER_SYNCHRONIZE, Synchronize) -CB(OBJ_VLBDECODER_DECODEFRAME, DecodeFrame) -VCB(OBJ_VLBDECODER_FLUSH, Flush) -CB(OBJ_VLBDECODER_READ, Read) -END_DISPATCH; diff --git a/Src/vlb/VlbDecoder.h b/Src/vlb/VlbDecoder.h deleted file mode 100644 index 0bb515406..000000000 --- a/Src/vlb/VlbDecoder.h +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once -#include "obj_vlbDecoder.h" -#include "vlbout.h" -class VLBDecoder : public obj_vlbDecoder -{ -public: - VLBDecoder(); - ~VLBDecoder(); - int Open(DataIOControl *paacInput); - void Close(); - long Synchronize(AACStreamParameters *paacStreamParameters); - long DecodeFrame(AACStreamParameters *paacStreamParameters); - void Flush(); - size_t Read(void *buffer, size_t bufferlen); -protected: - RECVS_DISPATCH; -private: - CAacDecoderApi *decoder; - VLBOut dataout; - AUDIO_FORMATINFO info; -}; \ No newline at end of file diff --git a/Src/vlb/aacdecoder.cpp b/Src/vlb/aacdecoder.cpp deleted file mode 100644 index 6bd3fa727..000000000 --- a/Src/vlb/aacdecoder.cpp +++ /dev/null @@ -1,434 +0,0 @@ -/* $Header: /cvs/root/winamp/vlb/aacdecoder.cpp,v 1.1 2009/04/28 20:21:07 audiodsp Exp $ */ - -/***************************************************************************\ - * - * Copyright 2000-2002 Dolby Laboratories, Inc. All Rights - * Reserved. Do not copy. Do not distribute. - * Confidential information. - * - * (C) copyright Fraunhofer - IIS (1998) - * All Rights Reserved - * - * filename: aacdecoder.cpp - * project : MPEG-2 AAC Decoder - * contents/description: decoder main object - * -\***************************************************************************/ - -#include "aacdecoder.h" -#include "bitstream.h" -#include "bitsequence.h" -#include "channelinfo.h" - -#include -// // // - -CAacDecoder::CAacDecoder (CDolbyBitStream& bs) - : m_bs (bs), sce (bs), cpe (bs), lfe (bs), dse (bs),bIgnoreDolbyStream(false), bLookForDSEInfoStream(true), - bHasDSEInfoStream(false) -{ - m_BlockNumber = 0 ; - m_SelectedProgram = 0 ; - - - -} - -CAacDecoder::~CAacDecoder () -{ - -} - -void CAacDecoder::SetEqualization (bool wantEQ, float Mask []) -{ - sce.SetEqualization (wantEQ, Mask) ; - cpe.SetEqualization (wantEQ, Mask) ; - lfe.SetEqualization (wantEQ, Mask) ; -} - -void CAacDecoder::ReadFillElement (void) -{ - CVLBBitSequence count (4) ; - if (count.Read (m_bs) == 15) - { - CVLBBitSequence esc_count (8) ; - esc_count.Read (m_bs) ; - - count = esc_count + 14 ; - } - - CVLBBitSequence fill_byte (8) ; - for (int i = 0 ; i < count ; i++) - { - fill_byte.Read (m_bs) ; - } -} -void CAacDecoder::ReadDolbyFillElement (void) -{ - CVLBBitSequence count (4) ; - int iCountInBytes; - int iCountInBits; - - if (count.Read (m_bs) == 15) - { - CVLBBitSequence esc_count (8) ; - esc_count.Read (m_bs) ; - - count = esc_count + 14 ; - } - iCountInBytes=(int)count; - iCountInBits = iCountInBytes * 8; - - CVLBBitSequence fill_byte (8) ; - CVLBBitSequence fill_nibble(4); - if(iCountInBytes){ - fill_nibble.Read(m_bs); - if(bLookForDSEInfoStream && ((int)fill_nibble)==15){ - iCountInBits=spectralExtInfo(iCountInBytes,&sDSEInfo,&m_bs); - - // Debug: simulate a bitstream error. This will cause the - // MDCT record to be zeroed-out at higher frequencies prior to - // the inverse transform. -// iCountInBits = iCountInBytes*8 - 4; -// sDSEInfo.iDolbyBitStreamWarning = 942; - - - - - bHasDSEInfoStream=true; - } - else{ - - // read out the rest of the byte; adjust bits read counter - fill_nibble.Read(m_bs); - iCountInBits -= 8; - - } - } - - // If there was an error in reading the SE bitstream, or if there are fill - // bits left in the same fill element, then read out the rest of the Fill Element. - - while(iCountInBits > 8) - { - fill_byte.Read (m_bs); - iCountInBits -= 8; - } - if (iCountInBits > 0 && iCountInBits <= 8) - { - m_bs.Get(iCountInBits); - iCountInBits -= iCountInBits; - } - -} - -void CAacDecoder::FrameInit(CStreamInfo &info) -{ - if (m_bs.IsAdifHeaderPresent ()) - { - m_AdifHeader.Read (m_bs) ; - - info.SetBitRate (m_AdifHeader.GetBitRate ()) ; - info.SetOriginalCopy(m_AdifHeader.GetOriginalCopy()); - info.SetHome(m_AdifHeader.GetHome()); - - info.SetSamplingRateIndex(m_AdifHeader.GetProgramConfig(0).GetSamplingFrequencyIndex()); - info.SetSamplingRate(CChannelInfo::SamplingRateFromIndex(info.GetSamplingRateIndex ())); - info.SetChannels(m_AdifHeader.GetProgramConfig(0).GetNumChannels()); - info.SetProfile(m_AdifHeader.GetProgramConfig(0).GetProfile()); - } -} - - -//MSV: -void CAacDecoder::InitDSEInfo( CDolbyBitStream*poBS, - CChannelElement *poChannelElement) -{ - // note that poChannelElement can be either poSingleChannel or poChannelPair. - // depending on a mono or stereo vlb bitstream. We will deal with poChannelElement - // (base class) calls in this function for either type of Channel Element, with the - // exception of calling Get[Left|Right]Block() for ChannelPair Elements. - int numChannels = poChannelElement->GetNumberOfChannels(); - int channelIndex; - - if (numChannels == 1 || numChannels == 2) - { - CBlock *poCBlock[2]; - CChannelInfo *poCChannelInfo; - - // This is garaunteed to set poCLongBlock to valid values, - // since we've already checked the number of channels! - - // GetChannelInfo could be made a virtual function of the base class, thus - // avoiding the need to specifically call different versions of GetChannelInfo() - // below, but this would require moving more code to the Base Class, which is - // unnecessarily complex. Note, however, that for CPE's, there poChannelInfo returns - // a pointer to an array of 2 ChannelInfo objects. - if (numChannels == 1) - { - poCBlock[0]=(CBlock*)( ((CSingleChannel*)poChannelElement)->GetBlock() ); - poCChannelInfo = ((CSingleChannel*)poChannelElement)->GetChannelInfo(); - - } else { // num_channels == 2 - poCBlock[0]=(CBlock*)( ((CChannelPair*)poChannelElement)->GetLeftBlock() ); - poCBlock[1]=(CBlock*)( ((CChannelPair*)poChannelElement)->GetRightBlock() ); - poCChannelInfo = ((CChannelPair*)poChannelElement)->GetChannelInfo(); - - } - - //Fill Out Dolby Payload Structure: - sDSEInfo.iChannels=numChannels; - - // sampling rate is same for both channels; just use sr info from the left (0th) channel - sDSEInfo.iSampleRateIndex=poCChannelInfo[0].GetSamplingIndex(); - sDSEInfo.iSampleRate=poCChannelInfo[0].GetSamplingFrequency(); - - // all other information must be read for left and right channels - for (channelIndex=0;channelIndexGetSectionInfo(); - sDSEInfo.asDNSInfoStruct[channelIndex].iWindowSequence=poCChannelInfo[channelIndex].GetWindowSequence(); - sDSEInfo.asDNSInfoStruct[channelIndex].iGroupCount=poCChannelInfo[channelIndex].GetWindowGroups(); - sDSEInfo.asDNSInfoStruct[channelIndex].iLastBin=poCChannelInfo[channelIndex].GetLastBin(); - sDSEInfo.asDNSInfoStruct[channelIndex].iMaxSFB=poCChannelInfo[channelIndex].GetScaleFactorBandsTransmitted(); - sDSEInfo.asDNSInfoStruct[channelIndex].piBandOffsets=poCChannelInfo[channelIndex].GetScaleFactorBandOffsets(); - sDSEInfo.aiCopyStop[channelIndex]=poCChannelInfo[channelIndex].GetLastBin(); - - sDSEInfo.iGroupCount[channelIndex]=poCChannelInfo[channelIndex].GetWindowGroups(); - for (int i=0;iIsAdifHeaderPresent () ? new CAacDecoder (*input) : new CAacDecoder (*buffer); - - decoder->FrameInit(*info); -} - - -CAacDecoderApi::~CAacDecoderApi () -{ - delete decoder; - delete input; - delete buffer; - delete info; -} - - -long CAacDecoderApi::Synchronize(AACStreamParameters *pAACStreamParameters) -{ - long lReturn = ERR_SYNC_ERROR; - int iResyncCount = 5; - - if (input->IsAdifHeaderPresent ()) - { - /* Cannot resync to an ADIF stream! */ - lReturn = ERR_NO_ERROR; - } - else - { - -#if defined (_DEBUG) -// cout << "Resynchronizing" << endl; -#endif - - buffer->ClearBytesSkipped(); - while(lReturn != ERR_NO_ERROR && lReturn != ERR_END_OF_FILE && iResyncCount) - { - - //Reset the block count: - buffer->ResetBlocks(); - - try - { - if (!cbValid) - { - cbValid = input->Read (readbuf, cbSize); - - if (!cbValid) - buffer->SetEOF(); - else - cbActual = cbValid; - } - - buffer->Feed(readbuf, cbActual, cbValid); - - if (buffer->IsDecodableFrame(*info)) - { - lReturn = ERR_NO_ERROR; - } - else - { - throw ESyncError(); - } - - //Try to decode the first Raw Data Block to Get Dolby Info: - unsigned int uiValidBits1; - unsigned int uiValidBits2; - unsigned int uiBitsUsed; - - uiValidBits1 = buffer->GetBitState(); - - decoder->DecodeFrame(NULL, *info); //this is only for ADTS! - - uiValidBits2 = buffer->GetBitState(); - uiBitsUsed = uiValidBits1 - uiValidBits2; - - buffer->PushBack((int)uiBitsUsed); - - if (!info->GetProtectionAbsent()) - { - unsigned int CRCsyndrome; - buffer->IsCrcConsistent(&CRCsyndrome); - } - } - catch(CAacException& e) - { - /* If an exception was thrown, we have to clear this flag so that the next - * call to IsDecodableFrame() will not simply return 'true' without actually - * sync'ing and parsing the header. - */ - buffer->ClearFrameReadButNotDecoded(); - - lReturn = TranslateException(e); - iResyncCount--; - } - catch (...) - { - /* All exceptions thrown should be derived from CAacException and therefore - * should be caught above. Just in case, though we'll add this catch() statement - * to catch things like access violations, etc. - */ - lReturn = ERR_UNEXPECTED_ERROR; - break; - } - } - } - - if (!lReturn) - { - if (FillStreamParameters(pAACStreamParameters)) - { - lReturn = WARN_STREAM_PARAM_CHANGE; - } - - /* frame_length is used here to pass up the # of bytes - * processed. This is actually the # of bytes skipped - * during the Synchronization() call. - */ - pAACStreamParameters->frame_length = buffer->GetBytesSkipped(); - - /* Clear the number of bytes skipped so that bytes_skipped - * no longer accumulates across calls to IsDecodableFrame() - */ - buffer->ClearBytesSkipped(); - } - return lReturn; -} - -long CAacDecoderApi::DecodeFrame (AudioIOControl *poAudioIO, - AACStreamParameters *pAACStreamParameters) -{ - long lReturn = ERR_NO_ERROR; - - buffer->ClearBytesSkipped(); - try - { - if (!input->IsAdifHeaderPresent ()) - { - if (!cbValid) - { - cbValid = input->Read (readbuf, cbSize); - - if (!cbValid) - buffer->SetEOF(); - else - cbActual = cbValid; - } - - // - // feed up to 'cbActual' bytes into decoder buffer - // - - buffer->Feed(readbuf, cbActual, cbValid); - - // - // sync - // - - if (!buffer->IsDecodableFrame(*info)) - { - lReturn = ERR_INVALID_BITSTREAM; - } - - /* Parse the entire frame so that CRC can be verified *before* performing the decode. */ - unsigned int uiValidBits1; - unsigned int uiValidBits2; - unsigned int uiBitsUsed; - - uiValidBits1 = buffer->GetBitState(); - - /* (NULL == parse frame only) */ - decoder->DecodeFrame(NULL, *info); // - - uiValidBits2 = buffer->GetBitState(); - uiBitsUsed = uiValidBits1 - uiValidBits2; - - /* This function performs a final sanity check for frame synchronization. - * It will read in the next 15 bits looking for the 0xFFF frame - * sync word, id, and layer. If it does not find a legal sync, it will throw an - * ESyncError() exception. - */ - VerifySync(); - - /* Push back entire frame (this does not include the header) before calling DecodeFrame() a second - * time to actually decode. - */ - buffer->PushBack((int)uiBitsUsed); - - /* Verify CRC prior to actual decode. */ - if (!info->GetProtectionAbsent()) - { - unsigned int CRCsyndrome; - - /* If the CRC is invalid, this function will throw an ECRCError() */ - buffer->IsCrcConsistent(&CRCsyndrome); - } - } - - /* Perform actual decode. */ - decoder->DecodeFrame(poAudioIO, *info); - - if (FillStreamParameters(pAACStreamParameters)) - { - /* Output parameter (Fs, NumChans, etc.) has changed */ - lReturn = WARN_STREAM_PARAM_CHANGE; - } - } - catch (CAacException& e) - { - /* Map the exception to a return code. */ - lReturn = TranslateException(e); - - /* frame_length is used here to pass up the # of bytes - * processed. An error has occurred so no bytes were - * processed. CAacDecoderAPI::Synchronication() will - * be called next to search for next syncword and return - * the number of bytes processed (i.e. bytes skipped). - */ - pAACStreamParameters->frame_length = 0; - } - catch (...) - { - /* All exceptions thrown should be derived from CAacException and therefore - * should be caught above. Just in case, though we'll add this catch() statement - * to catch things like access violations, etc. - */ - lReturn = ERR_UNEXPECTED_ERROR; - - /* frame_length is used here to pass up the # of bytes - * processed. An error has occurred so no bytes were - * processed. CAacDecoderAPI::Synchronication() will - * be called next to search for next syncword and return - * the number of bytes processed (i.e. bytes skipped). - */ - pAACStreamParameters->frame_length = 0; - } - - return lReturn; -} - -/********** PRIVATE METHODS ***********/ - -long CAacDecoderApi::TranslateException(CAacException& e) -{ - long lReturn = ERR_SUBROUTINE_ERROR; /* Default to generic subroutine error. */ - - static const int ErrorMap[][2] = - { - {AAC_UNIMPLEMENTED, ERR_SUBROUTINE_ERROR }, - {AAC_NOTADIFHEADER, ERR_INVALID_ADIF_HEADER }, - {AAC_DOESNOTEXIST, ERR_INVALID_BITSTREAM }, - {AAC_ENDOFSTREAM, ERR_END_OF_FILE }, - {AAC_SYNCERROR, ERR_SYNC_ERROR }, - {AAC_CRCERROR, WARN_CRC_FAILED }, - {AAC_INPUT_BUFFER_EMPTY, ERR_SYNC_ERROR }, - {AAC_INVALIDCODEBOOK, ERR_SUBROUTINE_ERROR }, - -#ifdef MAIN_PROFILE - {AAC_INVALIDPREDICTORRESET, ERR_SUBROUTINE_ERROR }, -#endif - - {AAC_UNSUPPORTEDWINDOWSHAPE,ERR_SUBROUTINE_ERROR }, - {AAC_DOLBY_NOT_SUPPORTED, ERR_SUBROUTINE_ERROR }, - {AAC_ILLEGAL_PROFILE, ERR_ILLEGAL_PROFILE } - }; - -#if defined (_DEBUG) -// cout << e.Explain() << endl; -#endif - - for (int i = 0; i < sizeof(ErrorMap) / (2 * sizeof(int)); i++) - { - if (e.What() == ErrorMap[i][0]) - { - lReturn = ErrorMap[i][1]; - break; - } - } - - return lReturn; -} - - -void CAacDecoderApi::VerifySync(void) -{ - /* This function performs a final sanity check for frame synchronization. - * It will read in the next 16 bits looking for one of two things: - * - * 1) The 0xFFF frame sync word plus 1-bit ID and 2-bit layer. - * 2) 0x5249 (RI) of a RIFF header (in the case of concatenated RIFF+ADTS files). - * - * If it does not find a legal sync, it will throw an ESyncError() exception. - * Either way, all bits read will be pushed back. - */ - - int nSyncWord = buffer->Get(16); - - buffer->PushBack(16); - - /* When looking for ADTS sync, examine only the 15 MS bits because the LSB is the - * 'protection absent' flag. - */ - if (!buffer->EndOf() && (nSyncWord & 0xFFFE) != 0xFFF8 && (nSyncWord != 0x5249)) - { - throw ESyncError(); - } -} - -bool CAacDecoderApi::FillStreamParameters(AACStreamParameters *pAACStreamParameters) -{ - bool bParamChanged = false; //Assume no audio parameter change. - static int nPreviousFs = 0; - static int nPreviousNumChannels = 0; - - if (input->IsAdifHeaderPresent ()) - { - pAACStreamParameters->stream_format = ADIF; - } - else if (input->IsRiffHeaderPresent ()) - { - pAACStreamParameters->stream_format = RIFFADTS; - } - else - { - pAACStreamParameters->stream_format = ADTS; - } - - if(decoder->HasDolbySpectralExtension() && decoder->HasDoubleLengthXForm()) - { - // When UseDblLengthXfrm is set, the function info->GetSamplingRate - // will double the sampling rate that it returns. Therefore, - // pAACStreamParameters->sampling_frequency gets set to the correct - // sampling rate in the code line below this one. - info->SetUseDblLengthXfrm(true); - } - else - { - info->SetUseDblLengthXfrm(false); - } - - pAACStreamParameters->sampling_frequency = info->GetSamplingRate(); - pAACStreamParameters->num_channels = info->GetChannels(); - pAACStreamParameters->bitrate = info->GetBitRate(); - - /* frame_length is used here to pass up the # of bytes - * processed. bytes_skipped needs to be added in here - * to account for concatenated RIFF+ADTS files. - */ - pAACStreamParameters->frame_length = info->GetFrameLength() + buffer->GetBytesSkipped(); - pAACStreamParameters->protection_absent = info->GetProtectionAbsent(); - pAACStreamParameters->copyright = info->GetOriginalCopy(); - pAACStreamParameters->original_copy = info->GetHome(); - - - if (nPreviousFs && nPreviousNumChannels) - { - if (pAACStreamParameters->sampling_frequency != nPreviousFs) - { - bParamChanged = true; - } - - if (pAACStreamParameters->num_channels != nPreviousNumChannels) - { - bParamChanged = true; - - /* Reset the number of channels to 0 so that AacDecoder::DecodeFrame() can - * re-add them as it parses the new bitstream. - */ - decoder->GetAdifHeader()->GetProgramConfig(0).ResetNonMCConfig(); - } - } - - nPreviousFs = pAACStreamParameters->sampling_frequency; - nPreviousNumChannels = pAACStreamParameters->num_channels; - - return bParamChanged; -} - - - diff --git a/Src/vlb/aacdecoderapi.h b/Src/vlb/aacdecoderapi.h deleted file mode 100644 index d735e0ab6..000000000 --- a/Src/vlb/aacdecoderapi.h +++ /dev/null @@ -1,150 +0,0 @@ -/* $Header: /cvs/root/winamp/vlb/aacdecoderapi.h,v 1.1 2009/04/28 20:21:07 audiodsp Exp $ */ - -/***************************************************************************\ - * - * Copyright 2000-2002 Dolby Laboratories, Inc. All Rights - * Reserved. Do not copy. Do not distribute. - * Confidential information. - * - * (C) copyright Fraunhofer - IIS (1998) - * All Rights Reserved - * - * filename: aacdecoderapi.h - * project : MPEG-2 AAC Decoder - * contents/description: AAC decoder API - * -\***************************************************************************/ - -#ifndef __AACDECODERAPI_H__ -#define __AACDECODERAPI_H__ - -#include -#include "DataIO.h" -#include "audio_io.h" - -/** AAC defines */ -#define AAC_MAX_PROGRAMS 16 - -#define ADTS 0 -#define ADIF 1 -#define RIFFADTS 2 - -/** API return value defines */ -#define ERR_NO_ERROR (0) - -/* Fatal errors (must re-sync) */ -#define ERR_INVALID_BITSTREAM (1) -#define ERR_INVALID_ADIF_HEADER (2) -#define ERR_SYNC_ERROR (3) -#define ERR_SUBROUTINE_ERROR (4) -#define ERR_END_OF_FILE (5) -#define ERR_INVALID_ADTS_HEADER (6) -#define ERR_INPUT_BUFFER_ERROR (7) -#define ERR_OUTPUT_BUFFER_ERROR (8) -#define ERR_ILLEGAL_PROFILE (9) -#define ERR_ILLEGAL_SAMP_RATE (10) -#define ERR_ILLEGAL_DATA_RATE (11) -#define ERR_ILLEGAL_CHANNELS (12) -#define ERR_CANNOT_SYNC_TO_ADIF (13) -#define ERR_UNEXPECTED_ERROR (14) -#define ERR_USER_ABORT (15) -#define MAX_EXEC_ERRORS (16)//Insert new errors before this - -/* Warnings (keep decoding) */ -#define WARN_CRC_FAILED (-1) -#define WARN_STREAM_PARAM_CHANGE (-2) - -/** structure defines for MPEG-2 AAC API Object */ - -typedef struct { - long sampling_frequency; - long num_channels; - long bitrate; - short stream_format; - long frame_length; - short protection_absent; - short copyright; - short original_copy; - -} AACStreamParameters; - - -/* Forward declarations */ -class CAacDecoder; -class CPlainFile; -class CDolbyBitBuffer; -class CStreamInfo; -class CAacException; - - - -/** MPEG-2 AAC API Object. - - This is the API object that interfaces with the application code. - It wraps the bitstream element objects and calls their individual decoding methods. - To indicate unexpected events and error conditions that prevent correct operation, - an exception derived from \Ref{CAacException} will be thrown that should be caught - by the calling application's decoding loop. - -*/ - -class CAacDecoderApi -{ - enum - { - cbSize = 2048 - }; - - CAacDecoder *decoder; - CPlainFile *input; - CDolbyBitBuffer *buffer; - CStreamInfo *info; - - unsigned char readbuf[cbSize]; - - unsigned int cbValid, cbActual; - const static unsigned int sfTab[16]; - - long TranslateException(CAacException& e); - void VerifySync(void); - bool FillStreamParameters(AACStreamParameters *paacStreamParameters); - -public : - - /** Object Constructor. - - Instantiates a decoder object capable of decoding one stream of - MPEG-2 AAC Audio Data. - - bs The \Ref{CBitStream} object that the decoder will read from. - */ - - CAacDecoderApi(DataIOControl *paacInput); - - /** Object Destructor. - */ - - ~CAacDecoderApi(); - - - - /** AAC API Synchronize Method - Synchronizes to stream - */ - - long Synchronize(AACStreamParameters *paacStreamParameters); - - - /** AAC Decoding Method. - - This method delivers one frame of decoded pcm audio data. - - info The configuration information. - */ - - long DecodeFrame ( AudioIOControl *ppcmOutput, - AACStreamParameters *paacStreamParameters) ; - -} ; - -#endif diff --git a/Src/vlb/adif.cpp b/Src/vlb/adif.cpp deleted file mode 100644 index 25ff2595b..000000000 --- a/Src/vlb/adif.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* $Header: /cvs/root/winamp/vlb/adif.cpp,v 1.1 2009/04/28 20:21:07 audiodsp Exp $ */ - -/***************************************************************************\ - * - * Copyright 2000-2002 Dolby Laboratories, Inc. All Rights - * Reserved. Do not copy. Do not distribute. - * Confidential information. - * - * (C) copyright Fraunhofer - IIS (1998) - * All Rights Reserved - * - * filename: adif.cpp - * project : MPEG-2 AAC Decoder - * contents/description: audio data interchange format header - * -\***************************************************************************/ - -#include "adif.h" - -// CAUTION: some elements read more than 16bits, -// this is not supported by CDolbyBitStream::Get(). - -CAdifHeader::CAdifHeader () - : m_CopyrightIdPresent (1), - m_OriginalCopy (1), - m_Home (1), - m_BitstreamType (1), - m_NumProgramConfigElements (4) -{ - m_BitRate = 0 ; -} - -CAdifHeader::~CAdifHeader () -{ -} - -#include -void CAdifHeader::Read (CDolbyBitStream &bs) -{ - char A[4]; - A[0]=(char)(bs.Get (8)); - A[1]=(char)(bs.Get (8)); - A[2]=(char)(bs.Get (8)); - A[3]=(char)(bs.Get (8)); - if (A[0]!= 'A') throw ENoAdifHeader () ; - if (A[1]!= 'D') throw ENoAdifHeader () ; - if (A[2]!= 'I') throw ENoAdifHeader () ; - if (A[3]!= 'F') throw ENoAdifHeader () ; - - if (m_CopyrightIdPresent.Read (bs)) - { - for (int i = 0 ; i < 9 ; i++) - { - bs.Get (8) ; // CopyrightId - } - } - - m_OriginalCopy.Read (bs) ; - m_Home.Read (bs) ; - m_BitstreamType.Read (bs) ; - - m_BitRate = bs.Get (16) ; - m_BitRate <<= 7 ; - m_BitRate |= bs.Get (7) ; - - // - - m_NumProgramConfigElements.Read (bs) ; - - for (int i = 0 ; i <= m_NumProgramConfigElements ; i++) - { - if (m_BitstreamType == 0) - { - // we don't care much about adif_buffer_fullness - - bs.Get (16) ; - bs.Get (4) ; - } - - m_ProgramConfigElement[i].Read (bs); - } -} - -CProgramConfig &CAdifHeader::GetProgramConfig (int index) -{ - return m_ProgramConfigElement [index] ; -} - diff --git a/Src/vlb/adif.h b/Src/vlb/adif.h deleted file mode 100644 index ccbf28db1..000000000 --- a/Src/vlb/adif.h +++ /dev/null @@ -1,87 +0,0 @@ -/* $Header: /cvs/root/winamp/vlb/adif.h,v 1.1 2009/04/28 20:21:07 audiodsp Exp $ */ - -/***************************************************************************\ - * - * Copyright 2000-2002 Dolby Laboratories, Inc. All Rights - * Reserved. Do not copy. Do not distribute. - * Confidential information. - * - * (C) copyright Fraunhofer - IIS (1998) - * All Rights Reserved - * - * filename: adif.h - * project : MPEG-2 AAC Decoder - * contents/description: audio data interchange format header - * -\***************************************************************************/ - -#ifndef __ADIF_H__ -#define __ADIF_H__ - -#include "bitsequence.h" -#include "programcfg.h" -#include "exception.h" - -class CDolbyBitStream ; - -/** Audio Data Interchange Format. - - This class is able to read the header information from an ADIF file - and serves as a container for the Program Configuration Elements - \Ref{CProgramConfig} found in the bitstream. -*/ - -class CAdifHeader -{ - -public : - - CAdifHeader () ; - ~CAdifHeader () ; - - void Read (CDolbyBitStream &bs) ; - - CProgramConfig &GetProgramConfig (int index) ; - - unsigned int GetBitRate (void) const - { - return m_BitRate ; - } - - unsigned int GetNumProgramConfigElements (void) const - { - return m_NumProgramConfigElements; - } - - unsigned int GetOriginalCopy (void) const - { - return m_OriginalCopy; - } - - unsigned int GetHome (void) const - { - return m_Home; - } - -protected : - - enum - { - MaximumPCEs = 16 - } ; - - CVLBBitSequence m_CopyrightIdPresent ; - CVLBBitSequence m_OriginalCopy ; - CVLBBitSequence m_Home ; - CVLBBitSequence m_BitstreamType ; - CVLBBitSequence m_NumProgramConfigElements ; - - CProgramConfig m_ProgramConfigElement [MaximumPCEs] ; - - unsigned int m_BitRate ; - - DECLARE_EXCEPTION(ENoAdifHeader, AAC_NOTADIFHEADER, "Not Valid ADIF Header") ; - -} ; - -#endif diff --git a/Src/vlb/api__vlb.h b/Src/vlb/api__vlb.h deleted file mode 100644 index 57d147e9b..000000000 --- a/Src/vlb/api__vlb.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef NULLSOFT_APIH -#define NULLSOFT_APIH - -#include -extern api_service *serviceManager; -#define WASABI_API_SVC serviceManager - - -#include -extern api_memmgr *memmgrApi; -#define WASABI_API_MEMMGR memmgrApi -#endif \ No newline at end of file diff --git a/Src/vlb/audio_io.cpp b/Src/vlb/audio_io.cpp deleted file mode 100644 index 832af70e9..000000000 --- a/Src/vlb/audio_io.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* $Header: /cvs/root/winamp/vlb/audio_io.cpp,v 1.1 2009/04/28 20:21:07 audiodsp Exp $ */ - -/***************************************************************************\ - * - * Copyright 2000-2002 Dolby Laboratories, Inc. All Rights - * Reserved. Do not copy. Do not distribute. - * Confidential information. - * - * filename: audio_io.cpp - * project : MPEG-2 AAC Decoder - * contents/description: Audio I/O include file - * -\***************************************************************************/ - -#include "audio_io_dsp.h" -#include "audio_io.h" - -AudioIOControl::AudioIOControl() - :psFormatInfo(NULL), - iError(AUDIO_ERROR_NONE) -{} - -AudioIOControl::AudioIOControl(AudioIOControl&oCopyObject) - :psFormatInfo(oCopyObject.psFormatInfo), - iError(oCopyObject.iError) -{} - -AudioIOControl& AudioIOControl::operator=(AudioIOControl&oAssignmentObject) -{ - psFormatInfo=oAssignmentObject.psFormatInfo; - iError=oAssignmentObject.iError; - return *this; -} - -AudioIOControl::~AudioIOControl() -{} - -int AudioIOControl::SetFormatInfo(AUDIO_FORMATINFO*psFormatInfo) -{ - this->psFormatInfo=psFormatInfo; - return 0; -} - -const AUDIO_FORMATINFO *AudioIOControl::GetFormatInfo() const -{ - return psFormatInfo; -} - diff --git a/Src/vlb/audio_io.h b/Src/vlb/audio_io.h deleted file mode 100644 index 216e7d80a..000000000 --- a/Src/vlb/audio_io.h +++ /dev/null @@ -1,92 +0,0 @@ -/* $Header: /cvs/root/winamp/vlb/audio_io.h,v 1.1 2009/04/28 20:21:07 audiodsp Exp $ */ - -/***************************************************************************\ - * - * Copyright 2000-2002 Dolby Laboratories, Inc. All Rights - * Reserved. Do not copy. Do not distribute. - * Confidential information. - * - * (C) copyright Fraunhofer - IIS (1998) - * All Rights Reserved - * - * filename: audio_io.h - * project : MPEG-2 AAC Decoder - * contents/description: Audio i/o header file - * -\***************************************************************************/ - -#include - -//Base Audio Device Errors: -#ifndef AUDIO_ERROR -#define AUDIO_ERROR - -#define AUDIO_ERROR_NONE 0 -#define AUDIO_ERROR_ENDOF 1 -#define AUDIO_ERROR_NO_DEVICE -1 -#define AUDIO_ERROR_DEVICE_FAIL -2 - -#endif -//Known Audio Formats: -#ifndef AUDIO_FORMAT -#define AUDIO_FORMAT - -#define AUDIO_FORMAT_PRIVATE 0 -#define AUDIO_FORMAT_WAV 1 -#define AUDIO_FORMAT_AU 2 -#define AUDIO_FORMAT_IMA_ADPCM 3 -#define AUDIO_FORMAT_WAVMAPPING 4 -#define AUDIO_FORMAT_DIRECTSOUND 5 -#define AUDIO_FORMAT_CD_AUDIO 6 - -#define AUDIO_FORMAT_GENERIC_FILE 97 -#define AUDIO_FORMAT_UNKNOWN 100 - -#endif - -//Audio Format Info Structure: -#ifndef AUDIO_FORMAT_INFO -#define AUDIO_FORMAT_INFO - -#define AUDIO_INPUT 0 -#define AUDIO_OUTPUT 1 - -class AUDIO_FORMATINFO{ - public: - unsigned int uiSampleRate; - unsigned char ucNChannels; -}; - -#endif - -#ifndef AUDIO_IO_CONTROL -#define AUDIO_IO_CONTROL - -class AudioIOControl{ - private: - AUDIO_FORMATINFO *psFormatInfo; - public: - AudioIOControl(); - AudioIOControl(AudioIOControl&); - AudioIOControl(int _iNChannels, unsigned int _uiSampleRate); - ~AudioIOControl(); - - virtual AudioIOControl& operator=(AudioIOControl&); - - virtual int SetFormatInfo(AUDIO_FORMATINFO*); - - const AUDIO_FORMATINFO *GetFormatInfo() const; - - //virtual int IO(unsigned char**,int)=0; - //virtual int IO(short**,int)=0; - virtual int IO(float**,int)=0; - - protected: - int iError; - short *pshOutBuf; -}; - -#endif /* AUDIO_IO_CONTROL */ - - - diff --git a/Src/vlb/audio_io_dsp.cpp b/Src/vlb/audio_io_dsp.cpp deleted file mode 100644 index f7d73c363..000000000 --- a/Src/vlb/audio_io_dsp.cpp +++ /dev/null @@ -1,532 +0,0 @@ -/* $Header: /cvs/root/winamp/vlb/audio_io_dsp.cpp,v 1.1 2009/04/28 20:21:08 audiodsp Exp $ */ - -/***************************************************************************\ - * - * Copyright 2000-2002 Dolby Laboratories, Inc. All Rights - * Reserved. Do not copy. Do not distribute. - * Confidential information. - * - * filename: audio_io.cpp - * project : MPEG-2 AAC Decoder - * contents/description: Audio I/O include file - * -\***************************************************************************/ - -#include "audio_io_dsp.h" -#include -#include -#include - -#define CLIP_DLY 1 - -static double scaletab[NSCALETAB]; - -static const double invsampratetab[NSAMPRATE] = -{ 0.00001041667, - 0.00001133787, - 0.00001562500, - 0.00002083333, - 0.00002267574, - 0.00003125000, - 0.00004166667, - 0.00004535147, - 0.00006250000, - 0.00008333333, - 0.00009070295, - 0.00012500000 -}; - -static short limitcnttab[NSAMPRATE] = -{ - 96000/(CLIPDLY * XLIMDELAY), - 88200/(CLIPDLY * XLIMDELAY), - 64000/(CLIPDLY * XLIMDELAY), - 48000/(CLIPDLY * XLIMDELAY), - 44100/(CLIPDLY * XLIMDELAY), - 32000/(CLIPDLY * XLIMDELAY), - 24000/(CLIPDLY * XLIMDELAY), - 22050/(CLIPDLY * XLIMDELAY), - 16000/(CLIPDLY * XLIMDELAY), - 12000/(CLIPDLY * XLIMDELAY), - 11025/(CLIPDLY * XLIMDELAY), - 8000/(CLIPDLY * XLIMDELAY) -}; - - -AudioIODSP::AudioIODSP(int _iNChannels, unsigned int _uiSampRate) -: iNChannels(_iNChannels), uiSampRate(_uiSampRate) -{ - int chan, i; - double upper, lower, limdelta, upperlim; - - hsClipDly = new DLY_VARS*[iNChannels]; - hsSmoothVars = new SMOOTH_VARS*[iNChannels]; - for (chan = 0; chan < iNChannels; chan++) - { - hsClipDly[chan] = new DLY_VARS; - hsClipDly[chan]->bufptr = new float[DLYBUFSZ]; - for (i = 0; i < DLYBUFSZ; i++) - { - hsClipDly[chan]->bufptr[i] = 0.0f; - } - hsClipDly[chan]->bufsize = DLYBUFSZ; - hsClipDly[chan]->delay = CLIPDLY; - hsClipDly[chan]->index = 0; - - hsSmoothVars[chan] = new SMOOTH_VARS; - hsSmoothVars[chan]->dcy_count = 0; - hsSmoothVars[chan]->dcy_samp = 0.0; - } - - pshOutBuf = new short[iNChannels*DLYBUFSZ]; - for (i = 0; i < iNChannels*DLYBUFSZ; i++) - { - pshOutBuf[i] = 0; - } - pfDlyBuf = new float[DLYBUFSZ]; - - bHardClip = false; - - for (chan = 0; chan < MAXCHANNELS; chan++) - { - fPrevClipScale[chan] = 1.0; - for (i = 0; i < CLIPDLY; i++) - { - fPrevDlyBuf[chan][i] = 0.0; - } - } - - for (i = 0; i < DLYBUFSZ; i++) - { - pfDlyBuf[i] = 0.0; - } - - upper = PEAKLIMIT; - lower = PMAXF; - limdelta = (upper - lower) / (NSCALETAB - 1); - for (i = 0; i < NSCALETAB; i++) - { - upperlim = lower + i * limdelta; - scaletab[i] = (float)(lower / upperlim - INTERP_CORRECTION_FACT); - } -} - - -AudioIODSP::~AudioIODSP() -{ - int chan; - - if (hsClipDly != NULL) - { - for (chan = 0; chan < iNChannels; chan++) - { - delete[] hsClipDly[chan]->bufptr; - delete hsClipDly[chan]; - } - delete [] hsClipDly; - } - - if (hsSmoothVars != NULL) - { - for (chan = 0; chan < iNChannels; chan++) - { - delete hsSmoothVars[chan]; - } - delete [] hsSmoothVars; - } - - if (pshOutBuf != NULL) - { - delete[] pshOutBuf; - } - if (pfDlyBuf != NULL) - { - delete[] pfDlyBuf; - } -} - -void AudioIODSP::SetSamplingRate(unsigned int _uiSampRate) -{ - int iSRateIndex; - float invSamp; - - this->uiSampRate = _uiSampRate; - - /* Set up limiter decay/delay params. */ - - switch (uiSampRate) - { - case (8000): - iSRateIndex = 0; - break; - case (11025): - iSRateIndex = 1; - break; - case (12000): - iSRateIndex = 2; - break; - case (16000): - iSRateIndex = 3; - break; - case (22050): - iSRateIndex = 4; - break; - case (24000): - iSRateIndex = 5; - break; - case (32000): - iSRateIndex = 6; - break; - case (44100): - iSRateIndex = 7; - break; - case (48000): - iSRateIndex = 8; - break; - case (64000): - iSRateIndex = 9; - break; - case (88200): - iSRateIndex = 10; - break; - case (96000): - iSRateIndex = 11; - break; - default: - bHardClip = true; /* Non-standard sample rate. Enable hard limiter in this case. */ - } - - invSamp = (float)invsampratetab[iSRateIndex]; /* inverse of samp rate*/ - initLimitCnt = limitcnttab[iSRateIndex]; - dcyDelta = (float)(1.0 - invSamp * 2.0 * CLIPDLY); -} - -void AudioIODSP::Float_to_Int(float **fInput, int *iOutput, int iLength, int grpIndex, int bitResolution) -{ - short sTemp, outNdx, chan, samp; - int iPWordLengthLim, iNWordLengthLim; - float fSamp; - short interleaveOut = iNChannels; - - for (chan = 0; chan < iNChannels; chan++) - { - outNdx = chan; - for (samp = 0; samp < iLength; samp++) - { - fSamp = fInput[chan][grpIndex * iLength + samp]; - iPWordLengthLim = (1 << (bitResolution - 1)) - 1; - iNWordLengthLim = -iPWordLengthLim - 1; - - fSamp=(fSamp > (float)iPWordLengthLim) ? (float)iPWordLengthLim : fSamp; - fSamp=(fSamp < (float)iNWordLengthLim) ? (float)iNWordLengthLim : fSamp; - - sTemp = (fSamp >= 0.0f) ? (short)(fSamp + 0.5f) : (short)(fSamp - 0.5f); - iOutput[outNdx] = (int)(sTemp >> bitResolution); - outNdx += interleaveOut; - } // and samp loop - } // end chan loop -} - - -void AudioIODSP::Float_to_Short_Clip(float **fInput, short *sOutput, int iLength, int grpIndex) -{ - short samp; - short chan; - short interleaveIn = 1; - short interleaveOut = iNChannels; - float fSamp; - int outNdx; - -#ifdef CLIP_DLY - short dlysamp; - float fClipScale; - float limitAmount; - float fLookAhead; - float *pfDlyBufW = pfDlyBuf + CLIPDLY; - float *pfDlyBuf_LookAhead, *fPrevDlyPtr; - float currLimitAmount; -#endif - - assert(iLength >= CLIPDLY); - - for (chan = 0; chan < iNChannels; chan++) - { - -#ifdef CLIP_DLY - fPrevDlyPtr = fPrevDlyBuf[chan]; - for (samp = 0; samp < CLIPDLY; samp++) - { - pfDlyBuf[samp] = fPrevDlyPtr[samp]; - } - -/* !!! The following line may cause a compile time warning or BoundsChecker error !!! - This is a speed optimization and is intended to work this way. fPrevDlyPtr will point - to a location outside of the buffer. The code that followswill not write to this location. */ - fPrevDlyPtr -= (iLength - CLIPDLY); /* cue up the Prev buffer to allow samp to begin indexing - at position zero when samp = iLength - CLIPDLY */ - - outNdx = chan; - pfDlyBuf_LookAhead = fInput[chan] + grpIndex * iLength; - for (samp = 0; samp < iLength; samp++) - { -/* Call CalcAtten() to compute the amount of gain attenuation to apply to bring the current sample - below the clip threshold. Note that CalcAtten contains a delay and decay factor for each channel - to govern transitioning out of limiting. Thus even if the current sample does not clip, the value - fClipScale could be < 1.0 due to the hysteresis of the limiter in CalcAtten. */ - - fLookAhead = (float)fabs(fInput[chan][samp + grpIndex * iLength]); - fClipScale = CalcAtten(hsSmoothVars[chan], fLookAhead, PMAXF); - -/* Limit current sample to not clip, as determined by the return value from CalcAtten() */ - - currLimitAmount = pfDlyBuf_LookAhead[samp] * fClipScale; - (samp < iLength - CLIPDLY) ? (pfDlyBufW[samp] = currLimitAmount) : - (fPrevDlyPtr[samp] = currLimitAmount); - limitAmount = fPrevClipScale[chan] - fClipScale; /* limitAmount > 0: going further into limiting */ - /* limitAmount < 0: coming out of limiting */ - -/* if difference between limit amount from previous sample, and current limit limit amount is non-zero, - proceed back through previous samples to apply more (or less) clipping. Delta clipping amount is - difference between current and previous clip amount. Note that the delta clipping amount slopes - linearly to zero additional clipping as dlysamp advances towards CLIPDLY samples from the current sample.*/ - - if (limitAmount > 0.0) - { - for (dlysamp = -1; dlysamp > -CLIPDLY; dlysamp--) - { - currLimitAmount = (float)(1.0 - limitAmount * (CLIPDLY + dlysamp) * CLIPNORM); - (samp + dlysamp < iLength - CLIPDLY) ? (pfDlyBufW[samp + dlysamp] *= currLimitAmount) : - (fPrevDlyPtr[samp + dlysamp] *= currLimitAmount); - } - } - - fPrevClipScale[chan] = fClipScale; - } - - for (samp = 0; samp < iLength; samp++) - { - fSamp = pfDlyBuf[samp]; - if (bHardClip) - { - fSamp=(fSamp > 32767.0f) ? 32767.0f : fSamp; - fSamp=(fSamp < -32768.0f) ? -32768.0f : fSamp; - } - else - { - assert(fSamp <= 32767.0); - assert(fSamp >= -32768.0); - } - sOutput[outNdx] = (fSamp >= 0.0f) ? (short)(fSamp + 0.5f) : (short)(fSamp - 0.5f); - outNdx += interleaveOut; - } - -#else - outNdx = chan; - for (samp = 0; samp < iLength; samp++) - { - fSamp = fInput[chan][grpIndex * iLength + samp]; - fSamp=(fSamp>32767.0f)?32767.0f:fSamp; - fSamp=(fSamp<-32768.0f)?-32768.0f:fSamp; - sOutput[outNdx]=(fSamp>=0.0f)?(short)(fSamp+0.5f):(short)(fSamp-0.5f); - outNdx += interleaveOut; - } /* end samp loop */ -#endif - } /* end chan loop */ -} - - -/////////////////////////////////////////////////////////////////// -// AudioIODSP::Limiter -// -// Input: fBuffer[chans][samples] - data to be limited -// iLength - # of samples to be limited -// grpIndex - which chunk of data to limit -// -// Output: fBuffer[chans][samples] - limited data is written over -// input data -/////////////////////////////////////////////////////////////////// -void AudioIODSP::ApplyLimiter(float **fBuffer, int iLength, int grpIndex) -{ - short samp; - short chan; - float fSamp; - -#ifdef CLIP_DLY - short dlysamp; - float fClipScale; - float limitAmount; - float fLookAhead; - float *pfDlyBufW = pfDlyBuf + CLIPDLY; - float *pfDlyBuf_LookAhead, *fPrevDlyPtr; - float currLimitAmount; -#endif - - assert(iLength >= CLIPDLY); - - for (chan = 0; chan < iNChannels; chan++) - { - -#ifdef CLIP_DLY - fPrevDlyPtr = fPrevDlyBuf[chan]; - for (samp = 0; samp < CLIPDLY; samp++) - { - pfDlyBuf[samp] = fPrevDlyPtr[samp]; - } - -/* !!! The following line may cause a compile time warning or BoundsChecker error !!! - This is a speed optimization and is intended to work this way. fPrevDlyPtr will point - to a location outside of the buffer. The code that followswill not write to this location. */ - fPrevDlyPtr -= (iLength - CLIPDLY); /* cue up the Prev buffer to allow samp to begin indexing - at position zero when samp = iLength - CLIPDLY */ - - pfDlyBuf_LookAhead = fBuffer[chan] + grpIndex * iLength; - for (samp = 0; samp < iLength; samp++) - { -/* Call CalcAtten() to compute the amount of gain attenuation to apply to bring the current sample - below the clip threshold. Note that CalcAtten contains a delay and decay factor for each channel - to govern transitioning out of limiting. Thus even if the current sample does not clip, the value - fClipScale could be < 1.0 due to the hysteresis of the limiter in CalcAtten. */ - - fLookAhead = (float)fabs(fBuffer[chan][samp + grpIndex * iLength]); - fClipScale = CalcAtten(hsSmoothVars[chan], fLookAhead, PMAXF); - -/* Limit current sample to not clip, as determined by the return value from CalcAtten() */ - - currLimitAmount = pfDlyBuf_LookAhead[samp] * fClipScale; - (samp < iLength - CLIPDLY) ? (pfDlyBufW[samp] = currLimitAmount) : - (fPrevDlyPtr[samp] = currLimitAmount); - limitAmount = fPrevClipScale[chan] - fClipScale; /* limitAmount > 0: going further into limiting */ - /* limitAmount < 0: coming out of limiting */ - -/* if difference between limit amount from previous sample, and current limit limit amount is non-zero, - proceed back through previous samples to apply more (or less) clipping. Delta clipping amount is - difference between current and previous clip amount. Note that the delta clipping amount slopes - linearly to zero additional clipping as dlysamp advances towards CLIPDLY samples from the current sample.*/ - - if (limitAmount > 0.0) - { - for (dlysamp = -1; dlysamp > -CLIPDLY; dlysamp--) - { - currLimitAmount = (float)(1.0 - limitAmount * (CLIPDLY + dlysamp) * CLIPNORM); - (samp + dlysamp < iLength - CLIPDLY) ? (pfDlyBufW[samp + dlysamp] *= currLimitAmount) : - (fPrevDlyPtr[samp + dlysamp] *= currLimitAmount); - } - } - - fPrevClipScale[chan] = fClipScale; - } - - for (samp = 0; samp < iLength; samp++) - { - fSamp = pfDlyBuf[samp]; - if (bHardClip) - { - fSamp=(fSamp > 32767.0f) ? 32767.0f : fSamp; - fSamp=(fSamp < -32768.0f) ? -32768.0f : fSamp; - } - else - { - assert(fSamp <= 32767.0); - assert(fSamp >= -32768.0); - } - fBuffer[chan][samp + grpIndex * iLength] = (fSamp >= 0.0f) ? (fSamp + 0.5f) : (fSamp - 0.5f); - } - -#else - for (samp = 0; samp < iLength; samp++) - { - fSamp = fBuffer[chan][grpIndex * iLength + samp]; - fSamp=(fSamp>32767.0f)?32767.0f:fSamp; - fSamp=(fSamp<-32768.0f)?-32768.0f:fSamp; - fBuffer[chan][grpIndex * iLength + samp] = (fSamp>=0.0f)?(fSamp+0.5f):(fSamp-0.5f); - } /* end samp loop */ -#endif - } /* end chan loop */ -} - - - -/**** -calcatten() - -This routine calculates the amount of attenuation that must be applied to -prevent clipping beyond PMAXF (32768.0f). The output scale value varies -between thresh-6 dB and thresh. The input value is the maximum sample. If the -max sample is greater than thresh, then compute a scalefactor that: - - 1. Is proportional to the amount fMaxSamp exceeds thresh. - 2. Reflects recent history of clipping by applying a delay and decay - in transitioning out of clipping. -****/ - -inline float AudioIODSP::CalcAtten(SMOOTH_VARS *smoothvars, float fMaxSamp, float thresh) -{ - float scale; - float interp; - short index; - float limvalscl; - - if ((fMaxSamp > thresh) || (smoothvars->dcy_samp > thresh)) - { - if (fMaxSamp > PEAKLIMITM1) /* Hard limit in case fSample is 10 dB above full scale */ - { - scale = (float)PMAXF / fMaxSamp; - smoothvars->dcy_samp = (float)PEAKLIMITM1; - smoothvars->dcy_count = initLimitCnt; - } - else - { -/**** -If the input maximum sample is greater than the previous maximum sample, then -assign the new maximum as the sample to be delayed and decayed. On each -subsequent call to CalcAtten(), if there are no samples greater than dcy_samp, -then dcy_samp will hold its value for initLimitCnt calls to CalcAtten() before -sloping down to thresh. -****/ - if (fMaxSamp > smoothvars->dcy_samp) - { - smoothvars->dcy_samp = fMaxSamp; - smoothvars->dcy_count = initLimitCnt; - } - else - { - if (smoothvars->dcy_count != 0) /* If delay before decay onset, decrement */ - { - smoothvars->dcy_count--; - } - else if (smoothvars->dcy_samp > thresh) - { - smoothvars->dcy_samp = smoothvars->dcy_samp * dcyDelta; - } -/* else smoothvars->dcy_samp < thresh which will cause scale = 1.0 and smoothvars->dcy_samp = 0.0 - for subsequent samples. */ - } - -/* This finds the scaled inverse of limval using a lookup table. Note that - since limval should always be less than 1.0, the index will always be less - than 32 and scaletab[index+1] will not go beyond the bounds of its array.*/ - - if (smoothvars->dcy_samp > thresh) - { - limvalscl = (float)((smoothvars->dcy_samp - thresh) * CX_LIMSCALE); - index = (short)limvalscl; - interp = limvalscl - index; - - scale = (float)(scaletab[index] + interp * (scaletab[index+1] - scaletab[index])); - } - else /* This else case is only entered if dcyDelta scales dcy_samp to be less than thresh */ - { - scale = 1.0; - smoothvars->dcy_samp = 0.0; - } - } - } - else - { - scale = 1.0; - smoothvars->dcy_samp = 0.0; - } - - return (scale); -} - diff --git a/Src/vlb/audio_io_dsp.h b/Src/vlb/audio_io_dsp.h deleted file mode 100644 index d0afca3ac..000000000 --- a/Src/vlb/audio_io_dsp.h +++ /dev/null @@ -1,81 +0,0 @@ -/* $Header: /cvs/root/winamp/vlb/audio_io_dsp.h,v 1.1 2009/04/28 20:21:08 audiodsp Exp $ */ - -/***************************************************************************\ - * - * Copyright 2000-2002 Dolby Laboratories, Inc. All Rights - * Reserved. Do not copy. Do not distribute. - * Confidential information. - * - * (C) copyright Fraunhofer - IIS (1998) - * All Rights Reserved - * - * filename: audio_io_dsp.h - * project : MPEG-2 AAC Decoder - * contents/description: Audio DSP processing header file - * -\***************************************************************************/ - -#ifndef __AUDIO_IO_DSP_H__ -#define __AUDIO_IO_DSP_H__ - -#define CLIPDLY 10 -#define CLIPNORM (1.0/CLIPDLY) -#define DLYBUFSZ 128 -#define PMAXF 32767.0f -#define PMAXFM1 (PMAXF-1) -#define NMAXF -32768.0f -#define MAXCHANNELS 2 -#define NSAMPRATE 12 -#define XLIMDELAY 5 // delay is 1/5 second before decay stage of clip delay return segment. -#define NSCALETAB 33 -#define PEAKLIMIT (3.16*PMAXF) // Allows for 10 dB of smoothed limiting. Any overshoot greater - // than 10 dB is hard limited. -#define PEAKLIMITM1 (PEAKLIMIT-1) -#define INTERP_CORRECTION_FACT 0.013 // compensates for error between actual inverse and estimated inverse - // in scaletab table. -#define CX_LIMSCALE ((NSCALETAB-1)/(PEAKLIMIT-PMAXF)) - -typedef struct { - short index; - short delay; - short bufsize; - float *bufptr; -} DLY_VARS; - -typedef struct { - short dcy_count; - float dcy_samp; -} SMOOTH_VARS; - - -class AudioIODSP{ - private: - DLY_VARS **hsClipDly; - SMOOTH_VARS **hsSmoothVars; - int iNChannels; - bool bHardClip; - float *pfDlyBuf; - float fPrevDlyBuf[MAXCHANNELS][CLIPDLY]; - float fPrevClipScale[MAXCHANNELS]; - short initLimitCnt; // Amount of time to delay before decaying the limiter scaling value. - float dcyDelta; // Dcy_delta is the amount to attenuate the limiter scaling value - // on each call to CalcAtten(). - unsigned int uiSampRate; - float AudioIODSP::CalcAtten(SMOOTH_VARS *smoothvars, float fMaxSamp, float thresh); - - public: - short *pshOutBuf; - - AudioIODSP(int _iNChannels, unsigned int _uiSampRate = 0); - ~AudioIODSP(); - void Float_to_Short_Clip(float **fInput, short *sOutput, int iLength, int grpIndex); - void Float_to_Int(float **fInput, int *iOutput, int iLength, int grpIndex, - int bitResolution); - - void ApplyLimiter(float **fBuffer, int iLength, int grpIndex); - void SetSamplingRate(unsigned int _uiSampRate); -}; - - -#endif /* __AUDIO_IO_DSP_H__ */ - diff --git a/Src/vlb/bitbuffer.cpp b/Src/vlb/bitbuffer.cpp deleted file mode 100644 index 489678424..000000000 --- a/Src/vlb/bitbuffer.cpp +++ /dev/null @@ -1,599 +0,0 @@ -/* $Header: /cvs/root/winamp/vlb/bitbuffer.cpp,v 1.1 2009/04/28 20:21:08 audiodsp Exp $ */ - -/***************************************************************************\ - * - * Copyright 2000-2002 Dolby Laboratories, Inc. All Rights - * Reserved. Do not copy. Do not distribute. - * Confidential information. - * - * (C) copyright Fraunhofer - IIS (1998) - * All Rights Reserved - * - * filename: bitbuffer.cpp - * project : MPEG-2 AAC Decoder - * contents/description: memory input class with transport format - * -\***************************************************************************/ - -#include "bitbuffer.h" -#include "streaminfo.h" - -static const unsigned int Adts_Value_SyncWord = 0xFFF ; -static const unsigned int Adts_Value_SyncMSByte = 0xFF ; -static const unsigned int Adts_Value_MinHeaderLength = 56 ; - -static const unsigned int Adts_Length_SyncWord = 12 ; -static const unsigned int Adts_Length_Id = 1 ; -static const unsigned int Adts_Length_Layer = 2 ; -static const unsigned int Adts_Length_ProtectionAbsent = 1 ; -static const unsigned int Adts_Length_Profile = 2 ; -static const unsigned int Adts_Length_SamplingFrequencyIndex = 4 ; -static const unsigned int Adts_Length_PrivateBit = 1 ; -static const unsigned int Adts_Length_ChannelConfiguration = 3 ; -static const unsigned int Adts_Length_OriginalCopy = 1 ; -static const unsigned int Adts_Length_Home = 1 ; - -static const unsigned int Adts_Length_CopyrightIdentificationBit = 1 ; -static const unsigned int Adts_Length_CopyrightIdentificationStart = 1 ; -static const unsigned int Adts_Length_FrameLength = 13 ; -static const unsigned int Adts_Length_BufferFullness = 11 ; -static const unsigned int Adts_Length_NumberOfRawDataBlocksInFrame = 2 ; - -static const unsigned int Adts_Length_CrcCheck = 16 ; - -static char copyright_id[COPYRIGHT_SIZE]; -static char copyright_id_temp[COPYRIGHT_SIZE]; -static unsigned int cid_bitcount; -static unsigned int cid_bytecount; - -DECLARE_EXCEPTION(ECRCError, AAC_CRCERROR, "CRC calculation failed"); -DECLARE_EXCEPTION(EInputBufferError, AAC_INPUT_BUFFER_EMPTY, "No sync word found!"); -DECLARE_EXCEPTION(ESyncError, AAC_SYNCERROR, "Synchronization Error!") ; - -CDolbyBitBuffer::CDolbyBitBuffer () - : CDolbyBitStream () -{ - m_IsADTSCompliant=true; - - m_bFrameReadButNotDecoded = false; - - Initialize () ; -} - -CDolbyBitBuffer::~CDolbyBitBuffer() -{ -} - -void CDolbyBitBuffer::Initialize (void) -{ - m_ValidBits = 0 ; - m_ReadOffset = 0 ; - m_BitCnt = 0 ; - m_BitNdx = 0 ; - - m_EOF = false ; - - for (int i = 0 ; i < BufferSize ; i++) - { - m_Buffer [i] = 0 ; - } - - m_BlocksLeftInFrame = 0 ; - m_Markers = 0 ; - - m_FrameCrcValue = InvalidCrcValue ; - - cid_bitcount = BYTE_SIZE; // init copyright id bit counter - cid_bytecount = COPYRIGHT_SIZE; // inti copyright id byte counter - - buffer_fullness = 0; - last_buffer_fullness = 0; - last_frame_length = 0; - bytes_skipped = 0; - hold_bytes_skipped = false; - number_of_raw_data_blocks_in_frame = 0; -} - -long CDolbyBitBuffer::Get (int nBits) -{ - unsigned short tmp, tmp1 ; - - int nWordNdx = (m_BitNdx >> 4) << 1 ; - int nBitsAvail = 16 - (m_BitNdx & 15) ; - - tmp = m_Buffer [nWordNdx] ; - tmp <<= 8 ; - tmp |= m_Buffer [nWordNdx + 1] ; - tmp <<= (m_BitNdx & 15) ; - - if (nBits > nBitsAvail) - { - nWordNdx = (nWordNdx + 2) & (BufferSize - 1) ; - tmp1 = m_Buffer [nWordNdx] ; - tmp1 <<= 8 ; - tmp1 |= m_Buffer [nWordNdx + 1] ; - - tmp1 >>= (16 - (m_BitNdx & 15)) ; - tmp |= tmp1 ; - } - - tmp >>= (16 - nBits) ; - - m_BitNdx = (m_BitNdx+nBits) & (BufferBits - 1) ; - m_BitCnt += nBits ; - m_ValidBits -= nBits ; - - return tmp ; -} - -void CDolbyBitBuffer::PushBack (int n) -{ - m_BitCnt -= n ; - m_ValidBits += n ; - m_BitNdx = (m_BitNdx - n) & (BufferBits - 1) ; -} - -void CDolbyBitBuffer::ByteAlign (void) -{ - long alignment = m_BitCnt % 8 ; - - if (alignment) - { - Get (8 - alignment) ; - } - - m_BitCnt = 0 ; -} - -bool CDolbyBitBuffer::IsDecodableFrame (CStreamInfo &info) -{ - ByteAlign (); - - if (FrameReadButNotDecoded()) - { - ClearFrameReadButNotDecoded(); - return true; - } - -tryagain : - - SetPositionMarker (AncillaryElementStart) ; - bytes_skipped += GetBitCount() >> 3; - - if (m_ValidBits < Adts_Value_MinHeaderLength) - { - if (m_EOF) throw EEndOfFile () ; - else return false ; - } - - - /* Since the 1-bit ID must be 1 and the 2-bit layer must be 0, we can - * look for 15 bits of sync rather than just 12. We'll get 16 bits from the - * buffer and mask the top 15 bits for ease of readability. - */ - if ((Get(Adts_Length_SyncWord + 4) & 0xFFFE) != 0xFFF8) - { - PushBack (Adts_Length_SyncWord + 4) ; - - while (m_ValidBits >> 3) - { - if (Get (8) == Adts_Value_SyncMSByte) - { - PushBack (8) ; - - if ((Get(Adts_Length_SyncWord + 4) & 0xFFFE) == 0xFFF8) - { - PushBack (Adts_Length_SyncWord + 4) ; - goto tryagain ; - } - else - { - /* Push back 8 of the 16 bits we read. This will advance us by a byte. */ - PushBack (Adts_Length_SyncWord - 4); - } - } - } - - // syncword not found in BitBuffer so accumulate - // bytes skipped before throwing an error - bytes_skipped += GetBitCount() >> 3; - - // eaten up input - if (m_EOF) - { - throw EEndOfFile(); - } - else - { - throw EInputBufferError(); - } - } - - /* Push back the 4 extra bits we read beyond the 12-bit sync word. */ - PushBack(4); - - // adts_fixed_header - - id = Get (Adts_Length_Id) ; - layer = Get (Adts_Length_Layer) ; - protection_absent = Get (Adts_Length_ProtectionAbsent) ; - profile = Get (Adts_Length_Profile) ; - sampling_frequency_index = Get (Adts_Length_SamplingFrequencyIndex) ; - private_bit = Get (Adts_Length_PrivateBit) ; - channel_configuration = Get (Adts_Length_ChannelConfiguration) ; - original_copy = Get (Adts_Length_OriginalCopy) ; - home = Get (Adts_Length_Home) ; - - // adts_variable_header - - copyright_identification_bit = Get (Adts_Length_CopyrightIdentificationBit) ; - copyright_identification_start = Get (Adts_Length_CopyrightIdentificationStart) ; - frame_length = Get (Adts_Length_FrameLength) ; - buffer_fullness = Get (Adts_Length_BufferFullness) ; - number_of_raw_data_blocks_in_frame = Get (Adts_Length_NumberOfRawDataBlocksInFrame) ; - - unsigned int i; - - if ((m_ValidBits >> 3) < (frame_length - (Adts_Value_MinHeaderLength / 8))) - { - if (m_EOF) - throw EEndOfFile () ; - - PushBack (Adts_Value_MinHeaderLength) ; - return false ; - } - - SetPositionMarker (AncillaryElementStop) ; - - // adts_error_check - - if (!protection_absent) - { - m_FrameCrcValue = Get (Adts_Length_CrcCheck) ; - } - - if (layer != 0) - { - return false ; - } - - // // // - - ByteAlign () ; - - // // // Copy data from ADTS header to info structure - info.SetProtectionAbsent(protection_absent); - info.SetOriginalCopy(original_copy); - info.SetHome(home); - info.SetFrameLength(frame_length); - - // Assemble copyright ID - if (copyright_identification_start) - { - cid_bitcount = 0; - cid_bytecount = 0; - for (i=0; i= BYTE_SIZE) - { - cid_bitcount = 0; - cid_bytecount++; - } - } - else - { - // here, if counter overflow: delete copyright info - for (i=0; i> 3 ; - unsigned int header_length = 7 + (protection_absent ? 0 : 2) ; - nextsync += frame_length - header_length ; - nextsync %= BufferSize ; - - // this is the only place where we assume the bitstream to be - // aligned on byte boundaries (which is true for software), - // maybe someday we might want to remove this restriction. - - /* If a 'RIFF' header is detected (due to concatenated RIFF+ADTS files), look beyond it - * for the next ADTS sync. - */ - if (m_Buffer[nextsync] == 'R' && - m_Buffer[(nextsync + 1) % BufferSize] == 'I' && - m_Buffer[(nextsync + 2) % BufferSize] == 'F' && - m_Buffer[(nextsync + 3) % BufferSize] == 'F' - ) - { - bool bFoundDataChunk = true; - unsigned int uiMarker = nextsync; - - while (m_Buffer[nextsync] != 'd' || - m_Buffer[(nextsync + 1) % BufferSize] != 'a' || - m_Buffer[(nextsync + 2) % BufferSize] != 't' || - m_Buffer[(nextsync + 3) % BufferSize] != 'a' - ) - { - nextsync = (nextsync + 1) % BufferSize; - - if (nextsync == uiMarker) - { - /* We've gone all the way around our circular buffer without ever finding a 'data' chunk. */ - bFoundDataChunk = false; - break; - } - } - - if (bFoundDataChunk) - { - /* Skip over data chunk ID and length. The next bytes should be our ADTS sync word. */ - nextsync += 8; - nextsync %= BufferSize; - } - } - - if (m_Buffer[nextsync] == Adts_Value_SyncMSByte && (m_Buffer[(nextsync + 1) % BufferSize] & 0xFE) == 0xF8) - { - if (info.GetRawSamplingRate ()) - { - float flen = (float) (info.GetSamplesPerFrame () * (number_of_raw_data_blocks_in_frame + 1)) ; - float bitrate = (float) (8 * last_frame_length + 32 * (buffer_fullness - last_buffer_fullness)) ; - - m_ActualBitrate += (unsigned int) (bitrate / (flen / info.GetRawSamplingRate ())) ; - - last_buffer_fullness = buffer_fullness ; - last_frame_length = frame_length ; - - info.SetBitRate (m_ActualBitrate) ; - } - - info.SetSamplingRateIndex (sampling_frequency_index) ; - info.SetProfile (profile) ; - info.SetChannelConfig (channel_configuration) ; - - m_BlocksLeftInFrame = number_of_raw_data_blocks_in_frame ; - - return true ; - } - else - { - if (!m_EOF) - { - // syncword not found in next frame, but - // current frame's header has already been - // read, so add it to the # of bytes skipped - bytes_skipped += header_length; - - // hold on to the bytes skipped so that we can - // accumulate them across multiple calls to - // the function IsDecodableFrame - HoldBytesSkipped(); - - throw ESyncError(); - } - else - { - return true; - } - } -} - - -void CDolbyBitBuffer::ClearBytesSkipped(void) -{ - if (!hold_bytes_skipped) - { - bytes_skipped = 0; - } - else - { - // clear flag for next time around - hold_bytes_skipped = false; - } -} - - -void CDolbyBitBuffer::Feed (unsigned char pBuf [], unsigned int cbSize, unsigned int &cbValid) -{ - pBuf = &pBuf [cbSize - cbValid] ; - - unsigned int bTotal = 0 ; - - unsigned int bToRead = (BufferBits - m_ValidBits) >> 3 ; - unsigned int noOfBytes = (bToRead < cbValid) ? bToRead : cbValid ; - - while (noOfBytes > 0) - { - // split read to buffer size - - bToRead = BufferSize - m_ReadOffset ; - bToRead = (bToRead < noOfBytes) ? bToRead : noOfBytes ; - - // copy 'bToRead' bytes from 'ptr' to inputbuffer - - for (unsigned int i = 0 ; i < bToRead ; i++) - { - m_Buffer [m_ReadOffset + i] = pBuf [i] ; - } - - // add noOfBits to number of valid bits in buffer - - m_ValidBits += bToRead * 8 ; - bTotal += bToRead ; - pBuf += bToRead ; - - m_ReadOffset = (m_ReadOffset + bToRead) & (BufferSize - 1) ; - noOfBytes -= bToRead ; - } - - cbValid -= bTotal ; - - // invalidate crc markers - - m_FrameCrcValue = InvalidCrcValue ; - m_Markers = 0 ; -} - -// crc stuff - -void CDolbyBitBuffer::SetPositionMarker (MarkerPosition position) -{ - switch (position) - { - case SecondIndividualChannelStart : - - m_Markers++ ; - - case ChannelElementStart : - case AncillaryElementStart : - - m_MarkerList [m_Markers] = CMarker (position, m_ValidBits, m_BitCnt, m_BitNdx) ; - - break ; - - case ChannelElementStop : - case AncillaryElementStop : - - for (int i = 0 ; i < ((m_MarkerList [m_Markers].what == SecondIndividualChannelStart) ? 2 : 1) ; i++) - { - int delimiter = m_BitNdx + ((m_BitNdx > m_MarkerList [m_Markers - i].m_BitNdx) ? 0 : BufferBits) ; - m_MarkerList [m_Markers - i].m_elementBits = delimiter - m_MarkerList [m_Markers - i].m_BitNdx ; - } - - m_Markers++ ; - break ; - } -} - -void CDolbyBitBuffer::IsCrcConsistent (unsigned int *crcValue) -{ - if (m_FrameCrcValue == InvalidCrcValue) - return; - - CMarker current (CurrentPosition, m_ValidBits, m_BitCnt, m_BitNdx) ; - - *crcValue = 0xFFFF ; - - for (unsigned int i = 0 ; i < m_Markers ; i++) - { - RestoreMarker (m_MarkerList [i]) ; - - switch (m_MarkerList [i].what) - { - case ChannelElementStart : - - UpdateCrc (*crcValue, m_MarkerList [i].m_elementBits, 192) ; - break ; - - case SecondIndividualChannelStart : - - UpdateCrc (*crcValue, m_MarkerList [i].m_elementBits, 128) ; - break ; - - case AncillaryElementStart : - - UpdateCrc (*crcValue, m_MarkerList [i].m_elementBits) ; - break ; - } - } - - RestoreMarker (current) ; - - if (*crcValue != m_FrameCrcValue) - throw ECRCError(); - - return; -} - -void CDolbyBitBuffer::UpdateCrc (unsigned int &crcValue, int numberOfBits, int minimumBits) -{ - static const unsigned int HIGHBIT_MASK = 0x8000 ; - static const unsigned int CRC_POLY = 0x8005 ; - - static const unsigned int crcTable [] = - { - 0x0000, 0x8005, 0x800f, 0x000a, 0x801b, 0x001e, 0x0014, 0x8011, - 0x8033, 0x0036, 0x003c, 0x8039, 0x0028, 0x802d, 0x8027, 0x0022, - 0x8063, 0x0066, 0x006c, 0x8069, 0x0078, 0x807d, 0x8077, 0x0072, - 0x0050, 0x8055, 0x805f, 0x005a, 0x804b, 0x004e, 0x0044, 0x8041, - 0x80c3, 0x00c6, 0x00cc, 0x80c9, 0x00d8, 0x80dd, 0x80d7, 0x00d2, - 0x00f0, 0x80f5, 0x80ff, 0x00fa, 0x80eb, 0x00ee, 0x00e4, 0x80e1, - 0x00a0, 0x80a5, 0x80af, 0x00aa, 0x80bb, 0x00be, 0x00b4, 0x80b1, - 0x8093, 0x0096, 0x009c, 0x8099, 0x0088, 0x808d, 0x8087, 0x0082, - 0x8183, 0x0186, 0x018c, 0x8189, 0x0198, 0x819d, 0x8197, 0x0192, - 0x01b0, 0x81b5, 0x81bf, 0x01ba, 0x81ab, 0x01ae, 0x01a4, 0x81a1, - 0x01e0, 0x81e5, 0x81ef, 0x01ea, 0x81fb, 0x01fe, 0x01f4, 0x81f1, - 0x81d3, 0x01d6, 0x01dc, 0x81d9, 0x01c8, 0x81cd, 0x81c7, 0x01c2, - 0x0140, 0x8145, 0x814f, 0x014a, 0x815b, 0x015e, 0x0154, 0x8151, - 0x8173, 0x0176, 0x017c, 0x8179, 0x0168, 0x816d, 0x8167, 0x0162, - 0x8123, 0x0126, 0x012c, 0x8129, 0x0138, 0x813d, 0x8137, 0x0132, - 0x0110, 0x8115, 0x811f, 0x011a, 0x810b, 0x010e, 0x0104, 0x8101, - 0x8303, 0x0306, 0x030c, 0x8309, 0x0318, 0x831d, 0x8317, 0x0312, - 0x0330, 0x8335, 0x833f, 0x033a, 0x832b, 0x032e, 0x0324, 0x8321, - 0x0360, 0x8365, 0x836f, 0x036a, 0x837b, 0x037e, 0x0374, 0x8371, - 0x8353, 0x0356, 0x035c, 0x8359, 0x0348, 0x834d, 0x8347, 0x0342, - 0x03c0, 0x83c5, 0x83cf, 0x03ca, 0x83db, 0x03de, 0x03d4, 0x83d1, - 0x83f3, 0x03f6, 0x03fc, 0x83f9, 0x03e8, 0x83ed, 0x83e7, 0x03e2, - 0x83a3, 0x03a6, 0x03ac, 0x83a9, 0x03b8, 0x83bd, 0x83b7, 0x03b2, - 0x0390, 0x8395, 0x839f, 0x039a, 0x838b, 0x038e, 0x0384, 0x8381, - 0x0280, 0x8285, 0x828f, 0x028a, 0x829b, 0x029e, 0x0294, 0x8291, - 0x82b3, 0x02b6, 0x02bc, 0x82b9, 0x02a8, 0x82ad, 0x82a7, 0x02a2, - 0x82e3, 0x02e6, 0x02ec, 0x82e9, 0x02f8, 0x82fd, 0x82f7, 0x02f2, - 0x02d0, 0x82d5, 0x82df, 0x02da, 0x82cb, 0x02ce, 0x02c4, 0x82c1, - 0x8243, 0x0246, 0x024c, 0x8249, 0x0258, 0x825d, 0x8257, 0x0252, - 0x0270, 0x8275, 0x827f, 0x027a, 0x826b, 0x026e, 0x0264, 0x8261, - 0x0220, 0x8225, 0x822f, 0x022a, 0x823b, 0x023e, 0x0234, 0x8231, - 0x8213, 0x0216, 0x021c, 0x8219, 0x0208, 0x820d, 0x8207, 0x0202 - } ; - - if (minimumBits && (numberOfBits > minimumBits)) - numberOfBits = minimumBits ; - - for (int bytes = 0 ; bytes < (numberOfBits >> 3) ; bytes++) - { - crcValue = ((crcValue << 8) & 0xFF00) ^ crcTable [((crcValue >> 8) ^ Get (8)) & 0x00FF] ; - } - - for (int bits = 0 ; bits < (numberOfBits & 0x07) ; bits++) - { - int flag = ((crcValue & HIGHBIT_MASK) ? 1 : 0) ^ Get (1) ; - - crcValue <<= 1 ; - crcValue &= 0xFFFF ; - - if (flag) crcValue ^= CRC_POLY ; - } - - if (minimumBits && (minimumBits > numberOfBits)) - { - numberOfBits = minimumBits - numberOfBits ; - - for (int bytes = 0 ; bytes < (numberOfBits >> 3) ; bytes++) - { - crcValue = ((crcValue << 8) & 0xFF00) ^ crcTable [(crcValue >> 8) & 0x00FF] ; - } - - for (int bits = 0 ; bits < (numberOfBits & 0x07) ; bits++) - { - int flag = (crcValue & HIGHBIT_MASK) ? 1 : 0 ; - - crcValue <<= 1 ; - crcValue &= 0xFFFF ; - - if (flag) crcValue ^= CRC_POLY ; - } - } -} diff --git a/Src/vlb/bitbuffer.h b/Src/vlb/bitbuffer.h deleted file mode 100644 index feb443782..000000000 --- a/Src/vlb/bitbuffer.h +++ /dev/null @@ -1,292 +0,0 @@ -/* $Header: /cvs/root/winamp/vlb/bitbuffer.h,v 1.1 2009/04/28 20:21:08 audiodsp Exp $ */ - -/***************************************************************************\ - * - * Copyright 2000-2002 Dolby Laboratories, Inc. All Rights - * Reserved. Do not copy. Do not distribute. - * Confidential information. - * - * (C) copyright Fraunhofer - IIS (1998) - * All Rights Reserved - * - * filename: bitbuffer.h - * project : MPEG-2 AAC Decoder - * contents/description: memory input class with transport format - * -\***************************************************************************/ - -#ifndef __BITBUFFER_H__ -#define __BITBUFFER_H__ - -#include "bitstream.h" -#include "aacdecoderapi.h" - - -class CStreamInfo ; - -/** A Memory-Based Input Class. - - This class implements a memory-based \Ref{CDolbyBitStream} interface with an ADTS - transport layer. It performs basic detection and synchronization work. -*/ - -class CDolbyBitBuffer : public CDolbyBitStream -{ - -public : - - CDolbyBitBuffer () ; - virtual ~CDolbyBitBuffer () ; - - // implementation of the CDolbyBitStream interface - - virtual void ByteAlign (void) ; - virtual void PushBack (int n) ; - virtual long Get (int n) ; - - unsigned int GetBitState() {return m_ValidBits;} - virtual void DecrementBlocks() { m_BlocksLeftInFrame--;} - virtual void ResetBlocks() {m_BlocksLeftInFrame=0;} - virtual void SetPositionMarker (MarkerPosition position) ; - - /** Data Feed Method. - - This method feeds a number of input bytes from an external source into - the modulo bitbuffer that the decoder will read from. The call consumes - up to cbSize bytes from a given array pBuf. cbValid will be updated - to indicate the number of valid bytes left in pBuf. If cbValid - equals zero, all the data in the input array has been consumed and - the buffer should be refilled from the external source. - - @param pBuf Pointer to input buffer with bitstream data. - @param cbSize Total size of pBuf input buffer array. - @param cbValid Number of valid bytes left in pBuf array. - */ - - virtual void Feed (unsigned char pBuf [], unsigned int cbSize, unsigned int &cbValid) ; - - /** Bitstream Synchronization Method. - - Call this method to see if there is decodable data in this bitbuffer - object. Only ever let the decoder read a frame from this object if - the IsDecodableFrame() method returned true. In addition, this method - will fill in a \Ref{CStreamInfo} object on success to indicate the detected - bitstream parameters. - - @param info The configuration information. - */ - - bool IsDecodableFrame (CStreamInfo &info) ; - - - - /** CRC Evaluation Method. - - Call this method to see if the optional CRC error protection checksum - carried in the ADTS transport header matches the most recently decoded - audio frame. - - If error protection information is of concern, this method must be - called immediately after the decoder has read an entire audio frame - from this bitbuffer object. - */ - - void IsCrcConsistent (unsigned int *crcValue) ; - - /** EOF Notification Method. - - After being notified by this method, the bitbuffer will throw an - EEndOfFile exception the next time it runs out of data. - */ - - void SetEOF (void) - { - m_EOF = true ; - } - - bool EndOf(void) - { - return m_EOF; - } - - virtual void SetFrameReadButNotDecoded(void) - { - m_bFrameReadButNotDecoded = true; - } - - virtual void ClearFrameReadButNotDecoded(void) - { - m_bFrameReadButNotDecoded = false; - } - - virtual bool FrameReadButNotDecoded(void) - { - return m_bFrameReadButNotDecoded; - } - - virtual unsigned int GetBitCount(void) - { - return m_BitCnt; - } - - /** Initialization/Reset Method. - - Clears the buffer's internal memory and removes any possibly pending data. - */ - - virtual void Initialize (void) ; - - virtual unsigned int GetFrameLength(){return frame_length;} - virtual unsigned int GetNRDB(){return number_of_raw_data_blocks_in_frame;} - - long GetBytesSkipped(void) { return bytes_skipped; } - void ClearBytesSkipped(void); - void HoldBytesSkipped(void) { hold_bytes_skipped = true; } - -protected : - - enum - { - BufferSize = 8192, - BufferBits = BufferSize*8, - - InvalidCrcValue = 0xFFFFFFFF, - MaximumMarkers = 25*4 - } ; - - unsigned int m_ValidBits; - unsigned int m_ReadOffset; - unsigned int m_BitCnt; - unsigned int m_BitNdx; - - unsigned int m_BlocksLeftInFrame ; - unsigned int m_FrameCrcValue ; - - bool m_EOF ; - bool m_bFrameReadButNotDecoded; - - unsigned char m_Buffer [BufferSize] ; - - // adts_fixed_header - - unsigned int id; - unsigned int layer; - unsigned int protection_absent; - unsigned int profile; - unsigned int sampling_frequency_index; - unsigned int private_bit; - unsigned int channel_configuration; - unsigned int original_copy; - unsigned int home; - - // adts_variable_header - - unsigned int copyright_identification_bit; - unsigned int copyright_identification_start; - unsigned int frame_length; - unsigned int buffer_fullness; - unsigned int last_buffer_fullness; - unsigned int last_frame_length; - unsigned int number_of_raw_data_blocks_in_frame; - - // used to track # of bytes skipped - // during a re-synchronization - - long bytes_skipped; - bool hold_bytes_skipped; - - DECLARE_EXCEPTION(EUnimplemented, AAC_UNIMPLEMENTED, "Unimplemented Feature Used") ; - - // bitrate averaging helper class - - class CAverageNumber - { - enum - { - MaximumSize = 16 - } ; - - public : - - CAverageNumber () - { - m_Index = 0 ; - m_ActualCount=0; - for (int i = 0 ; i < MaximumSize ; i++) - m_Value [i] = 0 ; - } - - ~CAverageNumber () {} - - CAverageNumber &operator += (unsigned int val) - { - m_Value [m_Index++ % MaximumSize] = val ; - if(m_ActualCount // pow() - -#include "block.h" -#include "bitstream.h" -#include "channelinfo.h" - -CBlock::CBlock (CChannelInfo &info) - : m_IcsInfo (info) -{ - m_LongWindow [0] = m_OnlyLongWindowSine ; - m_ShortWindow [0] = m_OnlyShortWindowSine ; - -#ifdef ONLY_SINE_WINDOW - m_LongWindow [1] = m_OnlyLongWindowSine ; - m_ShortWindow [1] = m_OnlyShortWindowSine ; -#else - m_LongWindow [1] = m_OnlyLongWindowKBD ; - m_ShortWindow [1] = m_OnlyShortWindowKBD ; -#endif -} - -CBlock::~CBlock () -{ -} - -int CBlock::DecodeHuffmanWord (CDolbyBitStream &bs, const unsigned int (*CodeBook) [HuffmanEntries]) -{ - unsigned int val, len ; - unsigned int index = 0, bits = HuffmanBits ; - - while (true) - { - val = CodeBook [index][bs.Get (HuffmanBits)] ; - len = val >> 16 ; - - if (len == 0) - { - index = val & 0xFFFF ; - bits += HuffmanBits ; - continue ; - } - else - { - if (len != bits) - { - bs.PushBack (bits - len) ; - } - - val &= 0xFFFF ; - - break ; - } - } - - return val ; -} - -int CBlock::GetEscape (CDolbyBitStream &bs, const int q) -{ - int i, off, neg ; - - if (q < 0) - { - if (q != -16) return q ; - - neg = 1 ; - } - else - { - if (q != +16) return q ; - - neg = 0; - } - - for (i = 4 ; ; i++) - { - if (bs.Get (1) == 0) - break ; - } - - if (i > 16) - { - off = bs.Get (i - 16) << 16 ; - off |= bs.Get (16) ; - } - else - { - off = bs.Get (i) ; - } - - i = off + (1 << i) ; - - if (neg) i = -i ; - - return i ; -} - -int CBlock::UnpackIndex (int idx, int *qp, const CodeBookDescription *hcb) -{ - if (hcb->Dimension == 4) - { - int index = idx << 2 ; - - qp [0] = hcb->NTuples [index] ; - qp [1] = hcb->NTuples [index + 1] ; - qp [2] = hcb->NTuples [index + 2] ; - qp [3] = hcb->NTuples [index + 3] ; - } - else - { - int index = idx << 1 ; - - qp [0] = hcb->NTuples [index] ; - qp [1] = hcb->NTuples [index + 1] ; - } - - return hcb->Dimension ; -} - -float CBlock::InverseQuantize (int q) -{ - if (q > 0) - { - if (q < InverseQuantTableSize) - { - return (m_InverseQuantTable [q]) ; - } - else - { - return (static_cast(pow (static_cast(q), 4.0F / 3.0F))) ; - } - } - else - { - q = -q ; - - if (q < InverseQuantTableSize) - { - return (-m_InverseQuantTable [q]) ; - } - else - { - return (static_cast(-pow (static_cast(q), 4.0F / 3.0F))) ; - } - } -} - -void CBlock::Read (CDolbyBitStream &bs, const int global_gain) -{ - ReadSectionData (bs) ; - ReadScaleFactorData (bs, global_gain) ; - - m_PulseData.Read (bs) ; - m_Tns.Read (m_IcsInfo, bs) ; - - CVLBBitSequence GainControlDataPresent (1) ; - - GainControlDataPresent.Read (bs) ; - if (GainControlDataPresent) - { - throw EUnimplemented () ; - } - - ReadSpectralData (bs) ; -} - -void CBlock::ApplyTools (void) -{ - m_Tns.Apply (m_IcsInfo, *this) ; -} - -CBlock &operator+= (CBlock &lhs, CBlock &rhs) -{ - // operator+= sums up the spectral bins of two blocks - // in the frequency domain (must switch together) - - // add two long blocks - - if (lhs.m_IcsInfo.IsLongBlock () && rhs.m_IcsInfo.IsLongBlock ()) - { - if (lhs.m_IcsInfo.GetWindowShape () == rhs.m_IcsInfo.GetWindowShape ()) - { - for (int i = 0 ; i < CLongBlock::MaximumBins ; i++) - { - lhs.AccessSpectralData () [i] += rhs.AccessSpectralData () [i] ; - } - } - } - - // add two short blocks - - else if (lhs.m_IcsInfo.IsShortBlock () && rhs.m_IcsInfo.IsShortBlock ()) - { - if (lhs.m_IcsInfo.GetWindowShape () == rhs.m_IcsInfo.GetWindowShape ()) - { - for (int win = 0 ; win < CShortBlock::MaximumWindows ; win++) - { - for (int i = 0 ; i < CShortBlock::MaximumBins ; i++) - { - lhs.AccessSpectralData (win) [i] += rhs.AccessSpectralData (win) [i] ; - } - } - } - } - - return lhs ; -} diff --git a/Src/vlb/block.h b/Src/vlb/block.h deleted file mode 100644 index 3ba956d2f..000000000 --- a/Src/vlb/block.h +++ /dev/null @@ -1,343 +0,0 @@ -/* $Header: /cvs/root/winamp/vlb/block.h,v 1.2 2011/06/13 02:06:02 audiodsp Exp $ */ - -/***************************************************************************\ - * - * Copyright 2000-2002 Dolby Laboratories, Inc. All Rights - * Reserved. Do not copy. Do not distribute. - * Confidential information. - * - * (C) copyright Fraunhofer - IIS (1998) - * All Rights Reserved - * - * filename: block.h - * project : MPEG-2 AAC Decoder - * contents/description: Defines abstract base class CBlock - * - * $Header: /cvs/root/winamp/vlb/block.h,v 1.2 2011/06/13 02:06:02 audiodsp Exp $ - * -\***************************************************************************/ - -#ifndef __BLOCK_H__ -#define __BLOCK_H__ - -#include "exception.h" - -#include "pulsedata.h" -#include "tns.h" -#include "DolbyPayload.h" - -class CChannelInfo ; -class CDolbyBitStream ; -class COverlapAddBuffer ; - -#ifdef MAIN_PROFILE -class CPrediction ; -#endif - -/** Spectral Data For Current Frame. - - This abstract base class defines the interface and some common helper functions - for the classes holding the spectral coefficients of the current frame. -*/ - -class CBlock -{ - // allow tools to call AccessXXX() methods - - friend class CJointStereo ; - -#ifdef MAIN_PROFILE - friend class CPrediction ; -#endif - - friend class CTns ; - - friend class CCouplingChannel ; - - friend CBlock &operator+= (CBlock &, CBlock &) ; - -public : - - CBlock (CChannelInfo &) ; - virtual ~CBlock () ; - - void Read (CDolbyBitStream &bs, const int global_gain) ; - - virtual void ApplyTools (void) ; - - virtual void FrequencyToTime (COverlapAddBuffer &, float [], const int) = 0 ; - //MSV - virtual void FrequencyToTime_Fast (COverlapAddBuffer&) = 0 ; - virtual void FrequencyToTime (COverlapAddBuffer &) = 0; - virtual SECTION_INFORMATION_STRUCT* GetSectionInfo() = 0; - // gimmicks - - virtual void ApplyEqualizationMask (float Mask []) = 0 ; - - // // // - - enum - { - EqualizationMaskLength = 16, - - ZERO_HCB = 0, - ESCBOOK = 11, - NSPECBOOKS = ESCBOOK + 1, - BOOKSCL = NSPECBOOKS, - RESERVED_HCB = 13, - INTENSITY_HCB2 = 14, - INTENSITY_HCB = 15, - - InverseQuantTableSize = 1024, - ExpTableSize = 128, - - HuffmanBits = 4, - HuffmanEntries = (1 << HuffmanBits) - - } ; - - virtual float *AccessSpectralData (int window = 0) = 0 ; - virtual float *AccessOutput() =0; - virtual short *AccessShortOutput() =0; - short FloatToShort (float pcm) - { - if (pcm < 0.0F) - { - pcm = -pcm ; - pcm += 0.5F ; - - return (pcm > 32768.0F) ? -32768 : -((short) pcm) ; - } - else - { - pcm += 0.5F ; - - return (pcm > 32767.0F) ? 32767 : (short) pcm ; - } - } -protected : - - // overridable readers - - virtual void ReadSectionData (CDolbyBitStream &bs) = 0 ; - virtual void ReadScaleFactorData (CDolbyBitStream &bs, const int global_gain) = 0 ; - virtual void ReadSpectralData (CDolbyBitStream &bs) = 0 ; - - // tools interface - - - - virtual int *AccessCodeBooks (int group) = 0 ; - virtual int *AccessScaleFactors (int group) = 0 ; - - // - - CChannelInfo &m_IcsInfo ; - CPulseData m_PulseData ; - CTns m_Tns ; - - // Huffman Decoding - - typedef struct tagCodeBookDescription - { - int Dimension ; - bool IsSigned ; - const unsigned int (*CodeBook)[HuffmanEntries] ; - const int *NTuples ; - } CodeBookDescription ; - - int DecodeHuffmanWord (CDolbyBitStream &bs, const unsigned int (*CodeBook) [HuffmanEntries]) ; - int UnpackIndex (int idx, int *qp, const CodeBookDescription *hcb) ; - int GetEscape (CDolbyBitStream &bs, const int q) ; - - static const CodeBookDescription HuffmanCodeBooks [13] ; - - // - - float InverseQuantize (int q) ; - - int m_SectBits ; - - - - // window functions - - static const float m_OnlyLongWindowSine [1024] ; - static const float m_OnlyLongWindowKBD [1024] ; - - static const float m_OnlyShortWindowSine [128] ; - static const float m_OnlyShortWindowKBD [128] ; - - const float *m_LongWindow [2] ; - const float *m_ShortWindow [2] ; - - // imdct - - void Split (const float [], float [], float [], const float [], int) ; - void Merge (float [], const float [], const float [], int ) ; - - void Dct1024 (float vec [], const float cosTerms []) ; - void Dct128 (float vec [], const float cosTerms []) ; - void Dct16 (float vec [], const float cosTerms []) ; - - // speed-up tabes - - static const float m_InverseQuantTable [CBlock::InverseQuantTableSize] ; - static const float m_ExpTable [CBlock::ExpTableSize] ; - - // exceptions - - DECLARE_EXCEPTION(EInvalidCodeBook, AAC_INVALIDCODEBOOK, "Invalid Huffman Codebook") ; - DECLARE_EXCEPTION(EUnimplemented, AAC_UNIMPLEMENTED, "Unimplemented Feature Used") ; - - // platform dependent stuff - -#if defined (WIN32) && defined (_M_IX86) - -void PentiumOverlap (float output [], float spec [], float prev [], unsigned int stride); - -#endif - -} ; - -/** Spectral Data For One Long Block. - - This class holds the spectral coefficients for the current frame in case it's - a start block, a stop block or a regular long block. -*/ - -class CLongBlock : public CBlock -{ - friend CBlock &operator+= (CBlock &, CBlock &) ; - -public : - - CLongBlock (CChannelInfo &) ; - virtual ~CLongBlock () ; - - virtual void FrequencyToTime (COverlapAddBuffer &, float [], const int) ; - //MSV - virtual void FrequencyToTime_Fast (COverlapAddBuffer &) ; - virtual void FrequencyToTime (COverlapAddBuffer &); - // gimmicks - - virtual void ApplyEqualizationMask (float Mask []) ; - //MSV: - virtual SECTION_INFORMATION_STRUCT* GetSectionInfo(){return (&sSectionInfoStruct);} - - virtual float *AccessSpectralData (int window = 0) ; - virtual float *AccessOutput() {return m_Output;} - virtual short *AccessShortOutput() {return m_ShortOutput;} -private: - SECTION_INFORMATION_STRUCT sSectionInfoStruct; -protected : - - // overridden readers - - virtual void ReadSectionData (CDolbyBitStream &bs) ; - virtual void ReadScaleFactorData (CDolbyBitStream &bs, int const global_gain) ; - virtual void ReadSpectralData (CDolbyBitStream &bs) ; - - // tools interface - - - - virtual int *AccessCodeBooks (int group) ; - virtual int *AccessScaleFactors (int group) ; - int GetMaximumBins() { return MaximumBins; } ; - - // private - - void InverseTransform (float data []) ; - void ApplyWindowFunction (COverlapAddBuffer &Previous) ; - - enum - { - MaximumScaleFactorBands = 64, - MaximumBins = 1024 - } ; - - int m_CodeBook [CLongBlock::MaximumScaleFactorBands] ; - int m_ScaleFactor [CLongBlock::MaximumScaleFactorBands] ; - - float m_SpectralCoefficient [2 * CLongBlock::MaximumBins] ; - float m_Output[1024]; - short m_ShortOutput[1024]; - // platform dependent stuff - -#if defined (WIN32) && defined (_M_IX86) - - void PentiumWindow (float spec [], const float prev [], const float curr []) ; - -#endif - -} ; - -/** Spectral Data For One Short Block. - - This class holds the spectral coefficients for the current frame in case it's - a short block, i.e. consists of eight short windows. -*/ - -class CShortBlock : public CBlock -{ - friend CBlock &operator+= (CBlock &, CBlock &) ; - -public : - - CShortBlock (CChannelInfo &) ; - virtual ~CShortBlock () ; - - virtual void FrequencyToTime (COverlapAddBuffer &, float [], const int) ; - //MSV - virtual void FrequencyToTime_Fast (COverlapAddBuffer &) ; - virtual void FrequencyToTime (COverlapAddBuffer &); - // gimmicks - - virtual void ApplyEqualizationMask (float Mask []) ; - virtual float *AccessSpectralData (int window = 0) ; - virtual float *AccessOutput() {return m_Output;} - virtual short *AccessShortOutput() {return m_ShortOutput;} - virtual SECTION_INFORMATION_STRUCT* GetSectionInfo(){return (&sSectionInfoStruct);} -private: - SECTION_INFORMATION_STRUCT sSectionInfoStruct; -protected : - - // overridden readers - - virtual void ReadSectionData (CDolbyBitStream &bs) ; - virtual void ReadScaleFactorData (CDolbyBitStream &bs, const int global_gain) ; - virtual void ReadSpectralData (CDolbyBitStream &bs) ; - - // tools interface - - - - virtual int *AccessCodeBooks (int group) ; - virtual int *AccessScaleFactors (int group) ; - - // private - - void InverseTransform (float data []) ; - void TransformWindows (COverlapAddBuffer &Previous, float EightWindowsBuffer []) ; - - // - - enum - { - MaximumWindows = 8, - MaximumGroups = MaximumWindows, - - MaximumScaleFactorBands = 16, - MaximumBins = 128 - } ; - - int m_CodeBook [CShortBlock::MaximumGroups][CShortBlock::MaximumScaleFactorBands] ; - int m_ScaleFactor [CShortBlock::MaximumGroups][CShortBlock::MaximumScaleFactorBands] ; - - float m_SpectralCoefficient [CShortBlock::MaximumWindows][2 * CShortBlock::MaximumBins] ; - float m_Output[1024]; - short m_ShortOutput[1024]; -} ; - -#endif diff --git a/Src/vlb/channel.cpp b/Src/vlb/channel.cpp deleted file mode 100644 index b5e566e4a..000000000 --- a/Src/vlb/channel.cpp +++ /dev/null @@ -1,843 +0,0 @@ -/* $Header: /cvs/root/winamp/vlb/channel.cpp,v 1.1 2009/04/28 20:21:08 audiodsp Exp $ */ - -/***************************************************************************\ - * - * Copyright 2000-2002 Dolby Laboratories, Inc. All Rights - * Reserved. Do not copy. Do not distribute. - * Confidential information. - * - * (C) copyright Fraunhofer - IIS (1998) - * All Rights Reserved - * - * filename: channel.cpp - * project : MPEG-2 AAC Decoder - * contents/description: independent channel stream object - * -\***************************************************************************/ - -#include // displacement new - -#include "channel.h" -#include "bitstream.h" -#include "bitsequence.h" - -// // // Base class for CSingleChannel, CChannelPair - -CChannelElement::CChannelElement (CDolbyBitStream &bs) - : m_bs (bs), - m_GlobalGain (8) -{ - m_WantEqualizer = false ; - m_WantSpectralData = false ; -} - -CChannelElement::~CChannelElement () -{} - -CBlock *CChannelElement::ReadICS (CChannelInfo &ics_info, unsigned long *memory) -{ - // allocates and reads one individual_channel_stream - - m_GlobalGain.Read (m_bs) ; - - if (!ics_info.IsValid ()) - { - ics_info.Read (m_bs) ; - } - - CBlock *block ; - - if (ics_info.IsLongBlock ()) - { - block = new (static_cast(memory)) CLongBlock (ics_info) ; - } - else - { - block = new (static_cast(memory)) CShortBlock (ics_info) ; - } - - block->Read (m_bs, m_GlobalGain) ; - - // 'block' points to the same location as 'memory', but keeping the - // m_Block pointers as class members saves us a lot of typecasting - - return block ; -} - -void CChannelElement::SetEqualization (bool wantEQ, float Mask []) -{ - m_WantEqualizer = wantEQ ; - - if (wantEQ) - { - for (int i = 0 ; i < CBlock::EqualizationMaskLength ; i++) - { - m_EqualizerMask [i] = Mask [i] ; - } - } -} - -// // // CSingleChannel wraps single_channel_element() - -CSingleChannel::CSingleChannel (CDolbyBitStream &theBitstream) - : CChannelElement (theBitstream) -{ - -#ifdef MAIN_PROFILE - m_Prediction.FullReset () ; -#endif - - poIMDCTObject=new IMDCTObject(4096,256); - poNormalIMDCTObject=new IMDCTObject(2048,128); - ppfData=new float*[1]; - ppshData=new short*[1]; - - m_poAudioDSP = new AudioIODSP(1); -} - -CSingleChannel::~CSingleChannel () -{ - delete poIMDCTObject; - delete poNormalIMDCTObject; - delete[] ppfData; - delete[] ppshData; - delete m_poAudioDSP; -} - -void CSingleChannel::Read (const CStreamInfo &si) -{ - m_IcsInfo.Reset (si) ; - - m_Block = ReadICS (m_IcsInfo, m_BlockMemory) ; -} - -void CSingleChannel::Decode (AudioIOControl *poAudioIO, CStreamInfo &info, int stride /* = 1 */) -{ - - if (m_IcsInfo.IsMainProfile ()) - { -#ifdef MAIN_PROFILE - m_Prediction.Apply (m_IcsInfo, *m_Block) ; -#else - throw EIllegalProfile(); -#endif - } - - - m_Block->ApplyTools () ; - - if (m_WantEqualizer) - { - m_Block->ApplyEqualizationMask (m_EqualizerMask) ; - } - m_Block->FrequencyToTime_Fast (m_Previous) ; - ppfData[0]=m_Block->AccessOutput(); - - // ApplyLimiter is called to minimize distortion from clipping. The limiter can only - // be applied to 128 samples at a time so there must be several calls to limit all 1024 - // samples in a block. This is due to the way the buffer allocation is done in the - // constructor of the AudioIODSP class. - int iLength = 1024; - int grpIndex = 0; - short sThisLength = (iLength < DLYBUFSZ) ? iLength : DLYBUFSZ; - - m_poAudioDSP->SetSamplingRate(info.GetSamplingRate()); - for (int sSamp = 0; sSamp < iLength; sSamp += sThisLength) - { - m_poAudioDSP->ApplyLimiter(ppfData, sThisLength, grpIndex); - sThisLength = ((iLength - sThisLength * grpIndex++) < DLYBUFSZ) ? - (iLength - sThisLength * grpIndex++) : DLYBUFSZ; - } - poAudioIO->IO(ppfData,1024); - m_Block->~CBlock () ; -} - -void CSingleChannel::DecodeDolby ( AudioIOControl *poAudioIO, - DOLBY_PAYLOAD_STRUCT *psDSEInfo, - CStreamInfo &info, - int stride /* = 1 */) -{ - int iWindowType; - int iWindowShape; - int i,j,grp_index,win_in_grp_index; - int startingBinForThisWindow, startingBaseBandBin, halfWindowLength; - int overall_window_number1, overall_window_number2; - int firstWinThisGrp; - float avgCopyEnergies[8][SE_MAX_NUM_BANDS]; - int iBandCounter; - - // previous window sequence - // need to keep this variable around to handle legacy code which forces - // spectral extend to rely on a special case for WindowSequence == 3 - - static int previousWindowSequence = 0; - - // get pointer to spectral data - // these calls really need to depend on the blocktype - - // short blocks require the window number (0-7) to be passed - // to AccessSpectralData(); long blocks do not require this argument. - - ppfData[0]=m_Block->AccessSpectralData(); - - // Apply DNS here. - // Only apply DNS if we have valid DNS information read from the SE bitstream. - // If there was a SE bitstream reading error of *any* kind, do not apply DNS. - - if (psDSEInfo->iDolbyBitStreamWarning == 0) - { - // applyDNS() applies to all window groups at the same time, so there is - // no need to call applyDNS() for each window group individually. - applyDNS(ppfData[0],&psDSEInfo->asDNSInfoStruct[0],previousWindowSequence); - } - -#ifdef MAIN_PROFILE - if (m_IcsInfo.IsMainProfile ()) - { - m_Prediction.Apply (m_IcsInfo, *m_Block) ; - } -#endif - - iWindowType=m_IcsInfo.GetWindowSequence(); - iWindowShape=m_IcsInfo.GetWindowShape(); - - //Do TNS: - m_Block->ApplyTools () ; - - // Spectral Extension. - - // for each window group... - overall_window_number1 = 0; - overall_window_number2 = 0; - - for(grp_index=0;grp_indexiGroupCount[0];grp_index++) - { - firstWinThisGrp = overall_window_number1; - - // for each window within the current window group... - for(win_in_grp_index=0; - win_in_grp_indexiGroupLength[0][grp_index]; - win_in_grp_index++,overall_window_number1++) - { - - // compute some parameters depedent on short/long blocktype, window group number, and transform length - if (psDSEInfo->asDNSInfoStruct[0].iWindowSequence == 2) - { - // SHORT BLOCKS - startingBinForThisWindow = overall_window_number1*256; - startingBaseBandBin = 12; - halfWindowLength = (psDSEInfo->iUsesDoubleLengthXForm) ? 256 : 128; - } - else - { - // LONG, STOP, START blocks - startingBinForThisWindow = 0; -#ifdef NEW_BUFFER_MODEL - startingBaseBandBin = 96; -#else - startingBaseBandBin = 100; -#endif - halfWindowLength = (psDSEInfo->iUsesDoubleLengthXForm) ? 2048 : 1024; - } - - computeAvgCopyEnergies(&ppfData[0][startingBinForThisWindow], - startingBaseBandBin, - psDSEInfo->aiCopyStop[0], - psDSEInfo->num_se_bands[0], - psDSEInfo->seBands[0][grp_index], - halfWindowLength, - psDSEInfo->asDNSInfoStruct[0].iWindowSequence, - avgCopyEnergies[overall_window_number1]); - }/* win_in_grp_index */ - - /* compute average energies for each group before passing into spectral extend */ - // accumulate energies for this group - - for(win_in_grp_index=1; - win_in_grp_indexiGroupLength[0][grp_index]; - win_in_grp_index++) - { - for(iBandCounter=0;iBandCounternum_se_bands[0];iBandCounter++) - { - avgCopyEnergies[firstWinThisGrp][iBandCounter] += avgCopyEnergies[firstWinThisGrp + win_in_grp_index][iBandCounter]; - } - } - - // find the average energy for this group - for(iBandCounter=0;iBandCounternum_se_bands[0];iBandCounter++) - { - avgCopyEnergies[firstWinThisGrp][iBandCounter] /= psDSEInfo->iGroupLength[0][grp_index]; - } - - // copy this average energy to all values in the avgCopyEnergies array which correspond to windows in the current group - for(win_in_grp_index=1; - win_in_grp_indexiGroupLength[0][grp_index]; - win_in_grp_index++) - { - for(iBandCounter=0;iBandCounternum_se_bands[0];iBandCounter++) - { - avgCopyEnergies[firstWinThisGrp + win_in_grp_index][iBandCounter] = avgCopyEnergies[firstWinThisGrp][iBandCounter]; - } - } - - // for each window within the current window group... - for (win_in_grp_index=0; - win_in_grp_indexiGroupLength[0][grp_index]; - win_in_grp_index++,overall_window_number2++) - { - firstWinThisGrp = overall_window_number2; - - // check to see if dolby bitstream was read correctly. - // If so, spectral extend all windows, whether we're dealing with a long block or short block - if (psDSEInfo->iDolbyBitStreamWarning == 0) - { - // compute some parameters dependent short/long blocktype, window group number, and transform length - if (psDSEInfo->asDNSInfoStruct[0].iWindowSequence == 2) - { - // SHORT blocks - // The constant 256 is ugly here - but is equal to (2 * CShortBlock::MaximumBins). - // This is the spacing of the mdct coefficients in the buffer ppfData[n], independent - // of whether we're using a single or double length transform. - startingBinForThisWindow = overall_window_number2*256; - startingBaseBandBin = 12; - halfWindowLength = (psDSEInfo->iUsesDoubleLengthXForm) ? 256 : 128; - } - else - { - // LONG, STOP, START blocks - startingBinForThisWindow = 0; -#ifdef NEW_BUFFER_MODEL - startingBaseBandBin = 96; -#else - startingBaseBandBin = 100; -#endif - halfWindowLength = (psDSEInfo->iUsesDoubleLengthXForm) ? 2048 : 1024; - } - - spectralExtend(&ppfData[0][startingBinForThisWindow], - startingBaseBandBin, - psDSEInfo->aiCopyStop[0], - psDSEInfo->sfm[0][grp_index], - psDSEInfo->num_se_bands[0], - psDSEInfo->seBands[0][grp_index], - psDSEInfo->delta_power_values[0][grp_index], - psDSEInfo->fdamp[0][grp_index], - halfWindowLength, - psDSEInfo->asDNSInfoStruct[0].iWindowSequence, - psDSEInfo->iSEPowerResolution, - previousWindowSequence, - avgCopyEnergies[overall_window_number2]); - - } - else - { - // zero out the extension band of each window if there was a bitstream error. - // be careful here- we may be dealing with many short blocks or a single long block - - if (psDSEInfo->asDNSInfoStruct[0].iWindowSequence == 2) - { - // SHORT blocks - for(i=0;i<8;i++) { - for(j=psDSEInfo->aiCopyStop[0]; j<256; j++) - { - ppfData[0][i*256+j]=0.0f; - } - } - } - else - { - // LONG, STOP, START blocks - for (i = psDSEInfo->aiCopyStop[0]; i<2048; i++) - { - ppfData[0][i] = 0.0f; - } - } - - } // if psDSEInfo->iDolbyBitStreamWarning... - - } // for win_in_grp_index - - } // for grp_index - - /* Double all TCs if using a double length x-form so we do not lose 6dB - * after the imdct. - */ - - if (psDSEInfo->iUsesDoubleLengthXForm) - { - for (i = 0; i < 2048; i++) - { - ppfData[0][i] *= 2.0f; - } - } - - // do the transform - if (psDSEInfo->iUsesDoubleLengthXForm) - { - poIMDCTObject->Transform(ppfData[0],iWindowType,iWindowShape); - - // The limiter can only be applied to 128 samples at a time - // so there must be several calls to limit all 2048 samples - // in a block. This is due to the way the buffer allocation - // is done in the constructor of the AudioIODSP class - int iLength = 2048; - int grpIndex = 0; - int sThisLength = (iLength < DLYBUFSZ) ? iLength : DLYBUFSZ; - - m_poAudioDSP->SetSamplingRate(info.GetSamplingRate()); - for (int sSamp = 0; sSamp < iLength; sSamp += sThisLength) - { - // Limiter is applied to ppfData - m_poAudioDSP->ApplyLimiter(ppfData, sThisLength, grpIndex); - sThisLength = ((iLength - sThisLength * grpIndex++) < DLYBUFSZ) ? - (iLength - sThisLength * grpIndex++) : DLYBUFSZ; - } - - poAudioIO->IO(ppfData,2048); - } - else - { - poNormalIMDCTObject->Transform(ppfData[0],iWindowType,iWindowShape); - - // Apply Limiter so that distortion from clipping is minimized - - // The limiter can only be applied to 128 samples at a time - // so there must be several calls to limit all 2048 samples - // in a block. This is due to the way the buffer allocation - // is done in the constructor of the AudioIODSP class - int iLength = 1024; - int grpIndex = 0; - short sThisLength = (iLength < DLYBUFSZ) ? iLength : DLYBUFSZ; - - m_poAudioDSP->SetSamplingRate(info.GetSamplingRate()); - for (int sSamp = 0; sSamp < iLength; sSamp += sThisLength) - { - // Limiter is applied to ppfData - m_poAudioDSP->ApplyLimiter(ppfData, sThisLength, grpIndex); - sThisLength = ((iLength - sThisLength * grpIndex++) < DLYBUFSZ) ? - (iLength - sThisLength * grpIndex++) : DLYBUFSZ; - } - - poAudioIO->IO(ppfData,1024); - } - - // update previousWindowSequence - previousWindowSequence = psDSEInfo->asDNSInfoStruct[0].iWindowSequence; - - m_Block->~CBlock () ; -} - -// // // CChannelPair wraps channel_pair_element() - -CChannelPair::CChannelPair (CDolbyBitStream &theBitstream) - : CChannelElement (theBitstream), - m_CommonWindow (1) -{ - -#ifdef MAIN_PROFILE - m_Prediction [L].FullReset () ; - m_Prediction [R].FullReset () ; -#endif - - ppoIMDCTObject = new IMDCTObject* [2]; - ppoNormalIMDCTObject = new IMDCTObject* [2]; - - for (int n = 0; n < 2; n++) - { - ppoIMDCTObject[n] = new IMDCTObject(4096,256); - ppoNormalIMDCTObject[n] = new IMDCTObject(2048,128); - } - - ppfData = new float*[2]; - ppshData = new short*[2]; - - m_poAudioDSP = new AudioIODSP(2); -} - -CChannelPair::~CChannelPair () -{ - for (int n = 0; n < 2; n++) - { - delete ppoIMDCTObject[n]; - delete ppoNormalIMDCTObject[n]; - } - delete[] ppoIMDCTObject; - delete[] ppoNormalIMDCTObject; - - delete[] ppfData; - delete[] ppshData; - delete m_poAudioDSP; -} - -void CChannelPair::Read (const CStreamInfo &si) -{ - m_IcsInfo [L].Reset (si) ; - m_IcsInfo [R].Reset (si) ; - - if (m_CommonWindow.Read (m_bs)) - { - m_IcsInfo [L].Read (m_bs) ; - m_IcsInfo [R] = m_IcsInfo [L] ; - - m_JointStereo.Read (m_IcsInfo [L], m_bs) ; - } - - m_Block [L] = ReadICS (m_IcsInfo [L], m_BlockMemory [L]) ; - m_bs.SetPositionMarker (CDolbyBitStream::SecondIndividualChannelStart) ; - m_Block [R] = ReadICS (m_IcsInfo [R], m_BlockMemory [R]) ; -} - -void CChannelPair::Decode (AudioIOControl *poAudioIO, CStreamInfo &info, int stride /* = 1 */) -{ - -#ifdef MAIN_PROFILE - // - apply prediction tool to left (coded) channel - // - calculate right channel from intensity position - // - apply prediction tool to right channel - - // unfortunately this breaks m_JointStereo::Apply() into two steps -#endif - - if (m_CommonWindow) - { - m_JointStereo.ApplyMS (m_IcsInfo [L], *m_Block [L], *m_Block [R]) ; - } - -#ifdef MAIN_PROFILE - if (m_IcsInfo [L].IsMainProfile ()) - { - m_Prediction [L].Apply (m_IcsInfo [L], *m_Block [L]) ; - } -#endif - - if (m_CommonWindow) - { - m_JointStereo.ApplyIS (m_IcsInfo [L], *m_Block [L], *m_Block [R]) ; - } - -#ifdef MAIN_PROFILE - if (m_IcsInfo [R].IsMainProfile ()) - { - m_Prediction [R].Apply (m_IcsInfo [R], *m_Block [R]) ; - } -#endif - - for (int channel = 0 ; channel < Channels ; channel++) - { - m_Block [channel]->ApplyTools () ; - - if (m_WantEqualizer) - { - m_Block [channel]->ApplyEqualizationMask (m_EqualizerMask) ; - } - m_Block [channel]->FrequencyToTime_Fast (m_Previous [channel]) ; - ppfData[channel]=m_Block[channel]->AccessOutput(); - } - - // ApplyLimiter is called to minimize distortion from clipping. The limiter can only - // be applied to 128 samples at a time so there must be several calls to limit all - // samples in a block. This is due to the way the buffer allocation is done in the - // constructor of the AudioIODSP class.0 - int iLength = 1024; - int grpIndex = 0; - int sThisLength = (iLength < DLYBUFSZ) ? iLength : DLYBUFSZ; - - m_poAudioDSP->SetSamplingRate(info.GetSamplingRate()); - for (int sSamp = 0; sSamp < iLength; sSamp += sThisLength) - { - m_poAudioDSP->ApplyLimiter(ppfData, sThisLength, grpIndex); - sThisLength = ((iLength - sThisLength * grpIndex++) < DLYBUFSZ) ? - (iLength - sThisLength * grpIndex++) : DLYBUFSZ; - } - poAudioIO->IO(ppfData,1024); - m_Block [L]->~CBlock () ; - m_Block [R]->~CBlock () ; -} - -void CChannelPair::DecodeDolby (AudioIOControl *poAudioIO, - DOLBY_PAYLOAD_STRUCT *psDSEInfo, - CStreamInfo &info, - int stride /* = 1 */) -{ - int channel, win_in_grp_index; - int iWindowType; - int iWindowShape; - int i,j,grp_index; - - int startingBinForThisWindow; - int startingBaseBandBin; - int halfWindowLength; - int overall_window_number1, overall_window_number2; - float avgCopyEnergies[8][SE_MAX_NUM_BANDS]; - int iBandCounter; - int firstWinThisGrp; - - // need to keep this variable around to handle legacy code which forces - // spectral extend to rely on a special case for WindowSequence == 3 - - static int previousWindowSequence[2] = {0,0}; - - // apply DNS to each channel - // these calls really need to depend on the blocktype - - // short blocks require the window number (0-7) to be passed - // to AccessSpectralData(); long blocks do not require this argument. - ppfData[L]=m_Block[L]->AccessSpectralData(); - ppfData[R]=m_Block[R]->AccessSpectralData(); - - // Apply DNS here - // Only apply DNS if we have valid DNS information read from the SE bitstream. - // If there was a SE bitstream reading error of *any* kind, do not apply DNS - - - if (psDSEInfo->iDolbyBitStreamWarning == 0) - { - // applyDNS() applies to all window groups at the same time, so there is - // no need to call applyDNS() for each window group individually. - applyDNS(ppfData[L],&psDSEInfo->asDNSInfoStruct[L],previousWindowSequence[L]); - applyDNS(ppfData[R],&psDSEInfo->asDNSInfoStruct[R],previousWindowSequence[R]); - } - - -#ifdef MAIN_PROFILE - // - apply prediction tool to left (coded) channel - // - calculate right channel from intensity position - // - apply prediction tool to right channel - - // unfortunately this breaks m_JointStereo::Apply() into two steps -#endif - - if (m_CommonWindow) - { - m_JointStereo.ApplyMS (m_IcsInfo [L], *m_Block [L], *m_Block [R]) ; - } - -#ifdef MAIN_PROFILE - if (m_IcsInfo [L].IsMainProfile ()) - { - m_Prediction [L].Apply (m_IcsInfo [L], *m_Block [L]) ; - } -#endif - - if (m_CommonWindow) - { - m_JointStereo.ApplyIS (m_IcsInfo [L], *m_Block [L], *m_Block [R]) ; - } - -#ifdef MAIN_PROFILE - if (m_IcsInfo [R].IsMainProfile ()) - { - m_Prediction [R].Apply (m_IcsInfo [R], *m_Block [R]) ; - } -#endif - - for (channel = 0 ; channel < Channels ; channel++) - { - iWindowType=m_IcsInfo[channel].GetWindowSequence(); - iWindowShape=m_IcsInfo[channel].GetWindowShape(); - ppfData[channel]=m_Block[channel]->AccessSpectralData(); - - // Apply TNS - m_Block [channel]->ApplyTools () ; - - // Spectral Extension for Stereo Goes Here! - - // for each window group... - overall_window_number1 = 0; - overall_window_number2 = 0; - - for (grp_index=0;grp_indexiGroupCount[channel];grp_index++) - { - firstWinThisGrp = overall_window_number1; - - // another window_in_group loop: compute average energy in this group for all bands in the current group - for (win_in_grp_index=0; - win_in_grp_indexiGroupLength[channel][grp_index]; - win_in_grp_index++,overall_window_number1++) - { - - // compute some parameters dependent short/long blocktype, window group number, and transform length - if (psDSEInfo->asDNSInfoStruct[channel].iWindowSequence == 2) - { - // SHORT blocks - // The constant 256 is ugly here - but is equal to (2 * CShortBlock::MaximumBins). - // This is the spacing of the mdct coefficients in the buffer ppfData[n], independent - // of whether we're using a single or double length transform. - startingBinForThisWindow = overall_window_number1*256; - startingBaseBandBin = 12; - halfWindowLength = (psDSEInfo->iUsesDoubleLengthXForm) ? 256 : 128; - } - else - { - // LONG, STOP, START blocks - startingBinForThisWindow = 0; -#ifdef NEW_BUFFER_MODEL - startingBaseBandBin = 96; -#else - startingBaseBandBin = 100; -#endif - halfWindowLength = (psDSEInfo->iUsesDoubleLengthXForm) ? 2048 : 1024; - } - - computeAvgCopyEnergies(&ppfData[channel][startingBinForThisWindow], - startingBaseBandBin, - psDSEInfo->aiCopyStop[channel], - psDSEInfo->num_se_bands[channel], - psDSEInfo->seBands[channel][grp_index], - halfWindowLength, - psDSEInfo->asDNSInfoStruct[channel].iWindowSequence, - avgCopyEnergies[overall_window_number1]); - - } /* win_in_grp_index */ - - /* compute average energies for each group before passing into spectral extend */ - // accumulate energies for this group - - for(win_in_grp_index=1; - win_in_grp_indexiGroupLength[channel][grp_index]; - win_in_grp_index++) - { - for(iBandCounter=0;iBandCounternum_se_bands[channel];iBandCounter++) - { - avgCopyEnergies[firstWinThisGrp][iBandCounter] += avgCopyEnergies[firstWinThisGrp + win_in_grp_index][iBandCounter]; - } - } - - // find the average energy for this group - for(iBandCounter=0;iBandCounternum_se_bands[channel];iBandCounter++) - { - avgCopyEnergies[firstWinThisGrp][iBandCounter] /= psDSEInfo->iGroupLength[channel][grp_index]; - } - - // copy this average energy to all values in the avgCopyEnergies array which correspond to windows in the current group - for(win_in_grp_index=1; - win_in_grp_indexiGroupLength[channel][grp_index]; - win_in_grp_index++) - { - for(iBandCounter=0;iBandCounternum_se_bands[channel];iBandCounter++) - { - avgCopyEnergies[firstWinThisGrp + win_in_grp_index][iBandCounter] = avgCopyEnergies[firstWinThisGrp][iBandCounter]; - } - } - - // for each window within the current window group... - for (win_in_grp_index=0; - win_in_grp_indexiGroupLength[channel][grp_index]; - win_in_grp_index++,overall_window_number2++) - { - firstWinThisGrp = overall_window_number2; - - // check to see if dolby bitstream was read correctly. - // If so, spectral extend all windows, whether we're dealing with a long block or short block - if (psDSEInfo->iDolbyBitStreamWarning == 0) - { - // compute some parameters dependent short/long blocktype, window group number, and transform length - if (psDSEInfo->asDNSInfoStruct[channel].iWindowSequence == 2) - { - // SHORT blocks - // The constant 256 is ugly here - but is equal to (2 * CShortBlock::MaximumBins). - // This is the spacing of the mdct coefficients in the buffer ppfData[n], independent - // of whether we're using a single or double length transform. - startingBinForThisWindow = overall_window_number2*256; - startingBaseBandBin = 12; - halfWindowLength = (psDSEInfo->iUsesDoubleLengthXForm) ? 256 : 128; - } - else - { - // LONG, STOP, START blocks - startingBinForThisWindow = 0; -#ifdef NEW_BUFFER_MODEL - startingBaseBandBin = 96; -#else - startingBaseBandBin = 100; -#endif - halfWindowLength = (psDSEInfo->iUsesDoubleLengthXForm) ? 2048 : 1024; - } - - spectralExtend (&ppfData[channel][startingBinForThisWindow], - startingBaseBandBin, - psDSEInfo->aiCopyStop[channel], - psDSEInfo->sfm[channel][grp_index], - psDSEInfo->num_se_bands[channel], - psDSEInfo->seBands[channel][grp_index], - psDSEInfo->delta_power_values[channel][grp_index], - psDSEInfo->fdamp[channel][grp_index], - halfWindowLength, - psDSEInfo->asDNSInfoStruct[channel].iWindowSequence, - psDSEInfo->iSEPowerResolution, - previousWindowSequence[channel], - avgCopyEnergies[overall_window_number2]); - - } - else - { - // zero out the extension band of each window if there was a bitstream error. - // be careful here- we may be dealing with many short blocks or a single long block - - if (psDSEInfo->asDNSInfoStruct[channel].iWindowSequence == 2) - { - // SHORT blocks - for(i=0;i<8;i++) { - for(j=psDSEInfo->aiCopyStop[channel]; j<256; j++) - { - ppfData[channel][i*256+j]=0.0f; - } - } - } - else - { - // LONG, STOP, START blocks - for (i = psDSEInfo->aiCopyStop[channel]; i<2048; i++) - { - ppfData[channel][i] = 0.0f; - } - } - - } // if psDSEInfo->iDolbyBitStreamWarning... - - } // for win_in_grp_index... - - } // for grp_index... - - /* Double all TCs if using a double length x-form so we do not lose 6dB - * after the imdct. - */ - if (psDSEInfo->iUsesDoubleLengthXForm) - { - for (i = 0; i < 2048; i++) - { - ppfData[channel][i] *= 2.0f; - } - } - - // do the transform - if (psDSEInfo->iUsesDoubleLengthXForm) - { - ppoIMDCTObject[channel]->Transform(ppfData[channel],iWindowType,iWindowShape); - } - else - { - ppoNormalIMDCTObject[channel]->Transform(ppfData[channel],iWindowType,iWindowShape); - } - - } // for channel - - int iLength = (psDSEInfo->iUsesDoubleLengthXForm) ? 2048 : 1024; - int grpIndex = 0; - int sThisLength = (iLength < DLYBUFSZ) ? iLength : DLYBUFSZ; - - m_poAudioDSP->SetSamplingRate(info.GetSamplingRate()); - for (int sSamp = 0; sSamp < iLength; sSamp += sThisLength) - { - m_poAudioDSP->ApplyLimiter(ppfData, sThisLength, grpIndex); - sThisLength = ((iLength - sThisLength * grpIndex++) < DLYBUFSZ) ? - (iLength - sThisLength * grpIndex++) : DLYBUFSZ; - } - - poAudioIO->IO(ppfData, iLength); - - // update previousWindowSequence - previousWindowSequence[L] = psDSEInfo->asDNSInfoStruct[L].iWindowSequence; - previousWindowSequence[R] = psDSEInfo->asDNSInfoStruct[R].iWindowSequence; - - m_Block [L]->~CBlock () ; - m_Block [R]->~CBlock () ; -} \ No newline at end of file diff --git a/Src/vlb/channel.h b/Src/vlb/channel.h deleted file mode 100644 index e62d97a2a..000000000 --- a/Src/vlb/channel.h +++ /dev/null @@ -1,280 +0,0 @@ -/* $Header: /cvs/root/winamp/vlb/channel.h,v 1.1 2009/04/28 20:21:08 audiodsp Exp $ */ - -/***************************************************************************\ - * - * Copyright 2000-2002 Dolby Laboratories, Inc. All Rights - * Reserved. Do not copy. Do not distribute. - * Confidential information. - * - * (C) copyright Fraunhofer - IIS (1998) - * All Rights Reserved - * - * filename: channel.h - * project : MPEG-2 AAC Decoder - * contents/description: independent channel stream object - * - ***************************************************************************/ - -#ifndef __CHANNEL_H__ -#define __CHANNEL_H__ - -#include "block.h" -#include "bitsequence.h" -#include "channelinfo.h" -#include "overlapadd.h" -#include "stereo.h" - -#ifdef MAIN_PROFILE -#include "prediction.h" -#endif - -#include "dolby_imdct.h" -#include "DolbyPayload.h" -#include "audio_io.h" -#include "audio_io_dsp.h" - -class CDolbyBitStream ; -class CStreamInfo ; -class AudioIODSP ; - -/** Base Class For Channel Elements. - - This abstract base class defines the interface and some common internal - helper functions for channel elements. -*/ - -class CChannelElement -{ - -public : - - CChannelElement (CDolbyBitStream &bs) ; - virtual ~CChannelElement () ; - - /** Data type for time-domain output samples. - - Change this to float if you prefer the decoder core to deliver its time - domain output data as floating point rather than 16 bit short integer. - */ - - typedef short PcmType ; - - /** Main serialization method. - - This method completely retrieves the channel element's state from the - associated bitstream object. All syntactic element members will be - called to perform their respective bitstream parsing and read in - their values from the MPEG stream. - - This interface method must be implemented by any derived class. - - @param info This container objects holds relevant information on - the current stream's sampling rate, profile etc. which - is required to correctly interpret some bitfields. - */ - - virtual void Read (const CStreamInfo &) = 0 ; - - /** Main decoding method. - - This is the actual workhorse function, it performs all processing - required for reconstruction of one complete frame of output data. - All active tools will be called to perform their work on the - spectral coefficients of our \Ref{CBlock} member object(s) and frequency - to time domain transform will be performed on all subwindows. - - @param pcmbuf The output array to hold one frame of decoded data. - @param stride The interleave stride used to write the audio chunks. - */ - - virtual void Decode (AudioIOControl *poAudioIO, CStreamInfo &info, int stride = 1) = 0 ; - - /** Number of channels information method. - - This method simply returns the number of output channels that the - implementing class will provide. - - @return Number of channels. - */ - - virtual int GetNumberOfChannels (void) - { - return 0 ; - } - - /** Pseudo-EQ configuration method. - - This is really just a gimmick and not encouraged for use in any - serious application. A coefficient mask can be provided that will - be applied to the spectral bins of our \Ref{CBlock} Members. Will - introduce bad aliasing artefacts. - - @param wantEQ Flag to turn pseudo-EQ on/off. False by default. - @param Mask An array of CBlock::EqualizationMaskLength coefficients. - */ - - void SetEqualization (bool wantEQ, float Mask []) ; - -protected : - - CBlock *ReadICS (CChannelInfo &ics_info, unsigned long *memory) ; - - enum - { - BlockMemorySize = ((sizeof (CLongBlock) > sizeof (CShortBlock)) ? - sizeof (CLongBlock) : sizeof (CShortBlock)) / - sizeof (unsigned long) + 1 - } ; - -protected : - - CDolbyBitStream &m_bs ; - - CVLBBitSequence m_GlobalGain ; - - bool m_WantEqualizer ; - bool m_WantSpectralData ; - - float m_EqualizerMask [CBlock::EqualizationMaskLength] ; - - AudioIODSP * m_poAudioDSP; - -} ; - -/** SCE Single Channel Element. - - This class holds the data for one single audio channel, as represented - by the ID_SCE bitstream element, and defines its parsing and decoding order. - - It consists of one \Ref{CBlock} member that holds the actual spectral bins for - a long block or a short block, and a time domain overlap-add buffer. - This class implements the \Ref{CChannelElement} interface. -*/ - -#ifdef MAIN_PROFILE -/* If MAIN_PROFILE is enabled, ID_SCE also includes an - instance of the \Ref{CPrediction} class to hold the state information for the - optional main profile backward-adaptive prediction tool. The predictor state - and overlap-add buffers are persistent between calls, so instances of this - class are not stateless and should only be used for one specific element - instance tag. - -*/ -#endif - -class CSingleChannel : public CChannelElement -{ - -public : - - CSingleChannel (CDolbyBitStream &bs) ; - ~CSingleChannel () ; - - virtual void Read (const CStreamInfo &) ; - virtual void Decode (AudioIOControl *poAudioIO, CStreamInfo &info, int stride = 1) ; - void DecodeDolby (AudioIOControl *poAudioIO, - DOLBY_PAYLOAD_STRUCT *psDSEInfo, - CStreamInfo &info, - int stride = 1) ; - virtual int GetNumberOfChannels (void) - { - return 1 ; - } - - //MSV: - CBlock* GetBlock(){return m_Block;} - CChannelInfo *GetChannelInfo(){return &m_IcsInfo;} -protected : - - CChannelInfo m_IcsInfo ; - CBlock *m_Block ; - - COverlapAddBuffer m_Previous ; - -#ifdef MAIN_PROFILE - CPrediction m_Prediction ; -#endif - - unsigned long m_BlockMemory [CChannelElement::BlockMemorySize] ; -private: - IMDCTObject *poIMDCTObject; - IMDCTObject *poNormalIMDCTObject; - float **ppfData; - short **ppshData; -} ; - -/** CPE Channel Pair Element. - - This class holds the data for one pair of audio channels, as represented - by the ID_CPE bitstream element, and defines their parsing and decoding order. - - It consists of a Left/Right-Pair of \Ref{CBlock} members that hold the actual - spectral bins for a long block or a short window sequence, a pair of - time domain overlap-add buffers and prediction tools, plus a joint stereo - processing tool and associated side information. The predictor state - and overlap-add buffers are persistent between calls, so instances of this - class are state-dependent and should only be used for one specific element - instance tag. - - This class implements the \Ref{CChannelElement} interface. - -*/ - -class CChannelPair : public CChannelElement -{ - -public : - - CChannelPair (CDolbyBitStream &bs) ; - ~CChannelPair () ; - - virtual void Read (const CStreamInfo &) ; - virtual void Decode (AudioIOControl *poAudioIO, CStreamInfo &info, int stride = 1) ; - void DecodeDolby (AudioIOControl *poAudioIO, - DOLBY_PAYLOAD_STRUCT *psDSEInfo, - CStreamInfo &info, - int stride = 1) ; - virtual int GetNumberOfChannels (void) - { - return CChannelPair::Channels ; - } - - //MSV: - CBlock* GetLeftBlock(){return m_Block[0];} - CBlock* GetRightBlock(){return m_Block[1];} - CChannelInfo *GetChannelInfo(){return m_IcsInfo;} -protected : - - enum - { - L = 0, - R = 1, - Channels = 2 - } ; - - CVLBBitSequence m_CommonWindow ; - - CChannelInfo m_IcsInfo [Channels] ; - CBlock *m_Block [Channels] ; - - COverlapAddBuffer m_Previous [Channels] ; - -#ifdef MAIN_PROFILE - CPrediction m_Prediction [Channels] ; -#endif - - CJointStereo m_JointStereo ; - - unsigned long m_BlockMemory [Channels][CChannelElement::BlockMemorySize] ; -private: - IMDCTObject **ppoIMDCTObject; - IMDCTObject **ppoNormalIMDCTObject; - float **ppfData; - short **ppshData; -} ; - - DECLARE_EXCEPTION(EIllegalProfile, AAC_ILLEGAL_PROFILE, "Illegal Profile") ; - -#endif - - diff --git a/Src/vlb/channelinfo.cpp b/Src/vlb/channelinfo.cpp deleted file mode 100644 index 55d5105c2..000000000 --- a/Src/vlb/channelinfo.cpp +++ /dev/null @@ -1,261 +0,0 @@ -/* $Header: /cvs/root/winamp/vlb/channelinfo.cpp,v 1.1 2009/04/28 20:21:08 audiodsp Exp $ */ - -/***************************************************************************\ - * - * Copyright 2000-2002 Dolby Laboratories, Inc. All Rights - * Reserved. Do not copy. Do not distribute. - * Confidential information. - * - * (C) copyright Fraunhofer - IIS (1998) - * All Rights Reserved - * - * filename: channelinfo.cpp - * project : MPEG-2 AAC Decoder - * contents/description: independent channel stream info object - * -\***************************************************************************/ - -#include "channelinfo.h" -#include "streaminfo.h" - -// // // CChannelInfo wraps ics_info() - -CChannelInfo::CChannelInfo () - : m_IcsReservedBit (1), - m_WindowSequence (2), - m_WindowShape (1), - m_ScaleFactorGrouping (7), - m_PredictorDataPresent (1) - -#ifdef MAIN_PROFILE - , - m_PredictorReset (1), - m_PredictorResetGroupNumber (5) -#endif -{ - m_Valid = false ; - m_TotalSfBands = 0 ; -} - -CChannelInfo::~CChannelInfo () -{ -} - -int CChannelInfo::GetProfile (void) const -{ - return m_Profile ; -} - -bool CChannelInfo::IsValid (void) const -{ - return m_Valid ; -} - -void CChannelInfo::Reset (const CStreamInfo &si) -{ - m_Valid = false ; - m_TotalSfBands = 0 ; - - m_SamplingRateIndex = si.GetSamplingRateIndex () ; - m_Profile = si.GetProfile () ; -} - -bool CChannelInfo::IsLongBlock (void) const -{ - return (m_WindowSequence != EightShortSequence) ; -} - -bool CChannelInfo::IsShortBlock (void) const -{ - return (m_WindowSequence == EightShortSequence) ; -} - -bool CChannelInfo::IsMainProfile (void) const -{ - return (m_Profile == ProfileMain) ; -} - -int CChannelInfo::GetWindowsPerFrame (void) const -{ - return (m_WindowSequence == EightShortSequence) ? 8 : 1 ; -} - -int CChannelInfo::GetWindowSequence (void) const -{ - return m_WindowSequence ; -} - -int CChannelInfo::GetWindowGroups (void) const -{ - return m_WindowGroups ; -} - -int CChannelInfo::GetWindowGroupLength (int index) const -{ - return m_WindowGroupLength [index] ; -} - -// scale factor band indices - -const int *CChannelInfo::GetScaleFactorBandOffsets (void) const -{ - if (IsLongBlock ()) - { - return m_SamplingRateInfoTable [m_SamplingRateIndex].ScaleFactorBands_Long ; - } - else - { - return m_SamplingRateInfoTable [m_SamplingRateIndex].ScaleFactorBands_Short ; - } -} - -int CChannelInfo::GetLastBin() -{ - if (IsLongBlock()) - { - return m_SamplingRateInfoTable[m_SamplingRateIndex].ScaleFactorBands_Long[m_MaxSfBands]; - } - else - { - return m_SamplingRateInfoTable[m_SamplingRateIndex].ScaleFactorBands_Short[m_MaxSfBands]; - } -} - - -int CChannelInfo::GetSamplingFrequency (void) const -{ - return SamplingRateFromIndex (m_SamplingRateIndex) ; -} - -int CChannelInfo::SamplingRateFromIndex (int index) -{ - return m_SamplingRateInfoTable [index].SamplingFrequency ; -} - -#ifdef MAIN_PROFILE -int CChannelInfo::GetMaximumPredictionBands (void) const -{ - return m_SamplingRateInfoTable [m_SamplingRateIndex].MaximumPredictionBands ; -} - -void CChannelInfo::DeactivatePrediction (int band) -{ - if (band < GetMaximumPredictionBands ()) - { - m_PredictionUsed [band] = false ; - } -} -#endif - -void CChannelInfo::Read (CDolbyBitStream &bs) -{ - m_IcsReservedBit.Read (bs) ; - - m_WindowSequence.Read (bs) ; - m_WindowShape.Read (bs) ; - -#ifdef ONLY_SINE_WINDOW - if (m_WindowShape == 1) - throw EUnsupportedWindowShape () ; -#endif - - if (IsLongBlock ()) - { - m_TotalSfBands = m_SamplingRateInfoTable [m_SamplingRateIndex].NumberOfScaleFactorBands_Long ; - - m_MaxSfBands.Read (bs, 6) ; - - if (m_PredictorDataPresent.Read (bs)) - { -#ifdef MAIN_PROFILE - if (m_PredictorReset.Read (bs)) - { - m_PredictorResetGroupNumber.Read (bs) ; - - if ((m_PredictorResetGroupNumber < 1) || (m_PredictorResetGroupNumber > 30)) - { - throw EInvalidPredictorReset () ; - } - } - - int maxpred = (GetScaleFactorBandsTransmitted () < GetMaximumPredictionBands ()) ? - GetScaleFactorBandsTransmitted () : GetMaximumPredictionBands () ; - - for (int band = 0 ; band < maxpred ; band++) - { - m_PredictionUsed [band] = bs.Get (1) ? true : false ; - } -#else - throw EIllegalProfile(); -#endif - } - - m_WindowGroups = 1 ; - m_WindowGroupLength [0] = 1 ; - } - else - { - m_TotalSfBands = m_SamplingRateInfoTable [m_SamplingRateIndex].NumberOfScaleFactorBands_Short ; - - m_MaxSfBands.Read (bs, 4) ; - m_ScaleFactorGrouping.Read (bs) ; - - // // // expand group lengths - - m_WindowGroups = 0 ; - - for (int i = 0 ; i < 7 ; i++) - { - int mask = 1 << (6 - i) ; - - m_WindowGroupLength [i] = 1 ; - - if (m_ScaleFactorGrouping & mask) - { - m_WindowGroupLength [m_WindowGroups]++ ; - } - else - { - m_WindowGroups++ ; - } - } - - // loop runs to i < 7 only - - m_WindowGroupLength [7] = 1 ; - m_WindowGroups++ ; - } - - m_Valid = true ; -} - -int CChannelInfo::GetMaximumTnsBands (void) const -{ - static const int tns_max_bands_tbl [12][4] = - { - /* entry for each sampling rate - * 1 Main/LC long window - * 2 Main/LC short window - * 3 SSR long window - * 4 SSR short window - */ - - { 31, 9, 28, 7 }, /* 96000 */ - { 31, 9, 28, 7 }, /* 88200 */ - { 34, 10, 27, 7 }, /* 64000 */ - { 40, 14, 26, 6 }, /* 48000 */ - { 42, 14, 26, 6 }, /* 44100 */ - { 51, 14, 26, 6 }, /* 32000 */ - { 46, 14, 29, 7 }, /* 24000 */ - { 46, 14, 29, 7 }, /* 22050 */ - { 42, 14, 23, 8 }, /* 16000 */ - { 42, 14, 23, 8 }, /* 12000 */ - { 42, 14, 23, 8 }, /* 11025 */ - { 39, 14, 19, 7 }, /* 8000 */ - } ; - - int i = IsLongBlock () ? 0 : 1 ; - i += (GetProfile () == ProfileSSR) ? 2 : 0 ; - - return tns_max_bands_tbl [m_SamplingRateIndex][i] ; -} diff --git a/Src/vlb/channelinfo.h b/Src/vlb/channelinfo.h deleted file mode 100644 index 1db9631cd..000000000 --- a/Src/vlb/channelinfo.h +++ /dev/null @@ -1,196 +0,0 @@ -/* $Header: /cvs/root/winamp/vlb/channelinfo.h,v 1.1 2009/04/28 20:21:08 audiodsp Exp $ */ - -/***************************************************************************\ - * - * Copyright 2000-2002 Dolby Laboratories, Inc. All Rights - * Reserved. Do not copy. Do not distribute. - * Confidential information. - * - * (C) copyright Fraunhofer - IIS (1998) - * All Rights Reserved - * - * filename: channelinfo.h - * project : MPEG-2 AAC Decoder - * contents/description: independent channel stream info object - * - * $Header: /cvs/root/winamp/vlb/channelinfo.h,v 1.1 2009/04/28 20:21:08 audiodsp Exp $ - * -\***************************************************************************/ - -#ifndef __CHANNELINFO_H__ -#define __CHANNELINFO_H__ - -#include "bitsequence.h" -#include "exception.h" -#include "streaminfo.h" - -class CDolbyBitStream ; -class CProgramConfig ; -class CStreamInfo ; - -/** Channel Element Side Information. - - This class provides information essential to various parts of the decoder. - It reads the ics_info() bitstream elements and provides accordingly mapped - access to some static tables, first of all scale factor band widths. -*/ - -class CChannelInfo -{ - -public : - - // // // - - enum - { - OnlyLongSequence = 0, - LongStartSequence, - EightShortSequence, - LongStopSequence, - -#ifdef MAIN_PROFILE - PredictionBandsTotal = 42, -#endif - - ProfileMain = 0, - ProfileLowComplexity, - ProfileSSR, - ProfileReserved - - } ; - - // // // - - CChannelInfo () ; - ~CChannelInfo () ; - - void Read (CDolbyBitStream &bs) ; - - bool IsValid (void) const ; - bool IsLongBlock (void) const ; - bool IsShortBlock (void) const ; - bool IsMainProfile (void) const ; - - void Reset (const CStreamInfo &) ; - - int GetProfile (void) const ; - - int GetWindowShape (void) const - { - return m_WindowShape ; - } - - int GetWindowSequence (void) const ; - int GetWindowsPerFrame (void) const ; - - int GetWindowGroups (void) const ; - int GetWindowGroupLength (int index) const ; - - int GetScaleFactorBandsTransmitted (void) const - { - return m_MaxSfBands ; - } - - int GetScaleFactorBandsTotal (void) const - { - return m_TotalSfBands ; - } - - const int *GetScaleFactorBandOffsets (void) const ; - - int GetSamplingFrequency (void) const ; - int GetMaximumTnsBands (void) const ; - -#ifdef MAIN_PROFILE - // // // Prediction - - int GetMaximumPredictionBands (void) const ; - - bool GetPredictorDataPresent (void) const - { - return m_PredictorDataPresent ? true : false ; - } - - bool GetPredictionUsedForBand (int band) const - { - return m_PredictionUsed [band] ; - } - - bool GetPerformPredictorReset (void) const - { - if (GetPredictorDataPresent ()) - { - return m_PredictorReset ? true : false ; - } - - return false ; - } - - int GetPredictorResetGroupNumber (void) const - { - return m_PredictorResetGroupNumber ; - } - - void DeactivatePrediction (int band) ; - - // // // -#endif - - static int SamplingRateFromIndex (int index) ; - - int GetSamplingIndex(){return m_SamplingRateIndex;} - int GetLastBin() ; - -protected : - bool m_Valid ; - - CVLBBitSequence m_IcsReservedBit ; - CVLBBitSequence m_WindowSequence ; - CVLBBitSequence m_WindowShape ; - CVLBBitSequence m_MaxSfBands ; - CVLBBitSequence m_ScaleFactorGrouping ; - - // prediction - - CVLBBitSequence m_PredictorDataPresent ; -#ifdef MAIN_PROFILE - CVLBBitSequence m_PredictorReset ; - CVLBBitSequence m_PredictorResetGroupNumber ; - - bool m_PredictionUsed [CChannelInfo::PredictionBandsTotal] ; - - // // // -#endif - - int m_TotalSfBands ; - int m_SamplingRateIndex, m_Profile ; - - int m_WindowGroups, m_WindowGroupLength [8] ; - - // // // - -#ifdef MAIN_PROFILE - DECLARE_EXCEPTION(EInvalidPredictorReset, AAC_INVALIDPREDICTORRESET, "Invalid Predictor Reset Group Indicated") ; -#endif - - DECLARE_EXCEPTION(EUnsupportedWindowShape, AAC_UNSUPPORTEDWINDOWSHAPE, "Unsupported Window Shape Used") ; - DECLARE_EXCEPTION(EIllegalProfile, AAC_ILLEGAL_PROFILE, "Illegal Profile") ; - - // // // - - typedef struct - { - int SamplingFrequency ; - int NumberOfScaleFactorBands_Long ; - const int *ScaleFactorBands_Long ; - int NumberOfScaleFactorBands_Short ; - const int *ScaleFactorBands_Short ; - int MaximumPredictionBands ; - } SamplingRateInfo ; - - static const SamplingRateInfo m_SamplingRateInfoTable [16] ; - -} ; - -#endif diff --git a/Src/vlb/datastream.cpp b/Src/vlb/datastream.cpp deleted file mode 100644 index 7ed13fe36..000000000 --- a/Src/vlb/datastream.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* $Header: /cvs/root/winamp/vlb/datastream.cpp,v 1.1 2009/04/28 20:21:08 audiodsp Exp $ */ - -/***************************************************************************\ - * - * Copyright 2000-2002 Dolby Laboratories, Inc. All Rights - * Reserved. Do not copy. Do not distribute. - * Confidential information. - * - * (C) copyright Fraunhofer - IIS (1998) - * All Rights Reserved - * - * filename: datastream.cpp - * project : MPEG-2 AAC Decoder - * contents/description: data stream element - * -\***************************************************************************/ - -#include "datastream.h" - -CDataStream::CDataStream (CDolbyBitStream &bs) - : m_bs (bs), - m_DataByteAlignFlag (1), - m_Count (8), - m_EscCount (8) -{ -} - -CDataStream::~CDataStream () -{ -} - -void CDataStream::Read (void) -{ - m_DataByteAlignFlag.Read (m_bs) ; - - m_Count.Read (m_bs) ; - - if (m_Count == 255) - { - m_Count += m_EscCount.Read (m_bs) ; - } - - if (m_DataByteAlignFlag) - { - m_bs.ByteAlign () ; - } - - for (int i = 0 ; i < m_Count ; i++) - { - m_DataStreamByte [i].Read (m_bs, 8) ; - } -} diff --git a/Src/vlb/datastream.h b/Src/vlb/datastream.h deleted file mode 100644 index 0b70fab1f..000000000 --- a/Src/vlb/datastream.h +++ /dev/null @@ -1,60 +0,0 @@ -/* $Header: /cvs/root/winamp/vlb/datastream.h,v 1.1 2009/04/28 20:21:09 audiodsp Exp $ */ - -/***************************************************************************\ - * - * Copyright 2000-2002 Dolby Laboratories, Inc. All Rights - * Reserved. Do not copy. Do not distribute. - * Confidential information. - * - * (C) copyright Fraunhofer - IIS (1998) - * All Rights Reserved - * - * filename: datastream.h - * project : MPEG-2 AAC Decoder - * contents/description: data stream element - * -\***************************************************************************/ - -#ifndef __DATASTREAM_H__ -#define __DATASTREAM_H__ - -#include "bitsequence.h" - -/** DSE Data Stream Element. - - This class represents a data stream element, that may be used to transport - additional user data embedded within the audio bitstream. -*/ - -class CDataStream -{ -public : - - CDataStream (CDolbyBitStream &) ; - ~CDataStream () ; - - void Read (void) ; - - int Length (void) - { - return m_Count ; - } - -protected : - - CDolbyBitStream &m_bs ; - - CVLBBitSequence m_DataByteAlignFlag ; - CVLBBitSequence m_Count ; - CVLBBitSequence m_EscCount ; - - enum - { - MaximumElementLength = 512 - } ; - - CVLBBitSequence m_DataStreamByte [MaximumElementLength] ; - -} ; - -#endif diff --git a/Src/vlb/dolby_imdct.cpp b/Src/vlb/dolby_imdct.cpp deleted file mode 100644 index b80767fbb..000000000 --- a/Src/vlb/dolby_imdct.cpp +++ /dev/null @@ -1,847 +0,0 @@ -/* $Header: /cvs/root/winamp/vlb/dolby_imdct.cpp,v 1.1 2009/04/28 20:21:09 audiodsp Exp $ */ - -/***************************************************************************\ - * - * Copyright 2000-2002 Dolby Laboratories, Inc. All Rights - * Reserved. Do not copy. Do not distribute. - * Confidential information. - * - * filename: dolby_imdct.cpp - * project : MPEG-2 AAC Decoder - * contents/description: IMDCT transform routines - * -\***************************************************************************/ - -#include"dolby_imdct.h" -#ifdef INTERPOLATE_WINDOW -#include "window_tab.h" -#endif - -/* #defines related to Izero and CalculateKBDWindowExact */ -#define IzeroEPSILON 1E-21 /* Max error acceptable in Izero */ -#define M_PI 3.14159265358979323846264338327950288f - -/*------------------------ Window Functions ---------------------------*/ - -void Sine_Window(float*pfWindow,int iSize) -{ -#ifdef INTERPOLATE_WINDOW - int count, j; - - switch (iSize) - { - case 256: - for(j=0; j < iSize/2 ;j++) - { - pfWindow[j]=(float)(sin_short[j]); - } - break; - - case 512: - count = 0; - for (j = 0; j < iSize/4-1; j++) - { - pfWindow[count++] = (float) sin_short[j]; - pfWindow[count++] = (float) ((sin_short[j] + sin_short[j + 1]) * 0.5); - } - pfWindow[count++] = (float) sin_short[j]; - pfWindow[count] = (float) 1.0; - break; - - case 2048: - for(j=0; j < iSize/2 ;j++) - { - pfWindow[j]=(float)(sin_long[j]); - } - break; - - case 4096: - count = 0; - for (j = 0; j < iSize/4-1; j++) - { - pfWindow[count++] = (float) sin_long[j]; - pfWindow[count++] = (float) ((sin_long[j] + sin_long[j + 1]) * 0.5); - } - pfWindow[count++] = (float) sin_long[j]; - pfWindow[count] = (float) 1.0; - break; - } -#else - int n; - for(n=0;n= IzeroEPSILON * sum); - return (sum); -} - -/***************************************************************************** - - functionname: CalculateKBDWindowExact - description: calculates the window coefficients for the Kaiser-Bessel - derived window - returns: - input: window length, alpha - output: window coefficients - -*****************************************************************************/ -void CalculateKBDWindowExact(float * win, float alpha, int length) -{ - int i; - float IBeta; - float tmp; - float sum = 0.0; - - alpha *= M_PI; - IBeta = 1.0f / Izero(alpha); - - /* calculate lower half of Kaiser Bessel window */ - for (i = 0; i < (length >> 1); i++) - { - tmp = 4.0f * (float) i / (float) length - 1.0f; - win[i] = Izero(alpha * ((float) sqrt(1.0f - tmp * tmp))) * IBeta; - sum += win[i]; - } - - sum = 1.0f / sum; - tmp = 0.0; - - /* calculate lower half of window */ - for (i = 0; i < (length >> 1); i++) - { - tmp += win[i]; - win[i] = (float) sqrt(tmp * sum); - } -} - - - - - -void KBD_Window(float*pfWindow,int iSize) -{ -#ifdef INTERPOLATE_WINDOW - int count, j; - - switch (iSize) - { - case 256: - for(j=0; j < iSize/2 ;j++) - { - pfWindow[j]=(float)(KBD_short[j]); - } - break; - - case 512: - count = 0; - for (j = 0; j < iSize/4-1; j++) - { - pfWindow[count++] = (float) KBD_short[j]; - pfWindow[count++] = (float) ((KBD_short[j] + KBD_short[j + 1]) * 0.5); - } - pfWindow[count++] = (float) KBD_short[j]; - pfWindow[count] = (float) 1.0; - break; - - case 2048: - for(j=0; j < iSize/2 ;j++) - { - pfWindow[j]=(float)(KBD_long[j]); - } - break; - - case 4096: - count = 0; - for (j = 0; j < iSize/4-1; j++) - { - pfWindow[count++] = (float) KBD_long[j]; - pfWindow[count++] = (float) ((KBD_long[j] + KBD_long[j + 1]) * 0.5); - } - pfWindow[count++] = (float) KBD_long[j]; - pfWindow[count] = (float) 1.0; - - break; - } -#else - - /* The stock AAC MP4 encoder calculates KBD windows with different alphas - depending on the blocklength. We must match those windows here. */ - - switch(iSize) - { - case 256: - case 512: - CalculateKBDWindowExact(pfWindow, 6.0, iSize); - break; - - case 2048: - case 4096: - CalculateKBDWindowExact(pfWindow, 4.0, iSize); - break; - default: - CalculateKBDWindowExact(pfWindow, 4.0, iSize); - - } - -#endif -} - -/*----------------------- DOLBY IMDCT ---------------------------------*/ - -IMDCTObject::IMDCTObject(int _iLongSize, - int _iOverlap) - :iLongSize(_iLongSize), - iHLongSize(_iLongSize/2), - iOverlap(_iOverlap), - iOldShape(0) -{ - if(iLongSize==0){ - return; - } - if(iOverlap==0){ - return; - } - int n,k; - - //Obtain memory for Short Windows: - //These arrays are larger than they need to be, - //but are made this large for convenience - iShortSize = iLongSize / 8; - iHShortSize = iHLongSize / 8; - pfShortWindowSin = new float[iHLongSize]; - pfShortWindowKBD = new float[iHLongSize]; - - //Obtain memory for Longwindows: - pfLongWindowSin=new float[iHLongSize]; - pfS2LWindowSin=new float[iHLongSize]; - - pfLongWindowKBD=new float[iHLongSize]; - pfS2LWindowKBD=new float[iHLongSize]; - - //Obtain memory for temporary buffer: - pfTempBuffer=new float[iLongSize]; - pfEightWindowsBuffer=new float[iLongSize]; - pfSavedBuffer=new float[iHLongSize]; - for(n=0;n -#include -#include"fft.h" - -/*#define INTERPOLATE_WINDOW */ - -class IMDCTObject{ - - public: - IMDCTObject(int _iLongSize, - int _iOverlap); - IMDCTObject(); - IMDCTObject(IMDCTObject&oCopy); - IMDCTObject& operator=(IMDCTObject&oCopy); - ~IMDCTObject(); - - int Transform( float*pfData, - int iWindowType, - int iWindowShape); - - private: - enum { - LONG_BLOCK, - SHORT_BLOCK - }; - - enum { - LONG_WINDOW = 0, - START_WINDOW = 1, - EIGHT_SHORT_SEQUENCE = 2, - STOP_WINDOW = 3 - }; - - enum { - SINE_WINDOW = 0, - KBD_WINDOW = 1 - }; - - void imdct(float* pfData, int blocktype); - - private: - int iLongSize; - int iShortSize; - int iHLongSize; - int iHShortSize; - int iOverlap; - int iOldShape; - - //Windows: - float*pfLongWindowSin; - float*pfS2LWindowSin; - float*pfShortWindowSin; - - float*pfLongWindowKBD; - float*pfS2LWindowKBD; - float*pfShortWindowKBD; - - - float*pfTempBuffer; - float*pfEightWindowsBuffer; - - float*pfSavedBuffer; - - //MDCT Data: - int iLongFFTSize; - int iShortFFTSize; - float*pfReal; - float*pfImag; - float*pfRealLongTwiddle; - float*pfImagLongTwiddle; - - float*pfRealShort; - float*pfImagShort; - float*pfRealShortTwiddle; - float*pfImagShortTwiddle; - -}; -#endif \ No newline at end of file diff --git a/Src/vlb/exception.h b/Src/vlb/exception.h deleted file mode 100644 index 7f60b5d9b..000000000 --- a/Src/vlb/exception.h +++ /dev/null @@ -1,91 +0,0 @@ -/* $Header: /cvs/root/winamp/vlb/exception.h,v 1.1 2009/04/28 20:21:09 audiodsp Exp $ */ - -/***************************************************************************\ - * - * Copyright 2000-2002 Dolby Laboratories, Inc. All Rights - * Reserved. Do not copy. Do not distribute. - * Confidential information. - * - * (C) copyright Fraunhofer - IIS (1998) - * All Rights Reserved - * - * filename: exception.cpp - * project : MPEG-2 AAC Decoder - * contents/description: common exception object - * - * $Header: /cvs/root/winamp/vlb/exception.h,v 1.1 2009/04/28 20:21:09 audiodsp Exp $ - * -\***************************************************************************/ - -#ifndef __EXCEPTION_H__ -#define __EXCEPTION_H__ - -#define AAC_OK 0x0000 - -#define AAC_FAILURE_BASE 0x1000 - -#define AAC_UNIMPLEMENTED (AAC_FAILURE_BASE | 1) -#define AAC_NOTADIFHEADER (AAC_FAILURE_BASE | 2) -#define AAC_DOESNOTEXIST (AAC_FAILURE_BASE | 3) -#define AAC_ENDOFSTREAM (AAC_FAILURE_BASE | 4) -#define AAC_SYNCERROR (AAC_FAILURE_BASE | 5) -#define AAC_CRCERROR (AAC_FAILURE_BASE | 6) -#define AAC_INPUT_BUFFER_EMPTY (AAC_FAILURE_BASE | 7) -#define AAC_INVALIDCODEBOOK (AAC_FAILURE_BASE | 8) - -#ifdef MAIN_PROFILE -#define AAC_INVALIDPREDICTORRESET (AAC_FAILURE_BASE | 9) -#endif - -#define AAC_UNSUPPORTEDWINDOWSHAPE (AAC_FAILURE_BASE | 10) -#define AAC_DOLBY_NOT_SUPPORTED (AAC_FAILURE_BASE | 11) -#define AAC_ILLEGAL_PROFILE (AAC_FAILURE_BASE | 12) - -#ifdef __cplusplus - -/** Base Class For Exceptions. - - This class defines the interface that all exceptions possibly thrown by - \Ref{CAacDecoder} or its input objects are derived from. -*/ - -class CAacException -{ - -public : - - /// Exception Constructor. - - CAacException (int _value, char *_text) : value(_value), text(_text) {} ; - - /// Exception Destructor. - - ~CAacException () {} ; - - /** Exception Code Method. - - This method returns an exception status code, that can be used programatically. - */ - - int What () { return value ; } - - /** Exception Text Method. - - This method returns a pointer to a plain text explanation of what happened. - It might be used e.g. for user notification messages or the like. - */ - - char *Explain () { return text ; } - -protected : - - int value ; - char *text ; - -} ; - -#define DECLARE_EXCEPTION(a,b,c) class a : public CAacException { public : a () : CAacException (b, c) {} ; } - -#endif - -#endif diff --git a/Src/vlb/factory_nsvVlb.cpp b/Src/vlb/factory_nsvVlb.cpp deleted file mode 100644 index b93296997..000000000 --- a/Src/vlb/factory_nsvVlb.cpp +++ /dev/null @@ -1,65 +0,0 @@ -#include "factory_nsvVlb.h" -#include "NSVFactory.h" - -static const char serviceName[] = "Dolby VLB NSV Decoder"; - -// {69D8A07C-ECE4-44f8-9C40-12506422A882} -static const GUID nsv_vlb_guid = -{ 0x69d8a07c, 0xece4, 0x44f8, { 0x9c, 0x40, 0x12, 0x50, 0x64, 0x22, 0xa8, 0x82 } }; - - -static NSVFactory nsvFactory; -FOURCC NSVVLBFactory::GetServiceType() -{ - return WaSvc::NSVFACTORY; -} - -const char *NSVVLBFactory::GetServiceName() -{ - return serviceName; -} - -GUID NSVVLBFactory::GetGUID() -{ - return nsv_vlb_guid; -} - -void *NSVVLBFactory::GetInterface(int global_lock) -{ - svc_nsvFactory *ifc = &nsvFactory; - return ifc; -} - -int NSVVLBFactory::SupportNonLockingInterface() -{ - return 1; -} - -int NSVVLBFactory::ReleaseInterface(void *ifc) -{ - return 1; -} - -const char *NSVVLBFactory::GetTestString() -{ - return 0; -} - -int NSVVLBFactory::ServiceNotify(int msg, int param1, int param2) -{ - return 1; -} - - -#define CBCLASS NSVVLBFactory -START_DISPATCH; -CB(WASERVICEFACTORY_GETSERVICETYPE, GetServiceType) -CB(WASERVICEFACTORY_GETSERVICENAME, GetServiceName) -CB(WASERVICEFACTORY_GETGUID, GetGUID) -CB(WASERVICEFACTORY_GETINTERFACE, GetInterface) -CB(WASERVICEFACTORY_SUPPORTNONLOCKINGGETINTERFACE, SupportNonLockingInterface) -CB(WASERVICEFACTORY_RELEASEINTERFACE, ReleaseInterface) -CB(WASERVICEFACTORY_GETTESTSTRING, GetTestString) -CB(WASERVICEFACTORY_SERVICENOTIFY, ServiceNotify) -END_DISPATCH; -#undef CBCLASS \ No newline at end of file diff --git a/Src/vlb/factory_nsvVlb.h b/Src/vlb/factory_nsvVlb.h deleted file mode 100644 index a51d9759b..000000000 --- a/Src/vlb/factory_nsvVlb.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef NULLSOFT_FACTORY_NSVFACTORY_H -#define NULLSOFT_FACTORY_NSVFACTORY_H - -//#include "api__vlb.h" -#include -#include - -class NSVVLBFactory : public waServiceFactory -{ -public: - FOURCC GetServiceType(); - const char *GetServiceName(); - GUID GetGUID(); - void *GetInterface(int global_lock); - int SupportNonLockingInterface(); - int ReleaseInterface(void *ifc); - const char *GetTestString(); - int ServiceNotify(int msg, int param1, int param2); - -protected: - RECVS_DISPATCH; -}; - - -#endif \ No newline at end of file diff --git a/Src/vlb/factory_vlbDecoder.cpp b/Src/vlb/factory_vlbDecoder.cpp deleted file mode 100644 index 074d02e4a..000000000 --- a/Src/vlb/factory_vlbDecoder.cpp +++ /dev/null @@ -1,66 +0,0 @@ -//#define GUID_EQUALS_DEFINED -#include "api__vlb.h" -#include "factory_vlbdecoder.h" -#include "VlbDecoder.h" - -static const char serviceName[] = "Dolby VLB Decoder"; - -FOURCC VLBDecoderFactory::GetServiceType() -{ - return WaSvc::OBJECT; -} - -const char *VLBDecoderFactory::GetServiceName() -{ - return serviceName; -} - -GUID VLBDecoderFactory::GetGUID() -{ - return obj_vlbDecoderGUID; -} - -void *VLBDecoderFactory::GetInterface(int global_lock) -{ - obj_vlbDecoder *ifc=new VLBDecoder; -// if (global_lock) -// WASABI_API_SVC->service_lock(this, (void *)ifc); - return ifc; -} - -int VLBDecoderFactory::SupportNonLockingInterface() -{ - return 1; -} - -int VLBDecoderFactory::ReleaseInterface(void *ifc) -{ - //WASABI_API_SVC->service_unlock(ifc); - obj_vlbDecoder *decoder = static_cast(ifc); - VLBDecoder *vlbDecoder = static_cast(decoder); - delete vlbDecoder; - return 1; -} - -const char *VLBDecoderFactory::GetTestString() -{ - return NULL; -} - -int VLBDecoderFactory::ServiceNotify(int msg, int param1, int param2) -{ - return 1; -} - -#define CBCLASS VLBDecoderFactory -START_DISPATCH; -CB(WASERVICEFACTORY_GETSERVICETYPE, GetServiceType) -CB(WASERVICEFACTORY_GETSERVICENAME, GetServiceName) -CB(WASERVICEFACTORY_GETGUID, GetGUID) -CB(WASERVICEFACTORY_GETINTERFACE, GetInterface) -CB(WASERVICEFACTORY_SUPPORTNONLOCKINGGETINTERFACE, SupportNonLockingInterface) -CB(WASERVICEFACTORY_RELEASEINTERFACE, ReleaseInterface) -CB(WASERVICEFACTORY_GETTESTSTRING, GetTestString) -CB(WASERVICEFACTORY_SERVICENOTIFY, ServiceNotify) -END_DISPATCH; -#undef CBCLASS \ No newline at end of file diff --git a/Src/vlb/factory_vlbDecoder.h b/Src/vlb/factory_vlbDecoder.h deleted file mode 100644 index e39641d26..000000000 --- a/Src/vlb/factory_vlbDecoder.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef NULLSOFT_FACTORY_VLBDECODER_H -#define NULLSOFT_FACTORY_VLBDECODER_H - -#include -#include - -class VLBDecoderFactory : public waServiceFactory -{ -public: - FOURCC GetServiceType(); - const char *GetServiceName(); - GUID GetGUID(); - void *GetInterface(int global_lock); - int SupportNonLockingInterface(); - int ReleaseInterface(void *ifc); - const char *GetTestString(); - int ServiceNotify(int msg, int param1, int param2); - -protected: - RECVS_DISPATCH; -}; - -#endif \ No newline at end of file diff --git a/Src/vlb/fft.cpp b/Src/vlb/fft.cpp deleted file mode 100644 index 8c9e32f80..000000000 --- a/Src/vlb/fft.cpp +++ /dev/null @@ -1,317 +0,0 @@ -/* $Header: /cvs/root/winamp/vlb/fft.cpp,v 1.1 2009/04/28 20:21:09 audiodsp Exp $ */ - -/***************************************************************************\ - * - * Copyright 2000-2002 Dolby Laboratories, Inc. All Rights - * Reserved. Do not copy. Do not distribute. - * Confidential information. - * - * filename: fft.cpp - * project : MPEG-2 AAC Decoder - * contents/description: Standard FFT routine - * -\***************************************************************************/ - -/* Description: This function calculates a 1024,256 or 128 point fft via - decimation in frequency algorithm described in "Digital Signal - Processing" by Oppenheim and Schafer, refer to pages 304 (flow - chart) and 330-332 (Fotran program in problem 5). Modified to - get only desired block sizes. */ - -#include"fft.h" - -#ifndef PI -#define PI 3.14159265358979 -#endif - -#define HOTSWAP(a,b) fTemp=a; a=b; b=fTemp; -void fftl(float *pfReal, float *pfImag,int iSize) -{ - static int iInit=0; - static int iPower2=0; - static int iTransformSize=0; - static float *pfTwiddleReal=0; - static float *pfTwiddleImag=0; - - if(iSize!=iTransformSize){ - iInit=0; - } - if(!iInit){ - int iCounter; - - if((iSize-1)&iSize){ - //printf("FFT Length Must be Radix 2!\n"); - return; - } - - free(pfTwiddleReal); - free(pfTwiddleImag); - - iTransformSize=iSize; - - pfTwiddleReal=(float*)malloc(iSize/2*sizeof(float)); - pfTwiddleImag=(float*)malloc(iSize/2*sizeof(float)); - - for(iCounter=0;iCounter>1; - iFFTCounter=1; - for(iSkip=iHSize;iSkip>0;iSkip>>=1){ - iOffset=0; - for(iCounter1=0;iCounter1>1; - } - iCounter1=iCounter1+iCounter3; - } -} -/* -void fftl(float* xreal,float* ximag,int N) -{ - int m,mm1; - static int init=0; - int nv2,nm1,mp; - static float wreal[13][13],wimag[13][13]; - int i,j,k,l; - int ip,le,le1; - float treal,timag,ureal,uimag; - if (init==0){ - memset((char*) wreal,0,sizeof(wreal)); - memset((char*)wimag,0,sizeof(wimag)); - m=13; - for(l=0;l>1; - wreal[0][l]=(float)(cosl(pi/le1)); - wimag[0][l]=-1.0f*(float)(sinl(pi/le1)); - } - m=12; - for(l=0;l>1; - wreal[1][l]=(float)(cosl(pi/le1)); - wimag[1][l]=-1.0f*(float)(sinl(pi/le1)); - } - m=11; - for(l=0;l>1; - wreal[2][l]=(float)(cosl(pi/le1)); - wimag[2][l]=-1.0f*(float)(sinl(pi/le1)); - } - m=10; - for(l=0;l>1; - wreal[3][l]=(float)(cosl(pi/le1)); - wimag[3][l]=-1.0f*(float)(sinl(pi/le1)); - } - m=9; - for(l=0;l>1; - wreal[4][l]=(float)(cosl(pi/le1)); - wimag[4][l]=-1.0f*(float)(sinl(pi/le1)); - } - m=8; - for(l=0;l>1; - wreal[5][l]=(float)(cosl(pi/le1)); - wimag[5][l]=-1.0f*(float)(sinl(pi/le1)); - } - m=7; - for(l=0;l>1; - wreal[6][l]=(float)(cosl(pi/le1)); - wimag[6][l]=-1.0f*(float)(sinl(pi/le1)); - } - m=6; - for(l=0;l>1; - wreal[7][l]=(float)(cosl(pi/le1)); - wimag[7][l]=-1.0f*(float)(sinl(pi/le1)); - } - m=5; - for(l=0;l>1; - wreal[8][l]=(float)(cosl(pi/le1)); - wimag[8][l]=-1.0f*(float)(sinl(pi/le1)); - } - m=4; - for(l=0;l>1; - wreal[9][l]=(float)(cosl(pi/le1)); - wimag[9][l]=-1.0f*(float)(sinl(pi/le1)); - } - m=3; - for(l=0;l>1; - wreal[10][l]=(float)(cosl(pi/le1)); - wimag[10][l]=-1.0f*(float)(sinl(pi/le1)); - } - m=2; - for(l=0;l>1; - wreal[11][l]=(float)(cosl(pi/le1)); - wimag[11][l]=-1.0f*(float)(sinl(pi/le1)); - } - m=1; - for(l=0;l>1; - wreal[12][l]=(float)(cosl(pi/le1)); - wimag[12][l]=-1.0f*(float)(sinl(pi/le1)); - } - init++; - } - switch(N){ - case 8192: m=13;mp=0;break; - case 4096: m=12;mp=1;break; - case 2048: m=11;mp=2;break; - case 1024: m=10;mp=3;break; - case 512: m=9;mp=4;break; - case 256:m=8;mp=5;break; - case 128:m=7;mp=6;break; - case 64:m=6;mp=7;break; - case 32:m=5;mp=8;break; - case 16:m=4;mp=9;break; - case 8:m=3;mp=10;break; - case 4:m=2;mp=11;break; - case 2:m=1;mp=12;break; - default: printf("FFT ERROR! %d\n",N);return; - } - mm1=m-1; - nv2=N>>1; - nm1=N-1; - for(l=0;l>1; - ureal=1; - uimag=0; - for(j=0;j>1; - } - j=j+k; - } -} -*/ - - - - - - - diff --git a/Src/vlb/fft.h b/Src/vlb/fft.h deleted file mode 100644 index 6527c7aff..000000000 --- a/Src/vlb/fft.h +++ /dev/null @@ -1,30 +0,0 @@ -/* $Header: /cvs/root/winamp/vlb/fft.h,v 1.1 2009/04/28 20:21:09 audiodsp Exp $ */ - -/***************************************************************************\ - * - * Copyright 2000-2002 Dolby Laboratories, Inc. All Rights - * Reserved. Do not copy. Do not distribute. - * Confidential information. - * - * filename: fft.h - * project : MPEG-2 AAC Decoder - * contents/description: FFT include file - * - * $Header: /cvs/root/winamp/vlb/fft.h,v 1.1 2009/04/28 20:21:09 audiodsp Exp $ - * -\***************************************************************************/ - -#include -#include -#include -#include -#ifndef FFTH -#define FFTH - -#ifndef pi -#define pi 3.1415926535897932384626434f -#endif - -void fftl(float* ,float* ,int ); - -#endif diff --git a/Src/vlb/imdct.cpp b/Src/vlb/imdct.cpp deleted file mode 100644 index 629e61833..000000000 --- a/Src/vlb/imdct.cpp +++ /dev/null @@ -1,875 +0,0 @@ -/* $Header: /cvs/root/winamp/vlb/imdct.cpp,v 1.2 2011/06/13 02:06:03 audiodsp Exp $ */ - -/***************************************************************************\ - * - * Copyright 2000-2002 Dolby Laboratories, Inc. All Rights - * Reserved. Do not copy. Do not distribute. - * Confidential information. - * - * (C) copyright Fraunhofer - IIS (1998) - * All Rights Reserved - * - * filename: imdct.cpp - * project : MPEG-2 AAC Decoder - * contents/description: inverse modified discrete cosine transform - * -\***************************************************************************/ - -#include "block.h" - -static const float CosTable_2048 [2048] = -{ - 0.500000F, 0.500001F, 0.500004F, 0.500007F, 0.500012F, 0.500018F, 0.500025F, 0.500033F, - 0.500043F, 0.500053F, 0.500065F, 0.500078F, 0.500092F, 0.500107F, 0.500124F, 0.500141F, - 0.500160F, 0.500180F, 0.500201F, 0.500224F, 0.500247F, 0.500272F, 0.500298F, 0.500325F, - 0.500353F, 0.500383F, 0.500413F, 0.500445F, 0.500478F, 0.500512F, 0.500548F, 0.500584F, - 0.500622F, 0.500661F, 0.500701F, 0.500742F, 0.500785F, 0.500828F, 0.500873F, 0.500919F, - 0.500966F, 0.501015F, 0.501064F, 0.501115F, 0.501167F, 0.501220F, 0.501275F, 0.501330F, - 0.501387F, 0.501445F, 0.501504F, 0.501564F, 0.501626F, 0.501689F, 0.501752F, 0.501818F, - 0.501884F, 0.501951F, 0.502020F, 0.502090F, 0.502161F, 0.502233F, 0.502307F, 0.502381F, - 0.502457F, 0.502535F, 0.502613F, 0.502692F, 0.502773F, 0.502855F, 0.502938F, 0.503023F, - 0.503108F, 0.503195F, 0.503283F, 0.503372F, 0.503463F, 0.503554F, 0.503647F, 0.503741F, - 0.503837F, 0.503933F, 0.504031F, 0.504130F, 0.504230F, 0.504331F, 0.504434F, 0.504538F, - 0.504643F, 0.504750F, 0.504857F, 0.504966F, 0.505076F, 0.505187F, 0.505300F, 0.505414F, - 0.505529F, 0.505645F, 0.505762F, 0.505881F, 0.506001F, 0.506122F, 0.506245F, 0.506369F, - 0.506494F, 0.506620F, 0.506747F, 0.506876F, 0.507006F, 0.507137F, 0.507270F, 0.507404F, - 0.507539F, 0.507675F, 0.507813F, 0.507952F, 0.508092F, 0.508233F, 0.508376F, 0.508520F, - 0.508665F, 0.508812F, 0.508960F, 0.509109F, 0.509259F, 0.509411F, 0.509564F, 0.509718F, - 0.509874F, 0.510030F, 0.510189F, 0.510348F, 0.510509F, 0.510671F, 0.510834F, 0.510999F, - 0.511165F, 0.511332F, 0.511501F, 0.511671F, 0.511842F, 0.512014F, 0.512188F, 0.512363F, - 0.512540F, 0.512718F, 0.512897F, 0.513077F, 0.513259F, 0.513442F, 0.513627F, 0.513813F, - 0.514000F, 0.514189F, 0.514379F, 0.514570F, 0.514762F, 0.514956F, 0.515152F, 0.515348F, - 0.515547F, 0.515746F, 0.515947F, 0.516149F, 0.516352F, 0.516557F, 0.516764F, 0.516971F, - 0.517180F, 0.517391F, 0.517603F, 0.517816F, 0.518031F, 0.518247F, 0.518464F, 0.518683F, - 0.518903F, 0.519125F, 0.519348F, 0.519572F, 0.519798F, 0.520025F, 0.520254F, 0.520484F, - 0.520716F, 0.520949F, 0.521183F, 0.521419F, 0.521657F, 0.521895F, 0.522136F, 0.522377F, - 0.522620F, 0.522865F, 0.523111F, 0.523359F, 0.523608F, 0.523858F, 0.524110F, 0.524363F, - 0.524618F, 0.524875F, 0.525132F, 0.525392F, 0.525653F, 0.525915F, 0.526179F, 0.526444F, - 0.526711F, 0.526979F, 0.527249F, 0.527521F, 0.527793F, 0.528068F, 0.528344F, 0.528621F, - 0.528900F, 0.529181F, 0.529463F, 0.529747F, 0.530032F, 0.530319F, 0.530607F, 0.530897F, - 0.531189F, 0.531482F, 0.531776F, 0.532072F, 0.532370F, 0.532670F, 0.532970F, 0.533273F, - 0.533577F, 0.533883F, 0.534190F, 0.534499F, 0.534810F, 0.535122F, 0.535436F, 0.535751F, - 0.536069F, 0.536387F, 0.536708F, 0.537030F, 0.537353F, 0.537679F, 0.538006F, 0.538334F, - 0.538665F, 0.538997F, 0.539331F, 0.539666F, 0.540003F, 0.540342F, 0.540682F, 0.541024F, - 0.541368F, 0.541714F, 0.542061F, 0.542410F, 0.542761F, 0.543113F, 0.543468F, 0.543824F, - 0.544181F, 0.544541F, 0.544902F, 0.545265F, 0.545630F, 0.545996F, 0.546365F, 0.546735F, - 0.547107F, 0.547480F, 0.547856F, 0.548233F, 0.548612F, 0.548993F, 0.549376F, 0.549760F, - 0.550147F, 0.550535F, 0.550925F, 0.551317F, 0.551711F, 0.552107F, 0.552504F, 0.552903F, - 0.553305F, 0.553708F, 0.554113F, 0.554520F, 0.554929F, 0.555340F, 0.555752F, 0.556167F, - 0.556584F, 0.557002F, 0.557422F, 0.557845F, 0.558269F, 0.558695F, 0.559124F, 0.559554F, - 0.559986F, 0.560420F, 0.560857F, 0.561295F, 0.561735F, 0.562177F, 0.562621F, 0.563068F, - 0.563516F, 0.563966F, 0.564419F, 0.564873F, 0.565330F, 0.565788F, 0.566249F, 0.566712F, - 0.567177F, 0.567644F, 0.568113F, 0.568584F, 0.569057F, 0.569533F, 0.570010F, 0.570490F, - 0.570972F, 0.571456F, 0.571942F, 0.572430F, 0.572921F, 0.573414F, 0.573909F, 0.574406F, - 0.574905F, 0.575407F, 0.575911F, 0.576417F, 0.576925F, 0.577436F, 0.577948F, 0.578463F, - 0.578981F, 0.579501F, 0.580023F, 0.580547F, 0.581073F, 0.581602F, 0.582134F, 0.582667F, - 0.583203F, 0.583742F, 0.584282F, 0.584825F, 0.585371F, 0.585919F, 0.586469F, 0.587022F, - 0.587577F, 0.588134F, 0.588694F, 0.589257F, 0.589822F, 0.590389F, 0.590959F, 0.591531F, - 0.592106F, 0.592684F, 0.593264F, 0.593846F, 0.594431F, 0.595019F, 0.595609F, 0.596201F, - 0.596797F, 0.597395F, 0.597995F, 0.598598F, 0.599204F, 0.599812F, 0.600423F, 0.601037F, - 0.601653F, 0.602272F, 0.602894F, 0.603519F, 0.604146F, 0.604776F, 0.605408F, 0.606044F, - 0.606682F, 0.607323F, 0.607967F, 0.608613F, 0.609262F, 0.609915F, 0.610570F, 0.611227F, - 0.611888F, 0.612552F, 0.613218F, 0.613887F, 0.614560F, 0.615235F, 0.615913F, 0.616594F, - 0.617278F, 0.617965F, 0.618655F, 0.619348F, 0.620044F, 0.620743F, 0.621445F, 0.622150F, - 0.622859F, 0.623570F, 0.624284F, 0.625002F, 0.625722F, 0.626446F, 0.627173F, 0.627903F, - 0.628636F, 0.629373F, 0.630113F, 0.630856F, 0.631602F, 0.632351F, 0.633104F, 0.633860F, - 0.634619F, 0.635382F, 0.636147F, 0.636917F, 0.637689F, 0.638465F, 0.639245F, 0.640028F, - 0.640814F, 0.641604F, 0.642397F, 0.643193F, 0.643994F, 0.644797F, 0.645604F, 0.646415F, - 0.647229F, 0.648047F, 0.648869F, 0.649694F, 0.650523F, 0.651355F, 0.652191F, 0.653031F, - 0.653874F, 0.654721F, 0.655572F, 0.656427F, 0.657285F, 0.658147F, 0.659014F, 0.659883F, - 0.660757F, 0.661635F, 0.662516F, 0.663402F, 0.664291F, 0.665184F, 0.666082F, 0.666983F, - 0.667888F, 0.668798F, 0.669711F, 0.670629F, 0.671550F, 0.672476F, 0.673406F, 0.674340F, - 0.675278F, 0.676220F, 0.677167F, 0.678118F, 0.679073F, 0.680033F, 0.680996F, 0.681964F, - 0.682937F, 0.683914F, 0.684895F, 0.685881F, 0.686871F, 0.687866F, 0.688865F, 0.689869F, - 0.690877F, 0.691890F, 0.692907F, 0.693929F, 0.694956F, 0.695987F, 0.697024F, 0.698064F, - 0.699110F, 0.700160F, 0.701216F, 0.702276F, 0.703341F, 0.704411F, 0.705485F, 0.706565F, - 0.707650F, 0.708739F, 0.709834F, 0.710934F, 0.712039F, 0.713149F, 0.714264F, 0.715384F, - 0.716510F, 0.717641F, 0.718777F, 0.719918F, 0.721065F, 0.722217F, 0.723374F, 0.724537F, - 0.725705F, 0.726879F, 0.728058F, 0.729243F, 0.730434F, 0.731630F, 0.732832F, 0.734039F, - 0.735252F, 0.736471F, 0.737696F, 0.738926F, 0.740162F, 0.741405F, 0.742653F, 0.743907F, - 0.745167F, 0.746433F, 0.747705F, 0.748984F, 0.750268F, 0.751559F, 0.752856F, 0.754159F, - 0.755468F, 0.756784F, 0.758106F, 0.759435F, 0.760770F, 0.762112F, 0.763460F, 0.764814F, - 0.766176F, 0.767544F, 0.768918F, 0.770300F, 0.771688F, 0.773083F, 0.774485F, 0.775894F, - 0.777309F, 0.778732F, 0.780162F, 0.781599F, 0.783043F, 0.784495F, 0.785953F, 0.787419F, - 0.788892F, 0.790373F, 0.791861F, 0.793356F, 0.794859F, 0.796370F, 0.797888F, 0.799414F, - 0.800948F, 0.802489F, 0.804038F, 0.805596F, 0.807161F, 0.808734F, 0.810315F, 0.811904F, - 0.813502F, 0.815108F, 0.816721F, 0.818344F, 0.819974F, 0.821614F, 0.823261F, 0.824917F, - 0.826582F, 0.828256F, 0.829938F, 0.831629F, 0.833329F, 0.835038F, 0.836756F, 0.838483F, - 0.840219F, 0.841964F, 0.843719F, 0.845482F, 0.847256F, 0.849038F, 0.850830F, 0.852632F, - 0.854444F, 0.856265F, 0.858096F, 0.859937F, 0.861788F, 0.863648F, 0.865519F, 0.867400F, - 0.869292F, 0.871193F, 0.873105F, 0.875028F, 0.876961F, 0.878905F, 0.880859F, 0.882824F, - 0.884800F, 0.886787F, 0.888786F, 0.890795F, 0.892815F, 0.894847F, 0.896890F, 0.898945F, - 0.901011F, 0.903089F, 0.905178F, 0.907279F, 0.909393F, 0.911518F, 0.913655F, 0.915805F, - 0.917967F, 0.920141F, 0.922328F, 0.924528F, 0.926740F, 0.928965F, 0.931202F, 0.933453F, - 0.935717F, 0.937994F, 0.940285F, 0.942589F, 0.944906F, 0.947238F, 0.949582F, 0.951941F, - 0.954314F, 0.956701F, 0.959102F, 0.961518F, 0.963948F, 0.966392F, 0.968851F, 0.971326F, - 0.973815F, 0.976319F, 0.978838F, 0.981373F, 0.983923F, 0.986489F, 0.989071F, 0.991668F, - 0.994282F, 0.996911F, 0.999557F, 1.002220F, 1.004899F, 1.007595F, 1.010307F, 1.013037F, - 1.015784F, 1.018548F, 1.021330F, 1.024129F, 1.026946F, 1.029781F, 1.032635F, 1.035506F, - 1.038396F, 1.041305F, 1.044233F, 1.047179F, 1.050145F, 1.053130F, 1.056134F, 1.059158F, - 1.062202F, 1.065266F, 1.068351F, 1.071455F, 1.074581F, 1.077727F, 1.080894F, 1.084083F, - 1.087293F, 1.090524F, 1.093778F, 1.097053F, 1.100351F, 1.103671F, 1.107014F, 1.110380F, - 1.113769F, 1.117181F, 1.120618F, 1.124077F, 1.127561F, 1.131070F, 1.134603F, 1.138160F, - 1.141743F, 1.145351F, 1.148985F, 1.152645F, 1.156330F, 1.160042F, 1.163781F, 1.167547F, - 1.171340F, 1.175160F, 1.179008F, 1.182885F, 1.186789F, 1.190723F, 1.194685F, 1.198676F, - 1.202698F, 1.206749F, 1.210830F, 1.214942F, 1.219085F, 1.223259F, 1.227464F, 1.231702F, - 1.235972F, 1.240274F, 1.244610F, 1.248978F, 1.253381F, 1.257818F, 1.262289F, 1.266795F, - 1.271336F, 1.275913F, 1.280526F, 1.285176F, 1.289863F, 1.294587F, 1.299348F, 1.304148F, - 1.308987F, 1.313865F, 1.318782F, 1.323740F, 1.328738F, 1.333777F, 1.338858F, 1.343980F, - 1.349146F, 1.354354F, 1.359606F, 1.364902F, 1.370242F, 1.375628F, 1.381060F, 1.386537F, - 1.392062F, 1.397635F, 1.403255F, 1.408924F, 1.414643F, 1.420411F, 1.426230F, 1.432101F, - 1.438023F, 1.443998F, 1.450026F, 1.456108F, 1.462245F, 1.468437F, 1.474685F, 1.480990F, - 1.487353F, 1.493775F, 1.500255F, 1.506796F, 1.513397F, 1.520061F, 1.526786F, 1.533575F, - 1.540429F, 1.547348F, 1.554332F, 1.561384F, 1.568504F, 1.575692F, 1.582951F, 1.590281F, - 1.597682F, 1.605157F, 1.612705F, 1.620329F, 1.628029F, 1.635807F, 1.643663F, 1.651598F, - 1.659615F, 1.667714F, 1.675896F, 1.684163F, 1.692516F, 1.700956F, 1.709485F, 1.718104F, - 1.726814F, 1.735617F, 1.744514F, 1.753508F, 1.762598F, 1.771788F, 1.781078F, 1.790470F, - 1.799966F, 1.809568F, 1.819277F, 1.829095F, 1.839024F, 1.849066F, 1.859222F, 1.869495F, - 1.879887F, 1.890399F, 1.901034F, 1.911794F, 1.922681F, 1.933697F, 1.944844F, 1.956126F, - 1.967544F, 1.979101F, 1.990799F, 2.002640F, 2.014629F, 2.026766F, 2.039056F, 2.051500F, - 2.064102F, 2.076865F, 2.089791F, 2.102884F, 2.116148F, 2.129585F, 2.143198F, 2.156992F, - 2.170970F, 2.185135F, 2.199492F, 2.214044F, 2.228794F, 2.243748F, 2.258910F, 2.274283F, - 2.289872F, 2.305682F, 2.321717F, 2.337982F, 2.354483F, 2.371223F, 2.388209F, 2.405446F, - 2.422939F, 2.440694F, 2.458717F, 2.477015F, 2.495592F, 2.514456F, 2.533614F, 2.553072F, - 2.572837F, 2.592917F, 2.613318F, 2.634050F, 2.655119F, 2.676535F, 2.698305F, 2.720439F, - 2.742945F, 2.765834F, 2.789114F, 2.812796F, 2.836891F, 2.861409F, 2.886361F, 2.911759F, - 2.937614F, 2.963941F, 2.990750F, 3.018056F, 3.045872F, 3.074214F, 3.103095F, 3.132531F, - 3.162538F, 3.193134F, 3.224335F, 3.256160F, 3.288627F, 3.321755F, 3.355566F, 3.390081F, - 3.425320F, 3.461309F, 3.498070F, 3.535629F, 3.574011F, 3.613245F, 3.653358F, 3.694381F, - 3.736344F, 3.779280F, 3.823224F, 3.868211F, 3.914279F, 3.961467F, 4.009816F, 4.059369F, - 4.110172F, 4.162272F, 4.215721F, 4.270570F, 4.326876F, 4.384697F, 4.444094F, 4.505134F, - 4.567885F, 4.632419F, 4.698814F, 4.767152F, 4.837518F, 4.910005F, 4.984708F, 5.061732F, - 5.141187F, 5.223187F, 5.307859F, 5.395334F, 5.485753F, 5.579268F, 5.676041F, 5.776243F, - 5.880061F, 5.987694F, 6.099355F, 6.215275F, 6.335701F, 6.460902F, 6.591167F, 6.726808F, - 6.868167F, 7.015611F, 7.169541F, 7.330395F, 7.498651F, 7.674831F, 7.859508F, 8.053311F, - 8.256933F, 8.471140F, 8.696777F, 8.934786F, 9.186211F, 9.452218F, 9.734114F, 10.033366F, - 10.351625F, 10.690763F, 11.052902F, 11.440462F, 11.856219F, 12.303363F, 12.785587F, 13.307186F, - 13.873188F, 14.489513F, 15.163182F, 15.902588F, 16.717843F, 17.621247F, 18.627913F, 19.756614F, - 21.030970F, 22.481117F, 24.146120F, 26.077544F, 28.344889F, 31.044135F, 34.311669F, 38.348066F, - 43.460868F, 50.146880F, 59.264216F, 72.433758F, 93.128825F, 130.380047F, 217.299736F, 651.898673F, - 0.500001F, 0.500005F, 0.500015F, 0.500029F, 0.500048F, 0.500071F, 0.500099F, 0.500132F, - 0.500170F, 0.500212F, 0.500260F, 0.500311F, 0.500368F, 0.500429F, 0.500495F, 0.500566F, - 0.500641F, 0.500722F, 0.500806F, 0.500896F, 0.500991F, 0.501090F, 0.501194F, 0.501302F, - 0.501416F, 0.501534F, 0.501657F, 0.501785F, 0.501917F, 0.502055F, 0.502197F, 0.502344F, - 0.502496F, 0.502652F, 0.502814F, 0.502980F, 0.503151F, 0.503327F, 0.503508F, 0.503694F, - 0.503885F, 0.504080F, 0.504281F, 0.504486F, 0.504696F, 0.504911F, 0.505131F, 0.505357F, - 0.505587F, 0.505822F, 0.506062F, 0.506307F, 0.506557F, 0.506812F, 0.507072F, 0.507337F, - 0.507607F, 0.507882F, 0.508162F, 0.508448F, 0.508738F, 0.509034F, 0.509335F, 0.509641F, - 0.509952F, 0.510268F, 0.510590F, 0.510916F, 0.511248F, 0.511585F, 0.511928F, 0.512276F, - 0.512629F, 0.512987F, 0.513351F, 0.513720F, 0.514094F, 0.514474F, 0.514859F, 0.515250F, - 0.515646F, 0.516048F, 0.516455F, 0.516867F, 0.517285F, 0.517709F, 0.518138F, 0.518573F, - 0.519014F, 0.519460F, 0.519912F, 0.520369F, 0.520832F, 0.521301F, 0.521776F, 0.522256F, - 0.522742F, 0.523235F, 0.523733F, 0.524236F, 0.524746F, 0.525262F, 0.525784F, 0.526311F, - 0.526845F, 0.527385F, 0.527930F, 0.528482F, 0.529041F, 0.529605F, 0.530175F, 0.530752F, - 0.531335F, 0.531924F, 0.532520F, 0.533122F, 0.533730F, 0.534345F, 0.534966F, 0.535594F, - 0.536228F, 0.536869F, 0.537516F, 0.538170F, 0.538831F, 0.539498F, 0.540172F, 0.540853F, - 0.541541F, 0.542235F, 0.542937F, 0.543645F, 0.544361F, 0.545083F, 0.545813F, 0.546549F, - 0.547293F, 0.548044F, 0.548802F, 0.549568F, 0.550341F, 0.551121F, 0.551908F, 0.552704F, - 0.553506F, 0.554316F, 0.555134F, 0.555959F, 0.556793F, 0.557633F, 0.558482F, 0.559339F, - 0.560203F, 0.561075F, 0.561956F, 0.562844F, 0.563741F, 0.564646F, 0.565559F, 0.566480F, - 0.567410F, 0.568348F, 0.569295F, 0.570250F, 0.571214F, 0.572186F, 0.573167F, 0.574157F, - 0.575156F, 0.576163F, 0.577180F, 0.578206F, 0.579240F, 0.580284F, 0.581338F, 0.582400F, - 0.583472F, 0.584554F, 0.585644F, 0.586745F, 0.587855F, 0.588975F, 0.590105F, 0.591245F, - 0.592395F, 0.593555F, 0.594725F, 0.595905F, 0.597095F, 0.598296F, 0.599508F, 0.600730F, - 0.601963F, 0.603206F, 0.604460F, 0.605726F, 0.607002F, 0.608289F, 0.609588F, 0.610898F, - 0.612219F, 0.613552F, 0.614897F, 0.616253F, 0.617621F, 0.619001F, 0.620393F, 0.621797F, - 0.623214F, 0.624643F, 0.626084F, 0.627538F, 0.629004F, 0.630484F, 0.631976F, 0.633481F, - 0.635000F, 0.636532F, 0.638077F, 0.639636F, 0.641208F, 0.642795F, 0.644395F, 0.646009F, - 0.647638F, 0.649281F, 0.650938F, 0.652610F, 0.654297F, 0.655999F, 0.657716F, 0.659448F, - 0.661195F, 0.662959F, 0.664737F, 0.666532F, 0.668343F, 0.670169F, 0.672013F, 0.673872F, - 0.675749F, 0.677642F, 0.679552F, 0.681480F, 0.683425F, 0.685387F, 0.687368F, 0.689366F, - 0.691383F, 0.693418F, 0.695471F, 0.697543F, 0.699635F, 0.701745F, 0.703875F, 0.706025F, - 0.708194F, 0.710383F, 0.712593F, 0.714824F, 0.717075F, 0.719347F, 0.721640F, 0.723955F, - 0.726292F, 0.728650F, 0.731031F, 0.733435F, 0.735861F, 0.738310F, 0.740783F, 0.743279F, - 0.745799F, 0.748344F, 0.750913F, 0.753507F, 0.756126F, 0.758770F, 0.761440F, 0.764136F, - 0.766859F, 0.769608F, 0.772385F, 0.775188F, 0.778020F, 0.780880F, 0.783768F, 0.786685F, - 0.789632F, 0.792608F, 0.795614F, 0.798650F, 0.801717F, 0.804816F, 0.807946F, 0.811109F, - 0.814304F, 0.817532F, 0.820793F, 0.824088F, 0.827418F, 0.830782F, 0.834182F, 0.837618F, - 0.841090F, 0.844599F, 0.848146F, 0.851730F, 0.855353F, 0.859015F, 0.862717F, 0.866459F, - 0.870241F, 0.874065F, 0.877931F, 0.881840F, 0.885793F, 0.889789F, 0.893830F, 0.897916F, - 0.902048F, 0.906227F, 0.910454F, 0.914729F, 0.919053F, 0.923426F, 0.927851F, 0.932326F, - 0.936854F, 0.941435F, 0.946070F, 0.950760F, 0.955506F, 0.960308F, 0.965168F, 0.970087F, - 0.975065F, 0.980104F, 0.985204F, 0.990367F, 0.995595F, 1.000887F, 1.006245F, 1.011670F, - 1.017164F, 1.022727F, 1.028362F, 1.034068F, 1.039848F, 1.045703F, 1.051635F, 1.057644F, - 1.063732F, 1.069900F, 1.076151F, 1.082486F, 1.088906F, 1.095413F, 1.102008F, 1.108694F, - 1.115472F, 1.122344F, 1.129313F, 1.136378F, 1.143544F, 1.150812F, 1.158183F, 1.165661F, - 1.173247F, 1.180943F, 1.188752F, 1.196677F, 1.204719F, 1.212882F, 1.221168F, 1.229579F, - 1.238119F, 1.246790F, 1.255595F, 1.264538F, 1.273620F, 1.282847F, 1.292220F, 1.301744F, - 1.311421F, 1.321256F, 1.331252F, 1.341414F, 1.351744F, 1.362248F, 1.372929F, 1.383793F, - 1.394842F, 1.406083F, 1.417521F, 1.429159F, 1.441004F, 1.453060F, 1.465334F, 1.477831F, - 1.490557F, 1.503518F, 1.516721F, 1.530173F, 1.543880F, 1.557850F, 1.572089F, 1.586607F, - 1.601410F, 1.616508F, 1.631908F, 1.647620F, 1.663654F, 1.680019F, 1.696725F, 1.713783F, - 1.731204F, 1.748999F, 1.767181F, 1.785761F, 1.804754F, 1.824172F, 1.844031F, 1.864344F, - 1.885128F, 1.906398F, 1.928172F, 1.950468F, 1.973305F, 1.996701F, 2.020679F, 2.045258F, - 2.070463F, 2.096317F, 2.122844F, 2.150072F, 2.178029F, 2.206743F, 2.236246F, 2.266570F, - 2.297749F, 2.329820F, 2.362822F, 2.396796F, 2.431783F, 2.467831F, 2.504988F, 2.543305F, - 2.582837F, 2.623642F, 2.665783F, 2.709326F, 2.754341F, 2.800904F, 2.849096F, 2.899003F, - 2.950718F, 3.004340F, 3.059976F, 3.117742F, 3.177762F, 3.240168F, 3.305107F, 3.372734F, - 3.443220F, 3.516748F, 3.593520F, 3.673754F, 3.757688F, 3.845585F, 3.937730F, 4.034439F, - 4.136057F, 4.242967F, 4.355593F, 4.474405F, 4.599924F, 4.732735F, 4.873491F, 5.022924F, - 5.181861F, 5.351237F, 5.532114F, 5.725702F, 5.933388F, 6.156768F, 6.397687F, 6.658295F, - 6.941104F, 7.249074F, 7.585716F, 7.955227F, 8.362662F, 8.814173F, 9.317313F, 9.881472F, - 10.518458F, 11.243340F, 12.075649F, 13.041169F, 14.174650F, 15.524081F, 17.157657F, 19.175663F, - 21.731872F, 25.074687F, 29.633163F, 36.217742F, 46.565084F, 65.190503F, 108.650157F, 325.949442F, - 0.500002F, 0.500021F, 0.500059F, 0.500115F, 0.500191F, 0.500285F, 0.500398F, 0.500530F, - 0.500681F, 0.500851F, 0.501040F, 0.501247F, 0.501474F, 0.501720F, 0.501986F, 0.502270F, - 0.502574F, 0.502896F, 0.503239F, 0.503601F, 0.503982F, 0.504383F, 0.504803F, 0.505243F, - 0.505703F, 0.506183F, 0.506683F, 0.507204F, 0.507744F, 0.508304F, 0.508885F, 0.509487F, - 0.510109F, 0.510752F, 0.511416F, 0.512101F, 0.512807F, 0.513535F, 0.514283F, 0.515054F, - 0.515846F, 0.516660F, 0.517497F, 0.518355F, 0.519236F, 0.520140F, 0.521066F, 0.522015F, - 0.522988F, 0.523984F, 0.525003F, 0.526047F, 0.527114F, 0.528206F, 0.529322F, 0.530463F, - 0.531629F, 0.532820F, 0.534036F, 0.535279F, 0.536547F, 0.537842F, 0.539163F, 0.540512F, - 0.541887F, 0.543290F, 0.544721F, 0.546180F, 0.547668F, 0.549184F, 0.550730F, 0.552305F, - 0.553910F, 0.555546F, 0.557212F, 0.558909F, 0.560638F, 0.562399F, 0.564192F, 0.566019F, - 0.567878F, 0.569771F, 0.571699F, 0.573661F, 0.575658F, 0.577692F, 0.579761F, 0.581868F, - 0.584012F, 0.586194F, 0.588414F, 0.590674F, 0.592973F, 0.595313F, 0.597695F, 0.600118F, - 0.602583F, 0.605092F, 0.607644F, 0.610242F, 0.612884F, 0.615574F, 0.618310F, 0.621094F, - 0.623927F, 0.626809F, 0.629742F, 0.632727F, 0.635764F, 0.638855F, 0.642000F, 0.645200F, - 0.648458F, 0.651772F, 0.655146F, 0.658580F, 0.662075F, 0.665633F, 0.669254F, 0.672940F, - 0.676693F, 0.680514F, 0.684404F, 0.688365F, 0.692398F, 0.696505F, 0.700688F, 0.704947F, - 0.709286F, 0.713706F, 0.718208F, 0.722795F, 0.727468F, 0.732230F, 0.737083F, 0.742028F, - 0.747069F, 0.752207F, 0.757445F, 0.762785F, 0.768230F, 0.773783F, 0.779446F, 0.785223F, - 0.791116F, 0.797128F, 0.803263F, 0.809523F, 0.815913F, 0.822436F, 0.829096F, 0.835896F, - 0.842840F, 0.849933F, 0.857179F, 0.864583F, 0.872148F, 0.879881F, 0.887785F, 0.895867F, - 0.904132F, 0.912585F, 0.921233F, 0.930082F, 0.939138F, 0.948408F, 0.957900F, 0.967620F, - 0.977577F, 0.987778F, 0.998232F, 1.008949F, 1.019937F, 1.031206F, 1.042766F, 1.054629F, - 1.066806F, 1.079308F, 1.092148F, 1.105340F, 1.118897F, 1.132833F, 1.147165F, 1.161909F, - 1.177081F, 1.192700F, 1.208786F, 1.225358F, 1.242438F, 1.260049F, 1.278215F, 1.296963F, - 1.316319F, 1.336312F, 1.356974F, 1.378338F, 1.400439F, 1.423314F, 1.447005F, 1.471554F, - 1.497008F, 1.523416F, 1.550832F, 1.579313F, 1.608922F, 1.639725F, 1.671794F, 1.705209F, - 1.740054F, 1.776420F, 1.814409F, 1.854130F, 1.895701F, 1.939254F, 1.984932F, 2.032892F, - 2.083307F, 2.136369F, 2.192289F, 2.251303F, 2.313671F, 2.379685F, 2.449672F, 2.523998F, - 2.603077F, 2.687375F, 2.777424F, 2.873830F, 2.977284F, 3.088586F, 3.208658F, 3.338574F, - 3.479591F, 3.633190F, 3.801124F, 3.985493F, 4.188825F, 4.414194F, 4.665379F, 4.947073F, - 5.265181F, 5.627237F, 6.043007F, 6.525382F, 7.091739F, 7.766070F, 8.582473F, 9.591092F, - 10.868813F, 12.539837F, 14.818691F, 18.110597F, 23.283884F, 32.596211F, 54.325654F, 162.974915F, - 0.500009F, 0.500085F, 0.500235F, 0.500462F, 0.500763F, 0.501141F, 0.501595F, 0.502125F, - 0.502733F, 0.503417F, 0.504180F, 0.505021F, 0.505941F, 0.506941F, 0.508022F, 0.509184F, - 0.510428F, 0.511756F, 0.513168F, 0.514666F, 0.516250F, 0.517923F, 0.519685F, 0.521538F, - 0.523483F, 0.525522F, 0.527657F, 0.529889F, 0.532221F, 0.534654F, 0.537191F, 0.539834F, - 0.542585F, 0.545447F, 0.548422F, 0.551514F, 0.554724F, 0.558057F, 0.561515F, 0.565101F, - 0.568820F, 0.572675F, 0.576671F, 0.580810F, 0.585098F, 0.589539F, 0.594138F, 0.598901F, - 0.603832F, 0.608937F, 0.614223F, 0.619696F, 0.625362F, 0.631228F, 0.637303F, 0.643593F, - 0.650108F, 0.656856F, 0.663846F, 0.671089F, 0.678595F, 0.686375F, 0.694442F, 0.702808F, - 0.711486F, 0.720491F, 0.729838F, 0.739544F, 0.749625F, 0.760102F, 0.770993F, 0.782320F, - 0.794107F, 0.806377F, 0.819158F, 0.832478F, 0.846368F, 0.860861F, 0.875993F, 0.891804F, - 0.908335F, 0.925632F, 0.943746F, 0.962731F, 0.982646F, 1.003557F, 1.025536F, 1.048659F, - 1.073015F, 1.098699F, 1.125816F, 1.154484F, 1.184833F, 1.217009F, 1.251175F, 1.287515F, - 1.326234F, 1.367566F, 1.411777F, 1.459169F, 1.510089F, 1.564935F, 1.624170F, 1.688329F, - 1.758041F, 1.834046F, 1.917221F, 2.008616F, 2.109495F, 2.221394F, 2.346203F, 2.486268F, - 2.644542F, 2.824791F, 3.031899F, 3.272312F, 3.554715F, 3.891108F, 4.298538F, 4.802076F, - 5.440166F, 6.274908F, 7.413567F, 9.058751F, 11.644627F, 16.300023F, 27.163978F, 81.487842F, - 0.500038F, 0.500339F, 0.500943F, 0.501851F, 0.503065F, 0.504590F, 0.506431F, 0.508592F, - 0.511082F, 0.513906F, 0.517076F, 0.520600F, 0.524491F, 0.528761F, 0.533425F, 0.538499F, - 0.544002F, 0.549953F, 0.556375F, 0.563292F, 0.570731F, 0.578722F, 0.587299F, 0.596499F, - 0.606362F, 0.616936F, 0.628269F, 0.640420F, 0.653452F, 0.667435F, 0.682450F, 0.698587F, - 0.715946F, 0.734645F, 0.754813F, 0.776601F, 0.800180F, 0.825749F, 0.853537F, 0.883811F, - 0.916884F, 0.953126F, 0.992973F, 1.036949F, 1.085685F, 1.139949F, 1.200683F, 1.269061F, - 1.346558F, 1.435055F, 1.536994F, 1.655597F, 1.795205F, 1.961818F, 2.163958F, 2.414160F, - 2.731645F, 3.147462F, 3.715243F, 4.536291F, 5.827688F, 8.153849F, 13.584290F, 40.744688F, - 0.500151F, 0.501358F, 0.503789F, 0.507471F, 0.512451F, 0.518793F, 0.526577F, 0.535910F, - 0.546920F, 0.559770F, 0.574655F, 0.591819F, 0.611557F, 0.634239F, 0.660320F, 0.690372F, - 0.725121F, 0.765494F, 0.812702F, 0.868345F, 0.934584F, 1.014408F, 1.112072F, 1.233833F, - 1.389294F, 1.593972F, 1.874676F, 2.282050F, 2.924628F, 4.084611F, 6.796751F, 20.373878F, - 0.500603F, 0.505471F, 0.515447F, 0.531043F, 0.553104F, 0.582935F, 0.622504F, 0.674808F, - 0.744536F, 0.839350F, 0.972568F, 1.169440F, 1.484165F, 2.057781F, 3.407608F, 10.190008F, - 0.502419F, 0.522499F, 0.566944F, 0.646822F, 0.788155F, 1.060678F, 1.722447F, 5.101149F, - 0.509796F, 0.601345F, 0.899976F, 2.562915F, 0.541196F, 1.306563F, 0.707107F, 0.000000F -} ; - -static const float CosTable_256 [256] = -{ - 0.500009F, 0.500085F, 0.500235F, 0.500462F, 0.500763F, 0.501141F, 0.501595F, 0.502125F, - 0.502733F, 0.503417F, 0.504180F, 0.505021F, 0.505941F, 0.506941F, 0.508022F, 0.509184F, - 0.510428F, 0.511756F, 0.513168F, 0.514666F, 0.516250F, 0.517923F, 0.519685F, 0.521538F, - 0.523483F, 0.525522F, 0.527657F, 0.529889F, 0.532221F, 0.534654F, 0.537191F, 0.539834F, - 0.542585F, 0.545447F, 0.548422F, 0.551514F, 0.554724F, 0.558057F, 0.561515F, 0.565101F, - 0.568820F, 0.572675F, 0.576671F, 0.580810F, 0.585098F, 0.589539F, 0.594138F, 0.598901F, - 0.603832F, 0.608937F, 0.614223F, 0.619696F, 0.625362F, 0.631228F, 0.637303F, 0.643593F, - 0.650108F, 0.656856F, 0.663846F, 0.671089F, 0.678595F, 0.686375F, 0.694442F, 0.702808F, - 0.711486F, 0.720491F, 0.729838F, 0.739544F, 0.749625F, 0.760102F, 0.770993F, 0.782320F, - 0.794107F, 0.806377F, 0.819158F, 0.832478F, 0.846368F, 0.860861F, 0.875993F, 0.891804F, - 0.908335F, 0.925632F, 0.943746F, 0.962731F, 0.982646F, 1.003557F, 1.025536F, 1.048659F, - 1.073015F, 1.098699F, 1.125816F, 1.154484F, 1.184833F, 1.217009F, 1.251175F, 1.287515F, - 1.326234F, 1.367566F, 1.411777F, 1.459169F, 1.510089F, 1.564935F, 1.624170F, 1.688329F, - 1.758041F, 1.834046F, 1.917221F, 2.008616F, 2.109495F, 2.221394F, 2.346203F, 2.486268F, - 2.644542F, 2.824791F, 3.031899F, 3.272312F, 3.554715F, 3.891108F, 4.298538F, 4.802076F, - 5.440166F, 6.274908F, 7.413567F, 9.058751F, 11.644627F, 16.300023F, 27.163978F, 81.487842F, - 0.500038F, 0.500339F, 0.500943F, 0.501851F, 0.503065F, 0.504590F, 0.506431F, 0.508592F, - 0.511082F, 0.513906F, 0.517076F, 0.520600F, 0.524491F, 0.528761F, 0.533425F, 0.538499F, - 0.544002F, 0.549953F, 0.556375F, 0.563292F, 0.570731F, 0.578722F, 0.587299F, 0.596499F, - 0.606362F, 0.616936F, 0.628269F, 0.640420F, 0.653452F, 0.667435F, 0.682450F, 0.698587F, - 0.715946F, 0.734645F, 0.754813F, 0.776601F, 0.800180F, 0.825749F, 0.853537F, 0.883811F, - 0.916884F, 0.953126F, 0.992973F, 1.036949F, 1.085685F, 1.139949F, 1.200683F, 1.269061F, - 1.346558F, 1.435055F, 1.536994F, 1.655597F, 1.795205F, 1.961818F, 2.163958F, 2.414160F, - 2.731645F, 3.147462F, 3.715243F, 4.536291F, 5.827688F, 8.153849F, 13.584290F, 40.744688F, - 0.500151F, 0.501358F, 0.503789F, 0.507471F, 0.512451F, 0.518793F, 0.526577F, 0.535910F, - 0.546920F, 0.559770F, 0.574655F, 0.591819F, 0.611557F, 0.634239F, 0.660320F, 0.690372F, - 0.725121F, 0.765494F, 0.812702F, 0.868345F, 0.934584F, 1.014408F, 1.112072F, 1.233833F, - 1.389294F, 1.593972F, 1.874676F, 2.282050F, 2.924628F, 4.084611F, 6.796751F, 20.373878F, - 0.500603F, 0.505471F, 0.515447F, 0.531043F, 0.553104F, 0.582935F, 0.622504F, 0.674808F, - 0.744536F, 0.839350F, 0.972568F, 1.169440F, 1.484165F, 2.057781F, 3.407608F, 10.190008F, - 0.502419F, 0.522499F, 0.566944F, 0.646822F, 0.788155F, 1.060678F, 1.722447F, 5.101149F, - 0.509796F, 0.601345F, 0.899976F, 2.562915F, 0.541196F, 1.306563F, 0.707107F, 0.000000F -} ; - -void CBlock::Dct16 (float vec [], const float cosTerms []) -{ - float tmp_e0, tmp_e1, tmp_e2, tmp_e3, tmp_e4, tmp_e5, tmp_e6, tmp_e7 ; - float tmp_o0, tmp_o1, tmp_o2, tmp_o3, tmp_o4, tmp_o5, tmp_o6, tmp_o7 ; - - tmp_e0 = vec [0] + vec [15] ; - tmp_e1 = vec [1] + vec [14] ; - tmp_e2 = vec [2] + vec [13] ; - tmp_e3 = vec [3] + vec [12] ; - tmp_e4 = vec [4] + vec [11] ; - tmp_e5 = vec [5] + vec [10] ; - tmp_e6 = vec [6] + vec [9] ; - tmp_e7 = vec [7] + vec [8] ; - - tmp_o0 = (vec [0] - vec [15]) * cosTerms [0] ; - tmp_o1 = (vec [1] - vec [14]) * cosTerms [1] ; - tmp_o2 = (vec [2] - vec [13]) * cosTerms [2] ; - tmp_o3 = (vec [3] - vec [12]) * cosTerms [3] ; - tmp_o4 = (vec [4] - vec [11]) * cosTerms [4] ; - tmp_o5 = (vec [5] - vec [10]) * cosTerms [5] ; - tmp_o6 = (vec [6] - vec [9]) * cosTerms [6] ; - tmp_o7 = (vec [7] - vec [8]) * cosTerms [7] ; - - // dct8 (tmp_e, cosTerms + 8) ; - - float itmp_e0, itmp_e1, itmp_e2, itmp_e3 ; - float itmp_o0, itmp_o1, itmp_o2, itmp_o3 ; - - itmp_e0 = tmp_e0 + tmp_e7 ; - itmp_e1 = tmp_e1 + tmp_e6 ; - itmp_e2 = tmp_e2 + tmp_e5 ; - itmp_e3 = tmp_e3 + tmp_e4 ; - - itmp_o0 = (tmp_e0 - tmp_e7) * cosTerms [8] ; - itmp_o1 = (tmp_e1 - tmp_e6) * cosTerms [9] ; - itmp_o2 = (tmp_e2 - tmp_e5) * cosTerms [10] ; - itmp_o3 = (tmp_e3 - tmp_e4) * cosTerms [11] ; - - float cosTerms12 = cosTerms [12] ; - float cosTerms13 = cosTerms [13] ; - float cosTerms14 = cosTerms [14] ; - - // even part - - float tmp0, tmp1, tmp2, tmp3 ; - - tmp0 = itmp_e0 + itmp_e3 ; - tmp1 = (itmp_e0 - itmp_e3) * cosTerms12 ; - tmp2 = itmp_e1 + itmp_e2 ; - tmp3 = (itmp_e1 - itmp_e2) * cosTerms13 ; - - vec [0] = tmp0 + tmp2 ; - vec [4] = tmp1 + tmp3; - vec [12] = (tmp1 - tmp3) * cosTerms14 ; - vec [8] = (tmp0 - tmp2) * cosTerms14 ; - vec [4] += vec [12] ; - - // odd part - - tmp0 = itmp_o0 + itmp_o3 ; - tmp2 = itmp_o1 + itmp_o2 ; - tmp1 = (itmp_o0 - itmp_o3) * cosTerms12 ; - tmp3 = (itmp_o1 - itmp_o2) * cosTerms13 ; - - itmp_o0 = tmp0 + tmp2 ; - itmp_o1 = tmp1 + tmp3; - itmp_o3 = (tmp1 - tmp3) * cosTerms14 ; - itmp_o2 = (tmp0 - tmp2) * cosTerms14 ; - itmp_o1 += itmp_o3 ; - - vec [2] = itmp_o0 + itmp_o1 ; - vec [6] = itmp_o1 + itmp_o2 ; - vec [10] = itmp_o2 + itmp_o3 ; - vec [14] = itmp_o3 ; - - // dct8 (tmp_o, cosTerms + 8) ; - - itmp_e0 = tmp_o0 + tmp_o7 ; - itmp_e1 = tmp_o1 + tmp_o6 ; - itmp_e2 = tmp_o2 + tmp_o5 ; - itmp_e3 = tmp_o3 + tmp_o4 ; - - itmp_o0 = (tmp_o0 - tmp_o7) * cosTerms [8] ; - itmp_o1 = (tmp_o1 - tmp_o6) * cosTerms [9] ; - itmp_o2 = (tmp_o2 - tmp_o5) * cosTerms [10] ; - itmp_o3 = (tmp_o3 - tmp_o4) * cosTerms [11] ; - - // even part - - tmp0 = itmp_e0 + itmp_e3 ; - tmp1 = (itmp_e0 - itmp_e3) * cosTerms12 ; - tmp2 = itmp_e1 + itmp_e2 ; - tmp3 = (itmp_e1 - itmp_e2) * cosTerms13 ; - - tmp_o0 = tmp0 + tmp2 ; - tmp_o2 = tmp1 + tmp3; - tmp_o6 = (tmp1 - tmp3) * cosTerms14 ; - tmp_o4 = (tmp0 - tmp2) * cosTerms14 ; - tmp_o2 += tmp_o6 ; - - // odd part - - tmp0 = itmp_o0 + itmp_o3 ; - tmp2 = itmp_o1 + itmp_o2 ; - tmp1 = (itmp_o0 - itmp_o3) * cosTerms12 ; - tmp3 = (itmp_o1 - itmp_o2) * cosTerms13 ; - - itmp_o0 = tmp0 + tmp2 ; - itmp_o1 = tmp1 + tmp3; - itmp_o3 = (tmp1 - tmp3) * cosTerms14 ; - itmp_o2 = (tmp0 - tmp2) * cosTerms14 ; - itmp_o1 += itmp_o3 ; - - tmp_o1 = itmp_o0 + itmp_o1 ; - tmp_o3 = itmp_o1 + itmp_o2 ; - tmp_o5 = itmp_o2 + itmp_o3 ; - - vec [1] = tmp_o0 + tmp_o1 ; - vec [3] = tmp_o1 + tmp_o2 ; - vec [5] = tmp_o2 + tmp_o3 ; - vec [7] = tmp_o3 + tmp_o4 ; - vec [9] = tmp_o4 + tmp_o5 ; - vec [11] = tmp_o5 + tmp_o6 ; - vec [13] = tmp_o6 + itmp_o3 ; - vec [15] = itmp_o3 ; -} - -void CBlock::Dct128 (float vec [], const float cosTerms []) -{ - float tmp_e4 [64], tmp_o4 [64] ; - float tmp_e5 [32], tmp_o5 [32] ; - float tmp_e6 [16], tmp_o6 [16] ; - - Split (vec, tmp_e4, tmp_o4, cosTerms, 128) ; - Split (tmp_e4, tmp_e5, tmp_o5, cosTerms + 64, 64) ; - Split (tmp_e5, tmp_e6, tmp_o6, cosTerms + 96, 32) ; - - Dct16 (tmp_e6, cosTerms + 112) ; // Even Terms - Dct16 (tmp_o6, cosTerms + 112) ; // Odd Terms - - Merge (tmp_e5, tmp_e6, tmp_o6, 32) ; - Split (tmp_o5, tmp_e6, tmp_o6, cosTerms + 96, 32) ; - - Dct16 (tmp_e6, cosTerms + 112) ; // Even Terms - Dct16 (tmp_o6, cosTerms + 112) ; // Odd Terms - - Merge (tmp_o5, tmp_e6, tmp_o6, 32) ; - Merge (tmp_e4, tmp_e5, tmp_o5, 64) ; - - Split (tmp_o4, tmp_e5, tmp_o5, cosTerms + 64, 64) ; - Split (tmp_e5, tmp_e6, tmp_o6, cosTerms + 96, 32) ; - - Dct16 (tmp_e6, cosTerms + 112) ; // Even Terms - Dct16 (tmp_o6, cosTerms + 112) ; // Odd Terms - - Merge (tmp_e5, tmp_e6, tmp_o6, 32) ; - Split (tmp_o5, tmp_e6, tmp_o6, cosTerms + 96, 32) ; - - Dct16 (tmp_e6, cosTerms + 112) ; // Even Terms - Dct16 (tmp_o6, cosTerms + 112) ; // Odd Terms - - Merge (tmp_o5, tmp_e6, tmp_o6, 32) ; - Merge (tmp_o4, tmp_e5, tmp_o5, 64) ; - Merge (vec, tmp_e4, tmp_o4, 128) ; -} - -void CBlock::Dct1024 (float vec [], const float cosTerms []) -{ - float tmp_e0 [512], tmp_o0 [512] ; - float tmp_e1 [256], tmp_o1 [256] ; - float tmp_e2 [128], tmp_o2 [128] ; - - Split (vec, tmp_e0, tmp_o0, cosTerms, 1024) ; - Split (tmp_e0, tmp_e1, tmp_o1, cosTerms + 512, 512) ; - Split (tmp_e1, tmp_e2, tmp_o2, cosTerms + 768, 256) ; - - Dct128 (tmp_e2, cosTerms + 896) ; // Even Terms - Dct128 (tmp_o2, cosTerms + 896) ; // Odd Terms - - Merge (tmp_e1, tmp_e2, tmp_o2, 256) ; - Split (tmp_o1, tmp_e2, tmp_o2, cosTerms + 768, 256) ; - - Dct128 (tmp_e2, cosTerms + 896) ; // Even Terms - Dct128 (tmp_o2, cosTerms + 896) ; // Odd Terms - - Merge (tmp_o1, tmp_e2, tmp_o2, 256) ; - Merge (tmp_e0, tmp_e1, tmp_o1, 512) ; - - Split (tmp_o0, tmp_e1, tmp_o1, cosTerms + 512, 512) ; - Split (tmp_e1, tmp_e2, tmp_o2, cosTerms + 768, 256) ; - - Dct128 (tmp_e2, cosTerms + 896) ; // Even Terms - Dct128 (tmp_o2, cosTerms + 896) ; // Odd Terms - - Merge (tmp_e1, tmp_e2, tmp_o2, 256) ; - Split (tmp_o1, tmp_e2, tmp_o2, cosTerms + 768, 256) ; - - Dct128 (tmp_e2, cosTerms + 896) ; // Even Terms - Dct128 (tmp_o2, cosTerms + 896) ; // Odd Terms - - Merge (tmp_o1, tmp_e2, tmp_o2, 256) ; - Merge (tmp_o0, tmp_e1, tmp_o1, 512) ; - Merge (vec, tmp_e0, tmp_o0, 1024) ; -} - -void CLongBlock::InverseTransform (float data []) -{ - const int N = 2048 ; - - float tmp_out [N / 2] ; - - int i ; - - for (i = 0 ; i < N / 2 ; i++) - { - tmp_out [i] = (data [i] * (2.0F / N))* CosTable_2048 [i] ; - } - - Dct1024 (tmp_out, &CosTable_2048 [N / 2]) ; - - for (i = 0 ; i < N / 2 - 1 ; i++) - { - tmp_out [i] += tmp_out [i + 1] ; - } - - for (i = 0 ; i < N / 4 ; i++) - { - data [i] = tmp_out [N / 4 + i] ; - data [N / 2 - i - 1] = -tmp_out [N / 4 + i] ; - data [N / 2 + N / 4 + i] = -tmp_out [i] ; - data [N / 2 + N / 4 - i - 1] = -tmp_out [i] ; - } -} - -void CShortBlock::InverseTransform (float data []) -{ - const int N = 256 ; - - float tmp_out [N / 2] ; - - int i ; - - for (i = 0 ; i < N / 2 ; i++) - { - tmp_out [i] = (data [i] * (2.0F / N)) * CosTable_256 [i] ; - } - - Dct128 (tmp_out, &CosTable_256 [N / 2]) ; - - for (i = 0 ; i < N / 2 - 1 ; i++) - { - tmp_out [i] += tmp_out [i + 1] ; - } - - for (i = 0 ; i < N / 4 ; i++) - { - data [i] = tmp_out [N / 4 + i] ; - data [N / 2 - i - 1] = -tmp_out [N / 4 + i] ; - data [N / 2 + N / 4 + i] = -tmp_out [i] ; - data [N / 2 + N / 4 - i -1] = -tmp_out [i] ; - } -} - -#if defined (WIN32) && defined (_M_IX86) -#pragma message (__FILE__": using x86 inline assembler") - -void CBlock::Split (const float vector [], float tmp_e [], float tmp_o [], const float cosTerms [], int vecsize) -{ - // tmp_e [i] = t0 + t1 ; - // tmp_o [i] = (t0 - t1) * cosTerms [i] ; - - _asm - { - mov ecx, vecsize - shr ecx, 1 - - mov esi, dword ptr [vector] - mov edi, dword ptr [cosTerms] - - mov eax, dword ptr [tmp_e] - mov ebx, dword ptr [tmp_o] - - mov edx, dword ptr [vecsize] - shl edx, 2 - add edx, esi - - fldz - -label : - - fld dword ptr [esi] - fld dword ptr [esi] - - fsub dword ptr [edx-4] - fxch st(1) - - fadd dword ptr [edx-4] - fxch st(2) - - fld dword ptr [esi+4] - fld dword ptr [esi+4] - - fsub dword ptr [edx-8] - fxch st(1) - - fadd dword ptr [edx-8] - fxch st(3) - - fmul dword ptr [edi] - fxch st(4) - - fstp dword ptr [eax] - - fmul dword ptr [edi+4] - fxch st(2) - - fstp dword ptr [eax+4] - fxch st(2) - - fstp dword ptr [ebx] - - add esi, 8 - add edi, 8 - - fstp dword ptr [ebx+4] - - // // // - - fld dword ptr [esi] - fld dword ptr [esi] - - fsub dword ptr [edx-12] - fxch st(1) - - fadd dword ptr [edx-12] - fxch st(2) - - fld dword ptr [esi+4] - fld dword ptr [esi+4] - - fsub dword ptr [edx-16] - fxch st(1) - - fadd dword ptr [edx-16] - fxch st(3) - - fmul dword ptr [edi] - fxch st(4) - - fstp dword ptr [eax+8] - - fmul dword ptr [edi+4] - fxch st(2) - - fstp dword ptr [eax+12] - fxch st(2) - - fstp dword ptr [ebx+8] - - add esi, 8 - add edi, 8 - - fstp dword ptr [ebx+12] - - // // // - - sub edx, 16 - add eax, 16 - - add ebx, 16 - sub ecx, 4 - - jne label - - fstp st(0) - } -} - -void CBlock::Merge (float vector [], const float tmp_e [], const float tmp_o [], int vecsize) -{ - __asm - { - mov ecx, vecsize - shr ecx, 1 - sub ecx, 8 - - mov edx, dword ptr [tmp_o] - mov edi, dword ptr [tmp_e] - - mov esi, dword ptr [vector] - -label : - - fld dword ptr [edx + ecx*4] - fadd dword ptr [edx + ecx*4 + 4] - - fld dword ptr [edx + ecx*4 + 4] - fadd dword ptr [edx + ecx*4 + 8] - - fld dword ptr [edx + ecx*4 + 8] - fadd dword ptr [edx + ecx*4 + 12] - - fld dword ptr [edx + ecx*4 + 12] - fadd dword ptr [edx + ecx*4 + 16] - fxch st(3) - - fstp dword ptr [esi + ecx*8 + 4] - - mov eax, dword ptr [edi + ecx*4] - mov ebx, dword ptr [edi + ecx*4 + 4] - - fstp dword ptr [esi + ecx*8 + 20] - - mov dword ptr [esi + ecx*8], eax - mov dword ptr [esi + ecx*8 + 8], ebx - - fstp dword ptr [esi + ecx*8 + 12] - - mov eax, dword ptr [edi + ecx*4 + 8] - mov ebx, dword ptr [edi + ecx*4 + 12] - - fstp dword ptr [esi + ecx*8 + 28] - - mov dword ptr [esi + ecx*8 + 16], eax - mov dword ptr [esi + ecx*8 + 24], ebx - - fld dword ptr [edx + ecx*4 + 16] - fadd dword ptr [edx + ecx*4 + 20] - - fld dword ptr [edx + ecx*4 + 20] - fadd dword ptr [edx + ecx*4 + 24] - - fld dword ptr [edx + ecx*4 + 24] - fadd dword ptr [edx + ecx*4 + 28] - - fld dword ptr [edx + ecx*4 + 28] - fadd dword ptr [edx + ecx*4 + 32] - fxch st(3) - - fstp dword ptr [esi + ecx*8 + 36] - - mov eax, dword ptr [edi + ecx*4 + 16] - mov ebx, dword ptr [edi + ecx*4 + 20] - - fstp dword ptr [esi + ecx*8 + 52] - - mov dword ptr [esi + ecx*8 + 32], eax - mov dword ptr [esi + ecx*8 + 40], ebx - - fstp dword ptr [esi + ecx*8 + 44] - - mov eax, dword ptr [edi + ecx*4 + 24] - mov ebx, dword ptr [edi + ecx*4 + 28] - - fstp dword ptr [esi + ecx*8 + 60] - - mov dword ptr [esi + ecx*8 + 48], eax - mov dword ptr [esi + ecx*8 + 56], ebx - - sub ecx, 8 - jne label - - // zero element - - fld dword ptr [edx] - fadd dword ptr [edx + 4] - - fld dword ptr [edx + 4] - fadd dword ptr [edx + 8] - - fld dword ptr [edx + 8] - fadd dword ptr [edx + 12] - - fld dword ptr [edx + 12] - fadd dword ptr [edx + 16] - fxch st(3) - - fstp dword ptr [esi + 4] - - mov eax, dword ptr [edi] - mov ebx, dword ptr [edi + 4] - - fstp dword ptr [esi + 20] - - mov dword ptr [esi], eax - mov dword ptr [esi + 8], ebx - - fstp dword ptr [esi + 12] - - mov eax, dword ptr [edi + 8] - mov ebx, dword ptr [edi + 12] - - fstp dword ptr [esi + 28] - - mov dword ptr [esi + 16], eax - mov dword ptr [esi + 24], ebx - - fld dword ptr [edx + 16] - fadd dword ptr [edx + 20] - - fld dword ptr [edx + 20] - fadd dword ptr [edx + 24] - - fld dword ptr [edx + 24] - fadd dword ptr [edx + 28] - - fld dword ptr [edx + 28] - fadd dword ptr [edx + 32] - fxch st(3) - - fstp dword ptr [esi + 36] - - mov eax, dword ptr [edi + 16] - mov ebx, dword ptr [edi + 20] - - fstp dword ptr [esi + 52] - - mov dword ptr [esi + 32], eax - mov dword ptr [esi + 40], ebx - - fstp dword ptr [esi + 44] - - mov eax, dword ptr [edi + 24] - mov ebx, dword ptr [edi + 28] - - fstp dword ptr [esi + 60] - - mov dword ptr [esi + 48], eax - mov dword ptr [esi + 56], ebx - } - - vector [vecsize - 2] = tmp_e [vecsize / 2 - 1] ; - vector [vecsize - 1] = tmp_o [vecsize / 2 - 1] ; -} - -#else - -void CBlock::Split (const float vector [], float tmp_e [], float tmp_o [], const float cosTerms [], int vecsize) -{ - for (int i = 0 ; i < vecsize / 2 ; i++) - { - tmp_e [i] = vector [i] + vector [vecsize - i - 1] ; - tmp_o [i] = (vector [i] - vector [vecsize - i - 1]) * cosTerms [i] ; - } -} - -void CBlock::Merge (float vector [], const float tmp_e [], const float tmp_o [], int vecsize) -{ - for (int i = 0 ; i < vecsize / 2 - 1 ; i++) - { - vector [i * 2] = tmp_e [i] ; - vector [i * 2 + 1] = tmp_o [i] + tmp_o [i + 1] ; - } - - vector [vecsize - 2] = tmp_e [vecsize / 2 - 1] ; - vector [vecsize - 1] = tmp_o [vecsize / 2 - 1] ; -} - -#endif - diff --git a/Src/vlb/longblock.cpp b/Src/vlb/longblock.cpp deleted file mode 100644 index 086d63038..000000000 --- a/Src/vlb/longblock.cpp +++ /dev/null @@ -1,512 +0,0 @@ -/* $Header: /cvs/root/winamp/vlb/longblock.cpp,v 1.2 2011/06/13 02:06:03 audiodsp Exp $ */ - -/***************************************************************************\ - * - * Copyright 2000-2002 Dolby Laboratories, Inc. All Rights - * Reserved. Do not copy. Do not distribute. - * Confidential information. - * - * (C) copyright Fraunhofer - IIS (1998) - * All Rights Reserved - * - * filename: longblock.cpp - * project : MPEG-2 AAC Decoder - * contents/description: long window sequence object - * - * $Header: /cvs/root/winamp/vlb/longblock.cpp,v 1.2 2011/06/13 02:06:03 audiodsp Exp $ - * -\***************************************************************************/ - -#include // pow() - -#include "block.h" -#include "bitstream.h" -#include "channelinfo.h" -#include "overlapadd.h" - -#ifdef MAIN_PROFILE -#include "prediction.h" -#endif - -// ctor/dtor - -CLongBlock::CLongBlock (CChannelInfo &info) - : CBlock (info) -{ - m_SectBits = 5 ; -} - -CLongBlock::~CLongBlock () -{ -} - -// low-level access - -float *CLongBlock::AccessSpectralData (int /* window = 0 */) -{ - return m_SpectralCoefficient ; -} - -int *CLongBlock::AccessCodeBooks (int /* group */) -{ - return m_CodeBook ; -} - -int *CLongBlock::AccessScaleFactors (int /* group */) -{ - return m_ScaleFactor ; -} - -// readers -#include -#include -#include -void CLongBlock::ReadSectionData (CDolbyBitStream &bs) -{ - CVLBBitSequence sect_cb (4) ; - CVLBBitSequence sect_len_incr (m_SectBits) ; - - int sect_esc_val = (1 << m_SectBits) - 1 ; - - int band ; // msdev not ansi - - //Section Information: - int iNumberOfSections; - iNumberOfSections=0; - sSectionInfoStruct.aiSectionCount[0]=0; - sSectionInfoStruct.aaiSectionStart[0][0]=0; - for (band = 0 ; band < m_IcsInfo.GetScaleFactorBandsTransmitted () ; ) - { - - sect_cb.Read (bs) ; - sect_len_incr.Read (bs) ; - - int sect_len = 0 ; - - while (sect_len_incr == sect_esc_val) - { - sect_len += sect_esc_val ; - sect_len_incr.Read (bs) ; - } - - sect_len += sect_len_incr ; - - for (int top = band + sect_len ; band < top ; band++) - { - m_CodeBook [band] = sect_cb ; - - if ((m_CodeBook [band] == BOOKSCL) || - (m_CodeBook [band] == RESERVED_HCB) - ) - { - throw EInvalidCodeBook () ; - } - } - - sSectionInfoStruct.aaiSectionCodebooks[0][iNumberOfSections]=sect_cb; - sSectionInfoStruct.aaiSectionStart[0][iNumberOfSections+1]=band; - sSectionInfoStruct.aaiSectionEnd[0][iNumberOfSections]=band; - sSectionInfoStruct.aiSectionCount[0]++; - iNumberOfSections++; - } - if(band < m_IcsInfo.GetScaleFactorBandsTotal() && m_IcsInfo.GetScaleFactorBandsTransmitted()){ - sSectionInfoStruct.aaiSectionCodebooks[0][iNumberOfSections]=ZERO_HCB; - sSectionInfoStruct.aaiSectionEnd[0][iNumberOfSections]= m_IcsInfo.GetScaleFactorBandsTotal (); - sSectionInfoStruct.aiSectionCount[0]++; - iNumberOfSections++; - } - for ( ; band < m_IcsInfo.GetScaleFactorBandsTotal () ; band++) - { - m_CodeBook [band] = ZERO_HCB ; - } -} - -void CLongBlock::ReadScaleFactorData (CDolbyBitStream &bs, const int global_gain) -{ - const CodeBookDescription *hcb = &HuffmanCodeBooks [BOOKSCL] ; - - int factor = global_gain ; - int position = 0 ; - - int temp ; - - for (int band = 0 ; band < m_IcsInfo.GetScaleFactorBandsTransmitted () ; band++) - { - switch (m_CodeBook [band]) - { - case ZERO_HCB : // zero book - - m_ScaleFactor [band] = 0 ; - break ; - - default : // regular scale factor - - temp = DecodeHuffmanWord (bs, hcb->CodeBook) ; - factor += temp - 60 ; // MIDFAC 1.5 dB - - m_ScaleFactor [band] = factor - 100 ; - break ; - - case INTENSITY_HCB : // intensity steering - case INTENSITY_HCB2 : - - temp = DecodeHuffmanWord (bs, hcb->CodeBook) ; - position += temp - 60 ; - - m_ScaleFactor [band] = position - 100 ; - -#ifdef MAIN_PROFILE - // use of intensity stereo overrides prediction_used mask - m_IcsInfo.DeactivatePrediction (band) ; -#endif - - break ; - } - } -} - -void CLongBlock::ReadSpectralData (CDolbyBitStream &bs) -{ - int QuantizedCoef [MaximumBins] ; - - int index, band ; // msdev for scoping not ansi - - for (index = 0 ; index < MaximumBins ; index++) - { - QuantizedCoef [index] = 0 ; - } - - const int *BandOffsets = m_IcsInfo.GetScaleFactorBandOffsets () ; - - for (band = 0 ; band < m_IcsInfo.GetScaleFactorBandsTransmitted () ; band++) - { - if ((m_CodeBook [band] == ZERO_HCB) || - (m_CodeBook [band] == INTENSITY_HCB) || - (m_CodeBook [band] == INTENSITY_HCB2) - ) - continue ; - - const CodeBookDescription *hcb = &HuffmanCodeBooks [m_CodeBook [band]] ; - - int step = 0 ; - - for (index = BandOffsets [band] ; index < BandOffsets [band + 1] ; index += step) - { - step = UnpackIndex (DecodeHuffmanWord (bs, hcb->CodeBook), &QuantizedCoef [index], hcb) ; - - if (!hcb->IsSigned) - { - for (int i = 0 ; i < step ; i++) - { - if (QuantizedCoef [index + i]) - { - if (bs.Get (1)) // sign bit - { - QuantizedCoef [index + i] = -QuantizedCoef [index + i] ; - } - } - } - } - - if (m_CodeBook [band] == ESCBOOK) - { - QuantizedCoef [index] = GetEscape (bs, QuantizedCoef [index]) ; - QuantizedCoef [index + 1] = GetEscape (bs, QuantizedCoef [index + 1]) ; - } - } - } - - m_PulseData.Apply (m_IcsInfo, QuantizedCoef) ; - - // dequantize and apply scalefactors - - for (index = 0, band = 0 ; band < m_IcsInfo.GetScaleFactorBandsTransmitted () ; band++) - { - float factor = static_cast(m_ScaleFactor [band]) ; - - if ((factor >= 0) && (factor < ExpTableSize)) - { - factor = m_ExpTable [m_ScaleFactor [band]] ; - } - else - { - if (m_ScaleFactor [band] == -100) - { - for (index = BandOffsets [band] ; index < BandOffsets [band + 1] ; index++) - { - m_SpectralCoefficient [index] = 0.0F ; - } - - continue ; - } - - factor = static_cast(pow (2.0F, 0.25F * factor)) ; - } - - for (index = BandOffsets [band] ; index < BandOffsets [band + 1] ; index++) - { - m_SpectralCoefficient [index] = InverseQuantize (QuantizedCoef [index]) * factor ; - } - } - - // zero out spectral data beyond max_sfb - // index is now first bin of max_sfb+1 - - for ( ; index < MaximumBins ; index++) - { - m_SpectralCoefficient [index] = 0.0F ; - } -} - -void CLongBlock::ApplyWindowFunction (COverlapAddBuffer &Previous) -{ - int i ; - - switch (m_IcsInfo.GetWindowSequence ()) - { - case CChannelInfo::OnlyLongSequence : - -#if defined (WIN32) && defined (_M_IX86) - - PentiumWindow (m_SpectralCoefficient, m_LongWindow [Previous.GetWindowShape ()], m_LongWindow [m_IcsInfo.GetWindowShape ()]) ; - -#else - - for (i = 0 ; i < 1024 ; i++) - { - m_SpectralCoefficient [i] *= m_LongWindow [Previous.GetWindowShape ()][i] ; - m_SpectralCoefficient [1024 + i] *= m_LongWindow [m_IcsInfo.GetWindowShape ()][1023 - i] ; - } - -#endif - - break ; - - case CChannelInfo::LongStartSequence : - - for (i = 0 ; i < 1024 ; i++) - { - m_SpectralCoefficient [i] *= m_LongWindow [Previous.GetWindowShape ()][i] ; - } - - for (i = 0 ; i < 128 ; i++) - { - m_SpectralCoefficient [1472 + i] *= m_ShortWindow [m_IcsInfo.GetWindowShape ()][127 - i] ; - } - - for (i = 1600 ; i < 2048 ; i++) - { - m_SpectralCoefficient [i] = 0.0F ; - } - - break ; - - case CChannelInfo::LongStopSequence : - - for (i = 0 ; i < 448 ; i++) - { - m_SpectralCoefficient [i] = 0.0F ; - } - - for (i = 0 ; i < 128 ; i++) - { - m_SpectralCoefficient [448 + i] *= m_ShortWindow [Previous.GetWindowShape ()][i] ; - } - - for (i = 0 ; i < 1024 ; i++) - { - m_SpectralCoefficient [1024 + i] *= m_LongWindow [m_IcsInfo.GetWindowShape ()][1023 - i] ; - } - - break ; - } - - Previous.SetWindowShape (m_IcsInfo.GetWindowShape ()) ; -} - -void CLongBlock::FrequencyToTime_Fast (COverlapAddBuffer &Previous) -{ - InverseTransform (m_SpectralCoefficient) ; - ApplyWindowFunction (Previous) ; - -#if defined (WIN32) && defined (_M_IX86) - - PentiumOverlap (m_Output, m_SpectralCoefficient, Previous.AccessBuffer (), 1) ; - -#else - - for (int i = 0 ; i < 1024 ; i++) - { - // add first half and old data - - m_Output[i] = m_SpectralCoefficient [i] + Previous [i] ; - - // store second half as old data - - Previous [i] = m_SpectralCoefficient [1024 + i] ; - } - -#endif -} - -void CLongBlock::FrequencyToTime (COverlapAddBuffer &Previous, float Output [], const int stride) -{ - InverseTransform (m_SpectralCoefficient) ; - ApplyWindowFunction (Previous) ; - - for (int i = 0 ; i < 1024 ; i++) - { - // add first half and old data - - Output [i * stride] = m_SpectralCoefficient [i] + Previous [i] ; - - // store second half as old data - - Previous [i] = m_SpectralCoefficient [1024 + i] ; - } -} - -void CLongBlock::FrequencyToTime (COverlapAddBuffer &Previous) -{ - InverseTransform (m_SpectralCoefficient) ; - ApplyWindowFunction (Previous) ; - - for (int i = 0 ; i < 1024 ; i++) - { - m_Output[i]=m_SpectralCoefficient [i] + Previous [i] ; - Previous [i] = m_SpectralCoefficient [1024 + i] ; - } -} - -void CLongBlock::ApplyEqualizationMask (float Mask []) -{ - for (int i = 0 ; i < EqualizationMaskLength ; i++) - { - for (int j = 0 ; j < (MaximumBins / EqualizationMaskLength) ; j++) - { - m_SpectralCoefficient [(MaximumBins / EqualizationMaskLength) * i + j] *= Mask [i] ; - } - } -} - -#if defined (WIN32) && defined (_M_IX86) -#pragma message (__FILE__": using x86 inline assembler") - -// this CBlock method goes here, because we'd prefer it to be inlined -// with CLongBlock. not all compilers support inter-module optimizations. - -void CBlock::PentiumOverlap (float output [], float spec [], float prev [], unsigned int stride) -{ - const float minval = -32767.0F ; - - __asm - { - shl stride, 2 // stride *= sizeof(float) - - mov esi, dword ptr [output] // esi is pcm output pointer - - mov ebx, 0x00 // ebx is buffer index - - mov edx, dword ptr [spec] - mov ecx, dword ptr [prev] - -entry: - - fld dword ptr [edx + ebx*4] // get: spec [i] - fadd dword ptr [ecx + ebx*4] // get: spec [i] + prev [i] - mov eax, dword ptr [edx + ebx*4 + 0x1000] // get: spec [1024 + i] - mov dword ptr [ecx + ebx*4],eax // put: prev [i] = spec [1024 + i] - fst dword ptr [esi] // put: output [i] = spec [i] + prev [i] - - add esi, stride - - fstp st(0) - - inc ebx - cmp ebx, 1024 - jne entry - - } -} - -void CLongBlock::PentiumWindow (float spec [], const float prev [], const float curr []) -{ - __asm - { - mov ebx, 0x0100 - - mov edx, dword ptr [spec] - mov esi, dword ptr [curr] - mov ecx, dword ptr [prev] - - add esi, 4 * 0x03FC - -entry: - - // previous shape - - fldz - - fld dword ptr [edx] - fmul dword ptr [ecx] - fxch - - fld dword ptr [edx + 0x04] - fmul dword ptr [ecx + 0x04] - fxch - - fld dword ptr [edx + 0x08] - fmul dword ptr [ecx + 0x08] - fxch - - fld dword ptr [edx + 0x0C] - fmul dword ptr [ecx + 0x0C] - fxch st(4) - - fstp dword ptr [edx] - fxch st(2) - - fstp dword ptr [edx + 0x04] - fstp dword ptr [edx + 0x08] - fxch - - fstp dword ptr [edx + 0x0C] - - // current shape - - fld dword ptr [edx + 0x1000] - fmul dword ptr [esi + 0x0C] - fxch - - fld dword ptr [edx + 0x1004] - fmul dword ptr [esi + 0x08] - fxch - - fld dword ptr [edx + 0x1008] - fmul dword ptr [esi + 0x04] - fxch - - fld dword ptr [edx + 0x100C] - fmul dword ptr [esi] - - fxch st(4) - fstp dword ptr [edx + 0x1000] - - fxch st(2) - fstp dword ptr [edx + 0x1004] - - fstp dword ptr [edx + 0x1008] - - fstp st(0) - fstp dword ptr [edx + 0x100C] - - add edx, 0x10 - sub esi, 0x10 - add ecx, 0x10 - - dec ebx - jne entry - } -} - -#endif diff --git a/Src/vlb/nsv_vlb.cpp b/Src/vlb/nsv_vlb.cpp deleted file mode 100644 index f6aae723e..000000000 --- a/Src/vlb/nsv_vlb.cpp +++ /dev/null @@ -1,170 +0,0 @@ -#include "nsv_vlb.h" - -/////////////////////////////////////////////////////////////////////// -// -// NSV VLB Decoder -// -/////////////////////////////////////////////////////////////////////// - -VLB_Decoder::VLB_Decoder() -{ - aacdec = new CAacDecoderApi( &datain ); - fused = 0; - needsync = 1; - packets_in_since_flush = 0; - packets_decoded_since_flush = 0; -} - -VLB_Decoder::~VLB_Decoder() -{ - delete aacdec; -} - -void VLB_Decoder::flush() -{ - datain.Empty(); - dataout.Empty(); - - //OutputDebugString("FLUSH\n"); - - - // JF> this seems to be necessary for me at least, to have aacdec's internal buffer and state get reset :/ - // (especially for AAC files, but I got it to do weird stuff on VLB files too :/) - // might be cleaner to see if we can just clear it somehow manually.. hmm.. - delete aacdec; - aacdec = new CAacDecoderApi( &datain ); - fused = 0; - needsync = 1; - packets_in_since_flush = 0; - packets_decoded_since_flush = 0; -} - - -int VLB_Decoder::decode( void *in, int in_len, - void *out, int *out_len, - unsigned int out_fmt[8] ) -{ - // This function gets called with 1 nsv frame's worth of audio data. - // That could mean 1 OR MORE audio packets. (or zero?) - // Just process the smallest amount (1 packet) and return 0 if you - // finished processing this big chunk, or 1 if you need to work on - // extracting more audio (from this same nsv frame) on the next call. - - // RETURN VALUES: - // 1: call me again w/same buffer (and contents) next time - // 0: give me a new buffer (w/new frame contents) next time - - AUDIO_FORMATINFO info; - - int rval = 1; - - if (!dataout.BytesAvail()) - { - int l = datain.GetInputFree(); // the # of bytes that datain still has room for - if ( l > in_len - fused ) l = in_len - fused; - - if ( l > 0) - { - datain.Fill( (unsigned char *)in + fused, l ); - fused += l; - } - - /*********************************/ - if (in_len > 0) - packets_in_since_flush++; -#define PACKETS_TO_PREBUFFER_BEFORE_SYNCHRONIZE 2 - if (needsync && packets_in_since_flush < PACKETS_TO_PREBUFFER_BEFORE_SYNCHRONIZE) - { - // Don't allow ourselves to call Synchronize() until we've actually received - // TWO audio packets. We need two because Synchronize() peeks ahead beyond - // the first packet, and throws an exception if the second one isn't also available. - // (note that if we were worried about getting partial frames from the nsv decoder, - // we'd want to set PACKETS_TO_PREBUFFER==3...) - fused = 0; - *out_len = 0; - return 0; - } - /*********************************/ - - if (!datain.GetSize()) - { - if ( fused >= in_len ) rval = fused = 0; // get more data - *out_len = 0; - return rval; - } - - if (needsync) - { - int status = aacdec->Synchronize( ¶ms ); // returns # of bytes skipped forward through 'datain' in params.frame_length - if (status) - { - // ERROR - *out_len = 0; - if ( fused >= in_len ) rval = fused = 0; // get more data - return rval; - } - - needsync = 0; - - // NOTE: as long as the NSV file was encoded properly (i.e. all vlb audio packets were - // sent to the encoder intact, never split among two nsv frames), we don't have to worry - // about ever getting back a partial frame from the NSV decoder; it will sync for us, - // and hand us the 1st complete audio packet it can find. - // In short: Synchronize() should always return with params.frame_length==0. - /* - int bytes_skipped = params.frame_length; - if (bytes_skipped) - { - // here we assume that the first packet was partially or entirely skipped through - // (but that the 2nd and 3rd packets were 100% okay), so we won't try to decode - // that first packet. - packets_in_since_flush--; - } - */ - - info.ucNChannels = (unsigned char) params.num_channels; - info.uiSampleRate = params.sampling_frequency; - - dataout.SetFormatInfo( &info ); - } - - while (packets_decoded_since_flush < packets_in_since_flush) - { - int status = aacdec->DecodeFrame( &dataout, ¶ms ); // returns # of bytes consumed from 'datain' in params.frame_length - packets_decoded_since_flush++; - if ( status > ERR_NO_ERROR && status != ERR_END_OF_FILE) - { - // ERROR - flush(); - break; - } - } - - if (packets_decoded_since_flush > 64) - { - // avoid overflow, but don't let either of these vars drop back to 0, 1, or 2! - packets_in_since_flush -= 32; - packets_decoded_since_flush -= 32; - } - } - - int l = dataout.BytesAvail(); - if (l > 0) - { - if ( l > *out_len ) l = *out_len; - else *out_len = l; - - dataout.PullBytes( (unsigned char *)out, l ); - - info = dataout.GetFormatInfo(); - - out_fmt[0] = NSV_MAKETYPE( 'P', 'C', 'M', ' ' ); - out_fmt[1] = info.uiSampleRate; - out_fmt[2] = info.ucNChannels; - out_fmt[3] = 16; - out_fmt[4] = params.bitrate; - } - else *out_len = 0; - - return rval; -} \ No newline at end of file diff --git a/Src/vlb/nsv_vlb.h b/Src/vlb/nsv_vlb.h deleted file mode 100644 index 0a7bdfa52..000000000 --- a/Src/vlb/nsv_vlb.h +++ /dev/null @@ -1,42 +0,0 @@ -#pragma once -#include "aacdecoderapi.h" -#include "vlbout.h" -#include "VLBIO.h" -#include "../nsv/dec_if.h" -#include "../nsv/nsvlib.h" -/* -#if (defined WIN32 && !defined __ICL) -// Ignore libraries the aacplus library references (but doesn't need) -#pragma comment(linker, "-nodefaultlib:libmmt.lib") -#pragma comment(linker, "-nodefaultlib:libircmt.lib") -#pragma comment(linker, "-nodefaultlib:svml_disp.lib") -#endif -*/ - -/////////////////////////////////////////////////////////////////////// -// -// Class Declarations -// -/////////////////////////////////////////////////////////////////////// - - -class VLB_Decoder : public IAudioDecoder -{ -public: - VLB_Decoder(); - ~VLB_Decoder(); - int decode( void *in, int in_len, - void *out, int *out_len, - unsigned int out_fmt[8] ); - void flush(); -private: - //FILE* m_f; - CAacDecoderApi *aacdec; - VLBIn datain; - VLBOut dataout; - AACStreamParameters params; - int fused; - int needsync; - int packets_in_since_flush; - int packets_decoded_since_flush; -}; diff --git a/Src/vlb/obj_vlbDecoder.cpp b/Src/vlb/obj_vlbDecoder.cpp deleted file mode 100644 index 11921f533..000000000 --- a/Src/vlb/obj_vlbDecoder.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "obj_vlbDecoder.h" diff --git a/Src/vlb/obj_vlbDecoder.h b/Src/vlb/obj_vlbDecoder.h deleted file mode 100644 index 2ffbd4458..000000000 --- a/Src/vlb/obj_vlbDecoder.h +++ /dev/null @@ -1,65 +0,0 @@ -#ifndef NULLSOFT_VLB_OBJ_VLBDECODER_H -#define NULLSOFT_VLB_OBJ_VLBDECODER_H -#include "aacdecoderapi.h" -#include - -class obj_vlbDecoder : public Dispatchable -{ -protected: - obj_vlbDecoder() {} - ~obj_vlbDecoder() {} -public: - int Open(DataIOControl *paacInput); - void Close(); - long Synchronize(AACStreamParameters *paacStreamParameters); - long DecodeFrame(AACStreamParameters *paacStreamParameters); - void Flush(); - size_t Read(void *buffer, size_t bufferlen); - - enum - { - OBJ_VLBDECODER_OPEN = 0, - OBJ_VLBDECODER_CLOSE = 1, - OBJ_VLBDECODER_SYNCHRONIZE = 2, - OBJ_VLBDECODER_DECODEFRAME = 3, - OBJ_VLBDECODER_FLUSH = 4, - OBJ_VLBDECODER_READ = 5, - }; -}; - - -inline int obj_vlbDecoder::Open(DataIOControl *paacInput) -{ - return _call(OBJ_VLBDECODER_OPEN, (int)0, paacInput); -} - -inline void obj_vlbDecoder::Close() -{ - _voidcall(OBJ_VLBDECODER_CLOSE); -} - -inline long obj_vlbDecoder::Synchronize(AACStreamParameters *paacStreamParameters) -{ - return _call(OBJ_VLBDECODER_SYNCHRONIZE, (long)ERR_SYNC_ERROR, paacStreamParameters); -} - -inline long obj_vlbDecoder::DecodeFrame(AACStreamParameters *paacStreamParameters) -{ - return _call(OBJ_VLBDECODER_DECODEFRAME, (long)ERR_INVALID_BITSTREAM, paacStreamParameters); -} - -inline void obj_vlbDecoder::Flush() -{ - _voidcall(OBJ_VLBDECODER_FLUSH); -} - -inline size_t obj_vlbDecoder::Read(void *buffer, size_t bufferlen) -{ - return _call(OBJ_VLBDECODER_READ, (size_t)0, buffer, bufferlen); -} - -// {A9F0E37C-69BA-48d7-BFEB-1C85A9F5A2FA} -static const GUID obj_vlbDecoderGUID = -{ 0xa9f0e37c, 0x69ba, 0x48d7, { 0xbf, 0xeb, 0x1c, 0x85, 0xa9, 0xf5, 0xa2, 0xfa } }; - -#endif \ No newline at end of file diff --git a/Src/vlb/overlapadd.h b/Src/vlb/overlapadd.h deleted file mode 100644 index 53ecad5a3..000000000 --- a/Src/vlb/overlapadd.h +++ /dev/null @@ -1,89 +0,0 @@ -/* $Header: /cvs/root/winamp/vlb/overlapadd.h,v 1.2 2011/06/13 02:06:03 audiodsp Exp $ */ - -/***************************************************************************\ - * - * Copyright 2000-2002 Dolby Laboratories, Inc. All Rights - * Reserved. Do not copy. Do not distribute. - * Confidential information. - * - * (C) copyright Fraunhofer - IIS (1998) - * All Rights Reserved - * - * filename: overlapadd.h - * project : MPEG-2 AAC Decoder - * contents/description: time domain overlap add buffer object - * -\***************************************************************************/ - -#ifndef __OVERLAPADD_H__ -#define __OVERLAPADD_H__ - -/** Buffer For Time Domain Overlap/Add Data. - - This simple helper class provides a self-initializing buffer for one frame - worth of time domain signal data, associated window shape information and - appropriate access methods. -*/ - -class COverlapAddBuffer -{ - -protected : - - enum - { - BufferSize = 1024 - } ; - -public : - - COverlapAddBuffer () - { - m_WindowShape = 0 ; - - for (int i = 0 ; i < COverlapAddBuffer::BufferSize ; i++) - { - m_Buffer [i] = 0.0F ; - } - - } - - ~COverlapAddBuffer () {} ; - - // buffer access - - float &operator [] (int index) - { - return m_Buffer [index] ; - } - - // window shape access - - int GetWindowShape (void) const - { - return m_WindowShape ; - } - - void SetWindowShape (int shape) - { - m_WindowShape = shape ; - } - -#if defined (WIN32) && defined (_M_IX86) - - float *AccessBuffer (void) - { - return m_Buffer ; - } - -#endif - -protected : - - int m_WindowShape ; - - float m_Buffer [COverlapAddBuffer::BufferSize] ; - -} ; - -#endif diff --git a/Src/vlb/plainfile.cpp b/Src/vlb/plainfile.cpp deleted file mode 100644 index 613dadf01..000000000 --- a/Src/vlb/plainfile.cpp +++ /dev/null @@ -1,168 +0,0 @@ -/* $Header: /cvs/root/winamp/vlb/plainfile.cpp,v 1.1 2009/04/28 20:21:10 audiodsp Exp $ */ - -/***************************************************************************\ - * - * Copyright 2000-2002 Dolby Laboratories, Inc. All Rights - * Reserved. Do not copy. Do not distribute. - * Confidential information. - * - * (C) copyright Fraunhofer - IIS (1998) - * All Rights Reserved - * - * filename: plainfile.cpp - * project : MPEG-2 AAC Decoder - * contents/description: tiny file reader input class - * -\***************************************************************************/ - -#include "plainfile.h" -#include -#include // for intptr_t -const unsigned long CPlainFile::m_ValidMask [32] = -{ - 0x00000000, 0x00000001, 0x00000003, 0x00000007, - 0x0000000F, 0x0000001F, 0x0000003F, 0x0000007F, - 0x000000FF, 0x000001FF, 0x000003FF, 0x000007FF, - 0x00000FFF, 0x00001FFF, 0x00003FFF, 0x00007FFF, - 0x0000FFFF, 0x0001FFFF, 0x0003FFFF, 0x0007FFFF, - 0x000FFFFF, 0x001FFFFF, 0x003FFFFF, 0x007FFFFF, - 0x00FFFFFF, 0x01FFFFFF, 0x03FFFFFF, 0x07FFFFFF, - 0x0FFFFFFF, 0x1FFFFFFF, 0x3FFFFFFF, 0x7FFFFFFF -} ; - -// public - -CPlainFile::CPlainFile (DataIOControl *aacData) - : CDolbyBitStream () -{ - m_InputData = aacData ; - if (m_InputData->DICGetLastError()) throw EDoesNotExist () ; - - m_ValidBits = 0 ; - m_Data = 0 ; - - // detect adif header - m_sendadifbits=0; - -#if 0 // FUCK ADIF HEADERS, THEY BLOW DONKEYBALLZ - memset(m_tmpadifbits,0,sizeof(m_tmpadifbits)); - - m_InputData->IO(m_tmpadifbits, 1, 4) ; - //m_InputData->Seek(0,SEEK_SET) ; - - char *adif=m_tmpadifbits; - - if ((adif [0] == 'A') && - (adif [1] == 'D') && - (adif [2] == 'I') && - (adif [3] == 'F') - ) - { - m_AdifHeaderPresent = true ; - m_sendadifbits=0; - } - else - if ((adif [0] == 'R') && - (adif [1] == 'I') && - (adif [2] == 'F') && - (adif [3] == 'F') - ) - { - m_RiffHeaderPresent = true ; - m_sendadifbits=0; - } -#endif - -} - -CPlainFile::~CPlainFile () -{ - //fclose (m_InputFile) ; -} - -long CPlainFile::Get (int n) -{ - if (m_ValidBits <= 16) - { - m_Data = (m_Data << 16) | GetShort () ; - m_ValidBits += 16 ; - } - - m_ValidBits -= n ; - return ((m_Data >> m_ValidBits) & m_ValidMask [n]) ; -} - -void CPlainFile::ByteAlign (void) -{ - if (m_ValidBits <= 16) - { - m_Data = (m_Data << 16) | GetShort () ; - m_ValidBits += 16 ; - } - - while (m_ValidBits & 0x07) - { - m_ValidBits-- ; - } -} - -void CPlainFile::PushBack (int n) -{ - m_ValidBits += n ; -} - -int CPlainFile::Read (void *pData, int cBytes) -{ - if(m_sendadifbits) - { - cBytes-=4; //CT> I assume that it'll always be >4 at this point in the exec. - memcpy(pData,m_tmpadifbits,4); - intptr_t a=(intptr_t)pData+4; - pData=(void*)a; - m_sendadifbits=0; - } - return m_InputData->IO(pData,1,cBytes) ; -} - -// protected - -long CPlainFile::GetShort (void) -{ - int c1; - int c2; - m_InputData->IO(&c1,1,1); - m_InputData->IO(&c2,1,1); - if (m_InputData->EndOf()) - throw EEndOfFile () ; - c1&=0xff; - c2&=0xff; - return (c1 << 8) | c2 ; -} - -#define SYNCWORD 0x0fff -#define SYNCMASK 0x0fff -#define SYNCLENGTH 12 -#define REMLENGTH 16 -#define MAX_SEARCH 100000 - -int CPlainFile::LockAndLoad() -{ - int iCount; - unsigned int dwSync; - dwSync=0; - iCount=0; - while(iCountIO(&iTemp,1,1); - if (m_InputData->EndOf()) - throw EEndOfFile () ; - dwSync+=iTemp; - dwSync&=SYNCMASK; - iCount++; - } - m_Data=dwSync; - m_ValidBits=REMLENGTH; - if(iCount - -#include "bitstream.h" -#include "DataIO.h" - -/** A Simple File Reading Input Class. - - This class is a simple input class adhering to the CDolbyBitStream interface. It can - be used to read raw and ADIF-style bitstreams. -*/ - -class CPlainFile : public CDolbyBitStream -{ - -public : - - CPlainFile (DataIOControl *aacData) ; - virtual ~CPlainFile () ; - - // // // - - virtual void ByteAlign (void) ; - virtual long Get (int n) ; - - virtual void PushBack (int n) ; - - /** Raw Block Read Method. - - This method sequentially reads chunks of data from the input file. - - @param pData The buffer where the data chunk should be stored. - @param cBytes The number of bytes to read. - @return The number of bytes actually read. - */ - - int Read (void *pData, int cBytes) ; - - int LockAndLoad(); - -protected : - - long GetShort (void) ; - - DataIOControl *m_InputData ; - - int m_ValidBits ; - unsigned long m_Data ; - - static const unsigned long m_ValidMask [32] ; - - char m_tmpadifbits[4]; //CT - int m_sendadifbits; -} ; - -#endif diff --git a/Src/vlb/prediction.cpp b/Src/vlb/prediction.cpp deleted file mode 100644 index e0e46e004..000000000 --- a/Src/vlb/prediction.cpp +++ /dev/null @@ -1,244 +0,0 @@ -/* $Header: /cvs/root/winamp/vlb/prediction.cpp,v 1.1 2009/04/28 20:21:10 audiodsp Exp $ */ - -#ifdef MAIN_PROFILE - -/***************************************************************************\ - * - * Copyright 2000-2002 Dolby Laboratories, Inc. All Rights - * Reserved. Do not copy. Do not distribute. - * Confidential information. - * - * (C) copyright Fraunhofer - IIS (1998) - * All Rights Reserved - * - * filename: prediction.cpp - * project : MPEG-2 AAC Decoder - * contents/description: prediction tool - * -\***************************************************************************/ - -#include "prediction.h" -#include "channelinfo.h" -#include "block.h" - -////////////////////////////////////////////////////////////////////////////// -// CQuantizedFloat - -const float CPrediction::CQuantizedFloat::m_Mantissa [128] = -{ - 0.953125F, 0.945313F, 0.937500F, 0.929688F, 0.925781F, 0.917969F, 0.910156F, 0.902344F, - 0.898438F, 0.890625F, 0.882813F, 0.878906F, 0.871094F, 0.867188F, 0.859375F, 0.851563F, - 0.847656F, 0.839844F, 0.835938F, 0.828125F, 0.824219F, 0.820313F, 0.812500F, 0.808594F, - 0.800781F, 0.796875F, 0.792969F, 0.785156F, 0.781250F, 0.777344F, 0.773438F, 0.765625F, - 0.761719F, 0.757813F, 0.753906F, 0.750000F, 0.742188F, 0.738281F, 0.734375F, 0.730469F, - 0.726563F, 0.722656F, 0.718750F, 0.714844F, 0.710938F, 0.707031F, 0.699219F, 0.695313F, - 0.691406F, 0.687500F, 0.683594F, 0.679688F, 0.679688F, 0.675781F, 0.671875F, 0.667969F, - 0.664063F, 0.660156F, 0.656250F, 0.652344F, 0.648438F, 0.644531F, 0.640625F, 0.640625F, - 0.636719F, 0.632813F, 0.628906F, 0.625000F, 0.621094F, 0.621094F, 0.617188F, 0.613281F, - 0.609375F, 0.605469F, 0.605469F, 0.601563F, 0.597656F, 0.593750F, 0.593750F, 0.589844F, - 0.585938F, 0.582031F, 0.582031F, 0.578125F, 0.574219F, 0.574219F, 0.570313F, 0.566406F, - 0.566406F, 0.562500F, 0.558594F, 0.558594F, 0.554688F, 0.550781F, 0.550781F, 0.546875F, - 0.542969F, 0.542969F, 0.539063F, 0.539063F, 0.535156F, 0.531250F, 0.531250F, 0.527344F, - 0.527344F, 0.523438F, 0.519531F, 0.519531F, 0.515625F, 0.515625F, 0.511719F, 0.511719F, - 0.507813F, 0.507813F, 0.503906F, 0.503906F, 0.500000F, 0.498047F, 0.496094F, 0.494141F, - 0.492188F, 0.490234F, 0.488281F, 0.486328F, 0.484375F, 0.482422F, 0.480469F, 0.478516F -} ; - -const float CPrediction::CQuantizedFloat::m_Exponent [256] = -{ - 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, - 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, - 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, - 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, - 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, - 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, - 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, - 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, - 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, - 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, - 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, - 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, - 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, - 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, - 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, - 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, 0.000000e+000F, - 5.000000e-001F, 2.500000e-001F, 1.250000e-001F, 6.250000e-002F, 3.125000e-002F, 1.562500e-002F, 7.812500e-003F, 3.906250e-003F, - 1.953125e-003F, 9.765625e-004F, 4.882813e-004F, 2.441406e-004F, 1.220703e-004F, 6.103516e-005F, 3.051758e-005F, 1.525879e-005F, - 7.629395e-006F, 3.814697e-006F, 1.907349e-006F, 9.536743e-007F, 4.768372e-007F, 2.384186e-007F, 1.192093e-007F, 5.960464e-008F, - 2.980232e-008F, 1.490116e-008F, 7.450581e-009F, 3.725290e-009F, 1.862645e-009F, 9.313226e-010F, 4.656613e-010F, 2.328306e-010F, - 1.164153e-010F, 5.820766e-011F, 2.910383e-011F, 1.455192e-011F, 7.275958e-012F, 3.637979e-012F, 1.818989e-012F, 9.094947e-013F, - 4.547474e-013F, 2.273737e-013F, 1.136868e-013F, 5.684342e-014F, 2.842171e-014F, 1.421085e-014F, 7.105427e-015F, 3.552714e-015F, - 1.776357e-015F, 8.881784e-016F, 4.440892e-016F, 2.220446e-016F, 1.110223e-016F, 5.551115e-017F, 2.775558e-017F, 1.387779e-017F, - 6.938894e-018F, 3.469447e-018F, 1.734723e-018F, 8.673617e-019F, 4.336809e-019F, 2.168404e-019F, 1.084202e-019F, 5.421011e-020F, - 2.710505e-020F, 1.355253e-020F, 6.776264e-021F, 3.388132e-021F, 1.694066e-021F, 8.470329e-022F, 4.235165e-022F, 2.117582e-022F, - 1.058791e-022F, 5.293956e-023F, 2.646978e-023F, 1.323489e-023F, 6.617445e-024F, 3.308722e-024F, 1.654361e-024F, 8.271806e-025F, - 4.135903e-025F, 2.067952e-025F, 1.033976e-025F, 5.169879e-026F, 2.584939e-026F, 1.292470e-026F, 6.462349e-027F, 3.231174e-027F, - 1.615587e-027F, 8.077936e-028F, 4.038968e-028F, 2.019484e-028F, 1.009742e-028F, 5.048710e-029F, 2.524355e-029F, 1.262177e-029F, - 6.310887e-030F, 3.155444e-030F, 1.577722e-030F, 7.888609e-031F, 3.944305e-031F, 1.972152e-031F, 9.860761e-032F, 4.930381e-032F, - 2.465190e-032F, 1.232595e-032F, 6.162976e-033F, 3.081488e-033F, 1.540744e-033F, 7.703720e-034F, 3.851860e-034F, 1.925930e-034F, - 9.629650e-035F, 4.814825e-035F, 2.407412e-035F, 1.203706e-035F, 6.018531e-036F, 3.009266e-036F, 1.504633e-036F, 7.523164e-037F, - 3.761582e-037F, 1.880791e-037F, 9.403955e-038F, 4.701977e-038F, 2.350989e-038F, 1.175494e-038F, 5.877472e-039F, 0.000000e+000F -} ; - -float CPrediction::CQuantizedFloat::GetBDivVar (void) -{ - // description: compute division of B/VAR by means of two look up tables - // returns: single precision float (B/VAR) - - unsigned int mntInd = m_Value & 0x007F0000 ; // extract the 7-bit mantissa index - unsigned int expInd = m_Value & 0x7F800000 ; // extract the 8-bit exponent index - - return m_Mantissa [mntInd >> 16] * m_Exponent [expInd >> 23] ; -} - -////////////////////////////////////////////////////////////////////////////// -// CPredictionState - -float CPrediction::CPredictionState::FloatRoundInfinity (float x) -{ - // description: rounds 32 bit single precision number to 16 bit precision - // float towards infinity (non IEEE comform) - // returns: rounded float - // input: 32 bit single precision float - - unsigned int t = DWORDCAST(x) ; - unsigned int flag = t & 0x8000 ; - - t &= 0xFFFF0000L ; // zero out bits below LSB - x = FLOATCAST(t) ; - - // if the below-LSB part of the mantissa is 0.5 or above, round to inf - - if (flag) - { - // we need to add 1 LSB. However, since the mantissa always includes - // a hidden MSB of 1, i.e. 2^e * 1, we need to subtract that afterwards. - - unsigned int c1 = t & 0xFF800000L ; // 2^e * 1 - unsigned int c2 = c1 | 0x00010000L ; // LSB - - x -= FLOATCAST(c1); - x += FLOATCAST(c2); - } - - return x ; -} - -float CPrediction::CPredictionState::GetPredictedValue (void) -{ - // description: performs prediction for one MDCT bin - // returns: predicted value - // input: state variable handle, prediction buffer handle - - float k [CPrediction::Order] ; - - for (int i = 0 ; i < CPrediction::Order ; i++) - { - // compute (b / VAR) * COR - - k [i] = m_var [i].GetBDivVar () * m_cor [i] ; - } - - // compute the estimate, round it to nearest infinity and store it - - return FloatRoundInfinity (k [0] * m_r [0] + k [1] * m_r [1]) ; -} - -void CPrediction::CPredictionState::Update (float value) -{ - const float ALPHA = 0.90625F ; - const float A = 0.953125F ; - - float e [CPrediction::Order] ; - - float k0 = m_cor [0] * m_var [0].GetBDivVar () ; - - e [0] = value ; - e [1] = e [0] - k0 * m_r [0] ; - - for (int i = 0 ; i < CPrediction::Order ; i++) - { - float r = m_r [i] ; - - m_var [i] = ALPHA * m_var [i] + (0.5F) * (r * r + e [i] * e [i]) ; - m_cor [i] = ALPHA * m_cor [i] + e [i] * r ; - } - - m_r [1] = A * (m_r [0] - k0 * e [0]) ; - m_r [0] = A * e [0] ; -} - -////////////////////////////////////////////////////////////////////////////// -// CPrediction - -CPrediction::CPrediction () -{ -} - -CPrediction::~CPrediction () -{ -} - -void CPrediction::FullReset (void) -{ - for (int i = 0 ; i < CPrediction::MaximumPredictedBins ; i++) - { - m_State [i].Reset () ; - } -} - -void CPrediction::Apply (const CChannelInfo &info, CBlock &spectrum) -{ - // short blocks - - if (info.IsShortBlock ()) - { - FullReset () ; - return ; - } - - // long blocks - - const int *BandOffsets = info.GetScaleFactorBandOffsets () ; - - // apply predicted value to transmitted error value - - if (info.GetPredictorDataPresent ()) - { - for (int band = 0 ; band < info.GetMaximumPredictionBands () ; band++) - { - if (info.GetPredictionUsedForBand (band)) - { - for (int index = BandOffsets [band] ; index < BandOffsets [band + 1] ; index++) - { - spectrum.AccessSpectralData () [index] += m_State [index].GetPredictedValue () ; - } - } - } - } - - // update state - - for (int band = 0 ; band < info.GetMaximumPredictionBands () ; band++) - { - for (int index = BandOffsets [band] ; index < BandOffsets [band + 1] ; index++) - { - m_State [index].Update (spectrum.AccessSpectralData () [index]) ; - } - } - - // perform cyclic reset - - if (info.GetPerformPredictorReset ()) - { - int group = info.GetPredictorResetGroupNumber () - 1 ; - int maxbin = BandOffsets [info.GetMaximumPredictionBands ()] ; - - for (int index = group ; index < maxbin ; index += 30) - { - m_State [index].Reset () ; - } - } -} - -#endif diff --git a/Src/vlb/prediction.h b/Src/vlb/prediction.h deleted file mode 100644 index 13d798457..000000000 --- a/Src/vlb/prediction.h +++ /dev/null @@ -1,127 +0,0 @@ -/* $Header: /cvs/root/winamp/vlb/prediction.h,v 1.1 2009/04/28 20:21:10 audiodsp Exp $ */ - -#ifdef MAIN_PROFILE - -/***************************************************************************\ - * - * Copyright 2000-2002 Dolby Laboratories, Inc. All Rights - * Reserved. Do not copy. Do not distribute. - * Confidential information. - * - * (C) copyright Fraunhofer - IIS (1998) - * All Rights Reserved - * - * filename: prediction.h - * project : MPEG-2 AAC Decoder - * contents/description: prediction tool - * -\***************************************************************************/ - -#ifndef __PREDICTION_H__ -#define __PREDICTION_H__ - -#define DWORDCAST(x) (*(unsigned int*)&(x)) -#define FLOATCAST(x) (*(float*)&(x)) - -class CChannelInfo ; -class CBlock ; - -/** Intra Channel Prediction. - - This class represents the MPEG-2 AAC Main Profile intra channel prediction - tool. It holds the state information for a second order backward-adaptive - lattice structure predictor for each spectral component, and can be applied - to the spectral coefficients in the main profile only. - - Prediction is a profile-dependent tool and the CPrediction implementation - follows the Read()/Apply() convention used for all tools. -*/ - -class CPrediction -{ -public : - - CPrediction () ; - ~CPrediction () ; - - void Apply (const CChannelInfo &info, CBlock &spectrum) ; - - void FullReset (void) ; - - enum - { - MaximumPredictedBins = 672, - Order = 2 // Order of the backward adaptive lattice filter - } ; - -protected : - - class CQuantizedFloat - { - public : - - operator float () const - { - return FLOATCAST(m_Value) ; - } - - CQuantizedFloat &operator=(float assigned) - { - m_Value = DWORDCAST(assigned) & 0xFFFF0000 ; - return *this ; - } - - float GetBDivVar (void) ; - - protected : - - unsigned int m_Value ; - - static const float m_Mantissa [128] ; - static const float m_Exponent [256] ; - - } ; - - // State variables of the backward adaptive predictor - // (according to lattice structure in IS) - - class CPredictionState - { - public : - - CPredictionState () - { - Reset () ; - } - - ~CPredictionState () {} - - float GetPredictedValue (void) ; - void Update (float value) ; - - void Reset (void) - { - for (int i = 0 ; i < Order ; i++) - { - m_cor [i] = 0.0F ; - m_var [i] = 1.0F ; - m_r [i] = 0.0F ; - } - } - - protected : - - float FloatRoundInfinity (float x) ; - - CQuantizedFloat m_r [Order] ; // r coefficient - CQuantizedFloat m_cor [Order] ; // correlation coefficient - CQuantizedFloat m_var [Order] ; // variance coefficient - - } ; - - CPredictionState m_State [MaximumPredictedBins] ; - -} ; - -#endif -#endif diff --git a/Src/vlb/programcfg.cpp b/Src/vlb/programcfg.cpp deleted file mode 100644 index 96f4d6ba8..000000000 --- a/Src/vlb/programcfg.cpp +++ /dev/null @@ -1,302 +0,0 @@ -/* $Header: /cvs/root/winamp/vlb/programcfg.cpp,v 1.1 2009/04/28 20:21:10 audiodsp Exp $ */ - -/***************************************************************************\ - * - * Copyright 2000-2002 Dolby Laboratories, Inc. All Rights - * Reserved. Do not copy. Do not distribute. - * Confidential information. - * - * (C) copyright Fraunhofer - IIS (1998) - * All Rights Reserved - * - * filename: programcfg.cpp - * project : MPEG-2 AAC Decoder - * contents/description: program config element - * -\***************************************************************************/ - -#include "programcfg.h" - -CProgramConfig::CProgramConfig () - : m_ElementInstanceTag (4), - m_Profile (2), - m_SamplingFrequencyIndex (4), - m_NumLfeChannelElements (2), - m_NumAssocDataElements (3), - m_NumValidCcElements (4), - - m_MonoMixdownPresent (1), - m_MonoMixdownElementNumber (4), - - m_StereoMixdownPresent (1), - m_StereoMixdownElementNumber (4), - - m_MatrixMixdownIndexPresent (1), - m_MatrixMixdownIndex (2), - m_PseudoSurroundEnable (1), - - m_CommentFieldBytes (8) -{ - m_ExplicitMapping = false ; - m_NonMC_ConfigSet = false ; - - for (int row = FrontRow ; row < SpeakerRows ; row++) - { - m_NumberOfChannels [row] = 0 ; - m_NumberOfChannelElements [row] = 0 ; - } -} - -CProgramConfig::~CProgramConfig () -{ -} - -void CProgramConfig::ResetNonMCConfig(void) -{ - m_ExplicitMapping = false ; - m_NonMC_ConfigSet = false ; - - for (int row = FrontRow ; row < SpeakerRows ; row++) - { - m_NumberOfChannels [row] = 0 ; - m_NumberOfChannelElements [row] = 0 ; - } -} - -void CProgramConfig::Read (CDolbyBitStream &bs) -{ - int i, row; - - m_ElementInstanceTag.Read(bs) ; - m_Profile.Read (bs) ; - m_SamplingFrequencyIndex.Read (bs) ; - - for (row = FrontRow ; row < SpeakerRows ; row++) - m_NumberOfChannelElements [row].Read (bs, 4) ; - - m_NumLfeChannelElements.Read (bs) ; - m_NumAssocDataElements.Read (bs) ; - m_NumValidCcElements.Read (bs) ; - - if (m_MonoMixdownPresent.Read (bs)) - { - m_MonoMixdownElementNumber.Read (bs) ; - } - - if (m_StereoMixdownPresent.Read (bs)) - { - m_StereoMixdownElementNumber.Read (bs) ; - } - - if (m_MatrixMixdownIndexPresent.Read (bs)) - { - m_MatrixMixdownIndex.Read (bs) ; - m_PseudoSurroundEnable.Read (bs) ; - } - - m_NumChannels = 0; - for (row = FrontRow ; row < SpeakerRows ; row++) - { - m_NumberOfChannels [row] = 0 ; - - for (i = 0 ; i < m_NumberOfChannelElements [row] ; i++) - { - m_ChannelElementIsCpe [row][i].Read (bs, 1) ; - m_ChannelElementTagSelect [row][i].Read (bs, 4) ; - - m_NumberOfChannels [row] += m_ChannelElementIsCpe [row][i] ? 2 : 1 ; - m_NumChannels += m_NumberOfChannels [row]; - } - } - - for (i = 0 ; i < m_NumLfeChannelElements ; i++) - { - m_LfeElementTagSelect [i].Read (bs, 4) ; - } - - for (i = 0 ; i < m_NumAssocDataElements ; i++) - { - m_AssocDataElementTagSelect [i].Read (bs, 4) ; - } - - for (i = 0 ; i < m_NumValidCcElements ; i++) - { - m_CcElementIsIndSw [i].Read (bs, 1) ; - m_ValidCcElementTagSelect [i].Read (bs, 4) ; - } - - // comment - - bs.ByteAlign () ; - - m_CommentFieldBytes.Read (bs) ; - - CVLBBitSequence text (8) ; - - for (i = 0 ; i < m_CommentFieldBytes ; i++) - { - text.Read (bs) ; - - if (i < MaximumCommentLength) - { - m_Comment [i] = text ; - } - } - - m_ExplicitMapping = true ; -} - -// the decoder calls this method with every -// new element id found in the bitstream. - -bool CProgramConfig::AddChannel (const int tag, const bool isCPE) -{ - if (!m_NonMC_ConfigSet) - { - m_NonMC_Tag = tag ; - m_NonMC_IsCPE = isCPE ; - m_NonMC_ConfigSet = true ; - - return true ; - } - else - { - return ((m_NonMC_IsCPE == isCPE) && (m_NonMC_Tag == tag)) ; - } -} - -bool CProgramConfig::AddSingleChannel (const int tag) -{ - if (m_ExplicitMapping) - { - for (int row = 0 ; row < SpeakerRows ; row++) - { - for (int i = 0 ; i < m_NumberOfChannelElements [row] ; i++) - { - if ((m_ChannelElementTagSelect [row][i] == tag) && !m_ChannelElementIsCpe [row][i]) - return true ; - } - } - - return false ; - } - - return true ; -} - -bool CProgramConfig::AddChannelPair (const int tag) -{ - if (m_ExplicitMapping) - { - for (int row = FrontRow ; row < SpeakerRows ; row++) - { - for (int i = 0 ; i < m_NumberOfChannelElements [row] ; i++) - { - if ((m_ChannelElementTagSelect [row][i] == tag) && m_ChannelElementIsCpe [row][i]) - return true ; - } - } - - return false ; - } - - return true ; -} - -bool CProgramConfig::AddCouplingChannel (const int tag) -{ - if (m_ExplicitMapping) - { - for (int i = 0 ; i < m_NumValidCcElements ; i++) - { - if (m_ValidCcElementTagSelect [i] == tag) - { - // inc num_coupling_chan; - return true ; - } - } - - return false ; - } - - return true ; -} - -bool CProgramConfig::AddLowFrequencyChannel (const int tag) -{ - if (m_ExplicitMapping) - { - for (int i = 0 ; i < m_NumLfeChannelElements ; i++) - { - if (m_LfeElementTagSelect [i] == tag) return true ; - } - - return false ; - } - - return true ; -} - -bool CProgramConfig::IsChannelLocatedAt (const int row, const int tag) -{ - for (int i = 0 ; i < m_NumberOfChannelElements [row] ; i++) - { - if (!m_ChannelElementIsCpe [row][i] && (m_ChannelElementTagSelect [row][i] == tag)) - return true ; - } - - return false ; -} - -bool CProgramConfig::IsChannelPairLocatedAt (const int row, const int tag) -{ - for (int i = 0 ; i < m_NumberOfChannelElements [row] ; i++) - { - if (m_ChannelElementIsCpe [row][i] && (m_ChannelElementTagSelect [row][i] == tag)) - return true ; - } - - return false ; -} - -int CProgramConfig::GetNumberOfElements (const int row) -{ - return m_NumberOfChannelElements [row] ; -} - -int CProgramConfig::GetNumberOfChannels (const int row) -{ - return m_NumberOfChannels [row] ; -} - -int CProgramConfig::GetElementTag (const int row, const int index) -{ - return m_ChannelElementTagSelect [row][index] ; -} - -bool CProgramConfig::IsChannelPair (const int row, const int index) -{ - return m_ChannelElementIsCpe [row][index] ? true : false ; -} - -int CProgramConfig::GetNumberOfLowFrequencyChannels (void) -{ - return m_NumLfeChannelElements ; -} - -int CProgramConfig::GetLowFrequencyChannelTag (const int index) -{ - return m_LfeElementTagSelect [index] ; -} - - -char* CProgramConfig::GetCommentFieldData (void) -{ - char* comment = new char[m_CommentFieldBytes]; - - for (int i = 0; i < m_CommentFieldBytes; i++) - comment[i] = m_Comment[i]; - - return comment; -} - diff --git a/Src/vlb/programcfg.h b/Src/vlb/programcfg.h deleted file mode 100644 index 04fa5f354..000000000 --- a/Src/vlb/programcfg.h +++ /dev/null @@ -1,222 +0,0 @@ -/* $Header: /cvs/root/winamp/vlb/programcfg.h,v 1.1 2009/04/28 20:21:10 audiodsp Exp $ */ - -/***************************************************************************\ - * - * Copyright 2000-2002 Dolby Laboratories, Inc. All Rights - * Reserved. Do not copy. Do not distribute. - * Confidential information. - * - * (C) copyright Fraunhofer - IIS (1998) - * All Rights Reserved - * - * filename: programcfg.h - * project : MPEG-2 AAC Decoder - * contents/description: program config element - * -\***************************************************************************/ - -#ifndef __PROGRAMCFG_H__ -#define __PROGRAMCFG_H__ - -#include "bitsequence.h" - -class CDolbyBitStream ; - -/** PCE Program Configuration Element. - - This class holds the program configuration data read from the bitstream - and maps the decoded channels according to the currently active program. -*/ - -class CProgramConfig -{ - - enum - { - FrontRow = 0, - SideRow = 1, - BackRow = 2, - SpeakerRows = 3, - - MaximumChannels = 16, - MaximumCommentLength = 64 - } ; - - CVLBBitSequence m_ElementInstanceTag; - CVLBBitSequence m_Profile ; - CVLBBitSequence m_SamplingFrequencyIndex ; - - CVLBBitSequence m_NumLfeChannelElements ; - CVLBBitSequence m_NumAssocDataElements ; - CVLBBitSequence m_NumValidCcElements ; - - CVLBBitSequence m_MonoMixdownPresent ; - CVLBBitSequence m_MonoMixdownElementNumber ; - - CVLBBitSequence m_StereoMixdownPresent ; - CVLBBitSequence m_StereoMixdownElementNumber ; - - CVLBBitSequence m_MatrixMixdownIndexPresent ; - CVLBBitSequence m_MatrixMixdownIndex ; - CVLBBitSequence m_PseudoSurroundEnable ; - - CVLBBitSequence m_NumberOfChannelElements [SpeakerRows] ; - - CVLBBitSequence m_ChannelElementIsCpe [SpeakerRows][MaximumChannels] ; - CVLBBitSequence m_ChannelElementTagSelect [SpeakerRows][MaximumChannels] ; - - CVLBBitSequence m_LfeElementTagSelect [MaximumChannels] ; - CVLBBitSequence m_AssocDataElementTagSelect [MaximumChannels] ; - - CVLBBitSequence m_CcElementIsIndSw [MaximumChannels] ; - CVLBBitSequence m_ValidCcElementTagSelect [MaximumChannels] ; - - CVLBBitSequence m_CommentFieldBytes ; - char m_Comment [MaximumCommentLength] ; - - unsigned int m_NumChannels; - -public : - - CProgramConfig () ; - ~CProgramConfig () ; - - void ResetNonMCConfig(void); - - void Read (CDolbyBitStream &bs) ; - - // - - bool AddChannel (const int tag, const bool isCPE) ; - - // - - bool AddSingleChannel (const int tag) ; - bool AddChannelPair (const int tag) ; - bool AddCouplingChannel (const int tag) ; - bool AddLowFrequencyChannel (const int tag) ; - - // explicit query - - bool IsFrontChannel (const int tag) { return IsChannelLocatedAt (FrontRow, tag) ; } - bool IsFrontChannelPair (const int tag) { return IsChannelPairLocatedAt (FrontRow, tag) ; } - - bool IsBackChannel (const int tag) { return IsChannelLocatedAt (BackRow, tag) ; } - bool IsBackChannelPair (const int tag) { return IsChannelPairLocatedAt (BackRow, tag) ; } - - // query by index - - int GetNumberOfElements (const int row) ; - int GetNumberOfChannels (const int row) ; - - int GetElementTag (const int row, const int index) ; - bool IsChannelPair (const int row, const int index) ; - - int GetNumberOfLowFrequencyChannels (void) ; - int GetLowFrequencyChannelTag (const int index) ; - - // - - - bool HasSpeakerMapping (void) const - { - return m_ExplicitMapping ; - } - - unsigned int GetElementInstnaceTag (void) const - { - return m_ElementInstanceTag ; - } - - unsigned int GetProfile (void) const - { - return m_Profile ; - } - - unsigned int GetSamplingFrequencyIndex (void) const - { - return m_SamplingFrequencyIndex ; - } - - unsigned int GetNumChannels (void) const - { - return m_NumChannels ; - } - - unsigned int GetNumFrontChannels (void) const - { - return m_NumberOfChannelElements[FrontRow] ; - } - - unsigned int GetNumSideChannels (void) const - { - return m_NumberOfChannelElements[SideRow] ; - } - - unsigned int GetNumBackChannels (void) const - { - return m_NumberOfChannelElements[BackRow] ; - } - - unsigned int GetNumLfeChannels (void) const - { - return m_NumLfeChannelElements ; - } - - unsigned int GetNumCouplingChannels (void) const - { - return m_NumValidCcElements ; - } - - unsigned int GetCouplingChannelTag (int index) const - { - return m_ValidCcElementTagSelect[index] ; - } - - unsigned int GetMonoMixdownPresent (void) const - { - return m_MonoMixdownPresent ; - } - - unsigned int GetStereoMixdownPresent (void) const - { - return m_StereoMixdownPresent ; - } - - unsigned int GetMatrixMixdownPresent (void) const - { - return m_MatrixMixdownIndexPresent ; - } - - unsigned int GetPseudoSurroundPresent (void) const - { - return m_PseudoSurroundEnable ; - } - - char* GetCommentFieldData (void); - - - - -protected : - - bool IsChannelLocatedAt (const int row, const int tag) ; - bool IsChannelPairLocatedAt (const int row, const int tag) ; - - // non-multichannel configuration - - bool m_NonMC_ConfigSet ; - bool m_NonMC_IsCPE ; - - int m_NonMC_Tag ; - - // - - bool m_ExplicitMapping ; - - - unsigned int m_NumberOfChannels [SpeakerRows] ; - -} ; - -#endif diff --git a/Src/vlb/pulsedata.cpp b/Src/vlb/pulsedata.cpp deleted file mode 100644 index 7eba70146..000000000 --- a/Src/vlb/pulsedata.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* $Header: /cvs/root/winamp/vlb/pulsedata.cpp,v 1.1 2009/04/28 20:21:10 audiodsp Exp $ */ - -/***************************************************************************\ - * - * Copyright 2000-2002 Dolby Laboratories, Inc. All Rights - * Reserved. Do not copy. Do not distribute. - * Confidential information. - * - * (C) copyright Fraunhofer - IIS (1998) - * All Rights Reserved - * - * filename: pulsedata.cpp - * project : MPEG-2 AAC Decoder - * contents/description: pulse data tool - * -\***************************************************************************/ - -#include "pulsedata.h" -#include "bitstream.h" -#include "channelinfo.h" - -CPulseData::CPulseData () - : m_PulseDataPresent (1), - m_NumberPulse (2), - m_PulseStartBand (6) -{ -} - -CPulseData::~CPulseData () -{ -} - -void CPulseData::Read (CDolbyBitStream &bs) -{ - if (m_PulseDataPresent.Read (bs)) - { - m_NumberPulse.Read (bs) ; - m_PulseStartBand.Read (bs) ; - - for (int i = 0 ; i <= m_NumberPulse ; i++) - { - m_PulseOffset [i].Read (bs, 5) ; - m_PulseAmp [i].Read (bs, 4) ; - } - } -} - -void CPulseData::Apply (const CChannelInfo &info, int coef []) -{ - if (m_PulseDataPresent) - { - int k = info.GetScaleFactorBandOffsets () [(int) m_PulseStartBand] ; - - for (int i = 0 ; i <= m_NumberPulse ; i++) - { - k += m_PulseOffset [i] ; - - if (coef [k] > 0) coef [k] += m_PulseAmp [i] ; - else coef [k] -= m_PulseAmp [i] ; - } - } -} diff --git a/Src/vlb/pulsedata.h b/Src/vlb/pulsedata.h deleted file mode 100644 index e1a14add4..000000000 --- a/Src/vlb/pulsedata.h +++ /dev/null @@ -1,61 +0,0 @@ -/* $Header: /cvs/root/winamp/vlb/pulsedata.h,v 1.1 2009/04/28 20:21:10 audiodsp Exp $ */ - -/***************************************************************************\ - * - * Copyright 2000-2002 Dolby Laboratories, Inc. All Rights - * Reserved. Do not copy. Do not distribute. - * Confidential information. - * - * (C) copyright Fraunhofer - IIS (1998) - * All Rights Reserved - * - * filename: pulsedata.cpp - * project : MPEG-2 AAC Decoder - * contents/description: pulse data tool - * -\***************************************************************************/ - -#ifndef __PULSEDATA_H__ -#define __PULSEDATA_H__ - -#include "bitsequence.h" - -class CChannelInfo ; - -/** Pulse Data Processing. - - This class represents the pulse data noiseless coding tool for decoding and - applying pulse data to the spectral coefficients of the current block. - - The Pulse Data tool is not profile-dependent and the CPulseData implementation - follows the Read()/Apply() convention used for all tools. - -*/ - -class CPulseData -{ -public : - - CPulseData () ; - ~CPulseData () ; - - void Read (CDolbyBitStream &bs) ; - void Apply (const CChannelInfo &info, int coef []) ; - - enum - { - MaximumLines = 4 - } ; - -protected : - - CVLBBitSequence m_PulseDataPresent ; - CVLBBitSequence m_NumberPulse ; - CVLBBitSequence m_PulseStartBand ; - - CVLBBitSequence m_PulseOffset [MaximumLines] ; - CVLBBitSequence m_PulseAmp [MaximumLines] ; - -} ; - -#endif diff --git a/Src/vlb/resource.h b/Src/vlb/resource.h deleted file mode 100644 index 7dcc20efe..000000000 --- a/Src/vlb/resource.h +++ /dev/null @@ -1,17 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by logo.rc -// -#define IDB_BITMAP1 101 -#define IDB_BITMAP2 102 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 103 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1000 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/Src/vlb/resource1.h b/Src/vlb/resource1.h deleted file mode 100644 index 6f21b71f8..000000000 --- a/Src/vlb/resource1.h +++ /dev/null @@ -1,14 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by vlb.rc - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 101 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/Src/vlb/shortblock.cpp b/Src/vlb/shortblock.cpp deleted file mode 100644 index 29631931b..000000000 --- a/Src/vlb/shortblock.cpp +++ /dev/null @@ -1,420 +0,0 @@ -/* $Header: /cvs/root/winamp/vlb/shortblock.cpp,v 1.2 2011/06/13 02:06:03 audiodsp Exp $ */ - -/***************************************************************************\ - * - * Copyright 2000-2002 Dolby Laboratories, Inc. All Rights - * Reserved. Do not copy. Do not distribute. - * Confidential information. - * - * (C) copyright Fraunhofer - IIS (1998) - * All Rights Reserved - * - * filename: shortblock.cpp - * project : MPEG-2 AAC Decoder - * contents/description: eight short window sequence object - * -\***************************************************************************/ - -#include // pow() - -#include "block.h" -#include "bitstream.h" -#include "channelinfo.h" -#include "overlapadd.h" - -#ifdef MAIN_PROFILE -#include "prediction.h" -#endif -// ctor/dtor - -CShortBlock::CShortBlock (CChannelInfo &info) - : CBlock (info) -{ - m_SectBits = 3 ; -} - -CShortBlock::~CShortBlock () -{ -} - -// low-level access - -float *CShortBlock::AccessSpectralData (int window) -{ - return m_SpectralCoefficient [window] ; -} - -int *CShortBlock::AccessCodeBooks (int group) -{ - return m_CodeBook [group] ; -} - -int *CShortBlock::AccessScaleFactors (int group) -{ - return m_ScaleFactor [group] ; -} - -// readers - -void CShortBlock::ReadSectionData (CDolbyBitStream &bs) -{ - CVLBBitSequence sect_cb (4) ; - CVLBBitSequence sect_len_incr (m_SectBits) ; - - int sect_esc_val = (1 << m_SectBits) - 1 ; - - //Section Information: - int iNumberOfSections; - - for (int group = 0 ; group < m_IcsInfo.GetWindowGroups () ; group++) - { - int band ; // msdev not ansi - - // initialize first group's section info - iNumberOfSections=0; - sSectionInfoStruct.aiSectionCount[group]=0; - sSectionInfoStruct.aaiSectionStart[group][0]=0; - - for (band = 0 ; band < m_IcsInfo.GetScaleFactorBandsTransmitted () ; ) - { - sect_cb.Read (bs) ; - sect_len_incr.Read (bs) ; - - int sect_len = 0 ; - - while (sect_len_incr == sect_esc_val) - { - sect_len += sect_esc_val ; - sect_len_incr.Read (bs) ; - } - - sect_len += sect_len_incr ; - - for (int top = band + sect_len ; band < top ; band++) - { - m_CodeBook [group][band] = sect_cb ; - - if ((m_CodeBook [group][band] == BOOKSCL) || - (m_CodeBook [group][band] == RESERVED_HCB) - ) - { - throw EInvalidCodeBook () ; - } - } - - sSectionInfoStruct.aaiSectionCodebooks[group][iNumberOfSections]=sect_cb; - sSectionInfoStruct.aaiSectionStart[group][iNumberOfSections+1]=band; - sSectionInfoStruct.aaiSectionEnd[group][iNumberOfSections]=band; - sSectionInfoStruct.aiSectionCount[group]++; - iNumberOfSections++; - - } // for band - - if(band < m_IcsInfo.GetScaleFactorBandsTotal() && m_IcsInfo.GetScaleFactorBandsTransmitted()){ - sSectionInfoStruct.aaiSectionCodebooks[group][iNumberOfSections]=ZERO_HCB; - sSectionInfoStruct.aaiSectionEnd[group][iNumberOfSections]= m_IcsInfo.GetScaleFactorBandsTotal (); - sSectionInfoStruct.aiSectionCount[group]++; - iNumberOfSections++; - } - - for ( ; band < m_IcsInfo.GetScaleFactorBandsTotal () ; band++) - { - m_CodeBook [group][band] = ZERO_HCB ; - } - } // for group.. -} - -void CShortBlock::ReadScaleFactorData (CDolbyBitStream &bs, const int global_gain) -{ - const CodeBookDescription *hcb = &HuffmanCodeBooks [BOOKSCL] ; - - int factor = global_gain ; - int position = 0 ; - - int temp ; - - for (int group = 0 ; group < m_IcsInfo.GetWindowGroups () ; group++) - { - for (int band = 0 ; band < m_IcsInfo.GetScaleFactorBandsTransmitted () ; band++) - { - switch (m_CodeBook [group][band]) - { - case ZERO_HCB : // zero book - - m_ScaleFactor [group][band] = 0 ; - break ; - - default : // decode scale factor - - temp = DecodeHuffmanWord (bs, hcb->CodeBook) ; - factor += temp - 60 ; // MIDFAC 1.5 dB - - m_ScaleFactor [group][band] = factor - 100 ; - break ; - - case INTENSITY_HCB : // intensity steering - case INTENSITY_HCB2 : - - temp = DecodeHuffmanWord (bs, hcb->CodeBook) ; - position += temp - 60 ; - - m_ScaleFactor [group][band] = position - 100 ; - break ; - } - } - } -} - -void CShortBlock::ReadSpectralData (CDolbyBitStream &bs) -{ - const int *BandOffsets = m_IcsInfo.GetScaleFactorBandOffsets () ; - - int QuantizedCoef [MaximumWindows][MaximumBins] ; - - int window, group ; - - // // // clear coeffs - - for (window = 0 ; window < MaximumWindows ; window++) - { - for (int index = 0 ; index < MaximumBins ; index++) - { - QuantizedCoef [window][index] = 0 ; - } - } - - // // // read interleaved coeffs - - int groupoffset = 0 ; - - for (group = 0 ; group < m_IcsInfo.GetWindowGroups () ; group++) - { - for (int band = 0 ; band < m_IcsInfo.GetScaleFactorBandsTransmitted () ; band++) - { - const CodeBookDescription *hcb = &HuffmanCodeBooks [m_CodeBook [group][band]] ; - - for (int groupwin = 0 ; groupwin < m_IcsInfo.GetWindowGroupLength (group) ; groupwin++) - { - if ((m_CodeBook [group][band] == ZERO_HCB) || - (m_CodeBook [group][band] == INTENSITY_HCB) || - (m_CodeBook [group][band] == INTENSITY_HCB2) - ) - continue ; - - int window = groupoffset + groupwin ; - int step = 0 ; - - for (int index = BandOffsets [band] ; index < BandOffsets [band + 1] ; index += step) - { - step = UnpackIndex (DecodeHuffmanWord (bs, hcb->CodeBook), &QuantizedCoef [window][index], hcb) ; - - if (!hcb->IsSigned) - { - for (int i = 0 ; i < step ; i++) - { - if (QuantizedCoef [window][index + i]) - { - if (bs.Get (1)) // sign bit - { - QuantizedCoef [window][index + i] = -QuantizedCoef [window][index + i] ; - } - } - } - } - - if (m_CodeBook [group][band] == ESCBOOK) - { - QuantizedCoef [window][index] = GetEscape (bs, QuantizedCoef [window][index]) ; - QuantizedCoef [window][index + 1] = GetEscape (bs, QuantizedCoef [window][index + 1]) ; - } - } - } - } - - groupoffset += m_IcsInfo.GetWindowGroupLength (group) ; - } - - // // // - - for (window = 0, group = 0 ; group < m_IcsInfo.GetWindowGroups () ; group++) - { - for (int groupwin = 0 ; groupwin < m_IcsInfo.GetWindowGroupLength (group) ; groupwin++, window++) - { - // dequantize - - for (int index = 0 ; index < MaximumBins ; index++) - { - m_SpectralCoefficient [window][index] = InverseQuantize (QuantizedCoef [window][index]) ; - } - - // apply scalefactors - - for (int band = 0 ; band < m_IcsInfo.GetScaleFactorBandsTransmitted () ; band++) - { - float factor = static_cast(m_ScaleFactor [group][band]) ; - - if ((factor >= 0) && (factor < ExpTableSize)) - { - factor = m_ExpTable [m_ScaleFactor [group][band]] ; - } - else - { - factor = static_cast(pow (2.0F, 0.25F * factor)) ; - } - - if (m_ScaleFactor [group][band] != -100) - { - for (int index = BandOffsets [band] ; index < BandOffsets [band + 1] ; index++) - { - m_SpectralCoefficient [window][index] *= factor ; - } - } - else - { - for (int index = BandOffsets [band] ; index < BandOffsets [band + 1] ; index++) - { - m_SpectralCoefficient [window][index] = 0.0F ; - } - } - } - } - } -} - -void CShortBlock::TransformWindows (COverlapAddBuffer &Previous, float EightWindowsBuffer []) -{ - for (int i = 0 ; i < 2048 ; i++) - { - EightWindowsBuffer [i] = 0 ; - } - - for (int window = 0 ; window < MaximumWindows ; window++) - { - float *theSpectrum = m_SpectralCoefficient [window] ; - - InverseTransform (theSpectrum) ; - - if (window == 0) - { - for (int i = 0 ; i < 128 ; i++) - { - theSpectrum [i] *= m_ShortWindow [Previous.GetWindowShape ()][i] ; - theSpectrum [128 + i] *= m_ShortWindow [m_IcsInfo.GetWindowShape ()][127 - i] ; - } - } - else - { - for (int i = 0 ; i < 128 ; i++) - { - theSpectrum [i] *= m_ShortWindow [m_IcsInfo.GetWindowShape ()][i] ; - theSpectrum [128 + i] *= m_ShortWindow [m_IcsInfo.GetWindowShape ()][127 - i] ; - } - } - - // overlap add the 8 windows in this block - - for (int i = 0 ; i < 256 ; i++) - { - EightWindowsBuffer [448 + 128 * window + i] += theSpectrum [i] ; - } - } - - Previous.SetWindowShape (m_IcsInfo.GetWindowShape ()) ; -} - -/* -void CShortBlock::FrequencyToTime (COverlapAddBuffer &Previous, short Output [], const int stride) -{ - float EightWindowsBuffer [2048] ; - - TransformWindows (Previous, EightWindowsBuffer) ; - -#if defined (WIN32) && defined (_M_IX86) - - PentiumOverlap (m_Output, EightWindowsBuffer, Previous.AccessBuffer (), stride) ; - -#else - - for (int j = 0 ; j < 1024 ; j++) - { - // add first half and old data - - Output [j * stride] = FloatToShort (EightWindowsBuffer [j] + Previous [j]) ; - - // store second half as old data - - Previous [j] = EightWindowsBuffer [1024 + j] ; - } - -#endif -} -*/ - -void CShortBlock::FrequencyToTime_Fast (COverlapAddBuffer &Previous) -{ - float EightWindowsBuffer [2048] ; - - TransformWindows (Previous, EightWindowsBuffer) ; - -#if defined (WIN32) && defined (_M_IX86) - - PentiumOverlap (m_Output, EightWindowsBuffer, Previous.AccessBuffer (), 1) ; - -#else - - for (int j = 0 ; j < 1024 ; j++) - { - // add first half and old data - - m_Output [j] = EightWindowsBuffer [j] + Previous [j]; - - // store second half as old data - - Previous [j] = EightWindowsBuffer [1024 + j] ; - } - -#endif -} - -void CShortBlock::FrequencyToTime (COverlapAddBuffer &Previous, float Output [], const int stride) -{ - float EightWindowsBuffer [2048] ; - - TransformWindows (Previous, EightWindowsBuffer) ; - - for (int j = 0 ; j < 1024 ; j++) - { - // add first half and old data - - Output [j * stride] = EightWindowsBuffer [j] + Previous [j] ; - - // store second half as old data - - Previous [j] = EightWindowsBuffer [1024 + j] ; - } -} - -void CShortBlock::FrequencyToTime (COverlapAddBuffer &Previous) -{ - float EightWindowsBuffer [2048] ; - TransformWindows (Previous, EightWindowsBuffer) ; - for (int j = 0 ; j < 1024 ; j++) - { - m_Output [j] = EightWindowsBuffer [j] + Previous [j] ; - Previous [j] = EightWindowsBuffer [1024 + j] ; - } -} - -void CShortBlock::ApplyEqualizationMask (float Mask []) -{ - for (int window = 0 ; window < MaximumWindows ; window++) - { - for (int i = 0 ; i < EqualizationMaskLength ; i++) - { - for (int j = 0 ; j < (MaximumBins / EqualizationMaskLength) ; j++) - { - m_SpectralCoefficient [window][(MaximumBins / EqualizationMaskLength) * i + j] *= Mask [i] ; - } - } - } -} diff --git a/Src/vlb/stereo.cpp b/Src/vlb/stereo.cpp deleted file mode 100644 index 637e86765..000000000 --- a/Src/vlb/stereo.cpp +++ /dev/null @@ -1,158 +0,0 @@ -/* $Header: /cvs/root/winamp/vlb/stereo.cpp,v 1.1 2009/04/28 20:21:10 audiodsp Exp $ */ - -/***************************************************************************\ - * - * Copyright 2000-2002 Dolby Laboratories, Inc. All Rights - * Reserved. Do not copy. Do not distribute. - * Confidential information. - * - * (C) copyright Fraunhofer - IIS (1998) - * All Rights Reserved - * - * filename: stereo.cpp - * project : MPEG-2 AAC Decoder - * contents/description: mid/side and intensity stereo processing - * -\***************************************************************************/ - -#include - -#include "stereo.h" -#include "bitstream.h" -#include "channelinfo.h" -#include "block.h" - -CJointStereo::CJointStereo () - : m_MsMaskPresent (2) -{ -} - -CJointStereo::~CJointStereo () -{ -} - -void CJointStereo::Read (const CChannelInfo &info, CDolbyBitStream &bs) -{ - m_MsMaskPresent.Read (bs) ; - - int group, band ; - - switch (m_MsMaskPresent) - { - case 0 : // no M/S - - for (group = 0 ; group < info.GetWindowGroups () ; group++) - { - for (band = 0 ; band < info.GetScaleFactorBandsTransmitted () ; band++) - { - m_MsUsed [group][band] = false ; - } - } - - break ; - - case 1 : // read ms_used - - for (group = 0 ; group < info.GetWindowGroups () ; group++) - { - for (band = 0 ; band < info.GetScaleFactorBandsTransmitted () ; band++) - { - m_MsUsed [group][band] = bs.Get (1) ? true : false ; - } - } - - break ; - - case 2 : // full spectrum M/S - - for (group = 0 ; group < info.GetWindowGroups () ; group++) - { - for (band = 0 ; band < info.GetScaleFactorBandsTransmitted () ; band++) - { - m_MsUsed [group][band] = true ; - } - } - - break ; - } -} - -// mid / side - -void CJointStereo::ApplyMS (const CChannelInfo &info, CBlock &left, CBlock &right) -{ - const int *BandOffsets = info.GetScaleFactorBandOffsets () ; - - for (int window = 0, group = 0 ; group < info.GetWindowGroups () ; group++) - { - for (int groupwin = 0 ; groupwin < info.GetWindowGroupLength (group) ; groupwin++, window++) - { - float *LeftSpectrum = left.AccessSpectralData (window) ; - float *RightSpectrum = right.AccessSpectralData (window) ; - - for (int band = 0 ; band < info.GetScaleFactorBandsTransmitted () ; band++) - { - if (m_MsUsed [group][band] == true) - { - for (int index = BandOffsets [band] ; index < BandOffsets [band + 1] ; index++) - { - float LeftCoefficient = LeftSpectrum [index] ; - float RightCoefficient = RightSpectrum [index] ; - - LeftSpectrum [index] = LeftCoefficient + RightCoefficient ; - RightSpectrum [index] = LeftCoefficient - RightCoefficient ; - } - } - } - } - } -} - -// intensity - -void CJointStereo::ApplyIS (const CChannelInfo &info, CBlock &left, CBlock &right) -{ - const int *BandOffsets = info.GetScaleFactorBandOffsets () ; - - for (int window = 0, group = 0 ; group < info.GetWindowGroups () ; group++) - { - int *CodeBook = right.AccessCodeBooks (group) ; - int *ScaleFactor = right.AccessScaleFactors (group) ; - - for (int groupwin = 0 ; groupwin < info.GetWindowGroupLength (group) ; groupwin++, window++) - { - float *LeftSpectrum = left.AccessSpectralData (window) ; - float *RightSpectrum = right.AccessSpectralData (window) ; - - for (int band = 0 ; band < info.GetScaleFactorBandsTransmitted () ; band++) - { - if ((CodeBook [band] == CBlock::INTENSITY_HCB) || - (CodeBook [band] == CBlock::INTENSITY_HCB2) - ) - { - float scale = (float) pow (0.5F, 0.25F * (ScaleFactor [band] + 100)) ; - - if (m_MsUsed [group][band]) - { - if (CodeBook [band] == CBlock::INTENSITY_HCB) // _NOT_ in-phase - { - scale *= -1 ; - } - } - else - { - if (CodeBook [band] == CBlock::INTENSITY_HCB2) // out-of-phase - { - scale *= -1 ; - } - } - - for (int index = BandOffsets [band] ; index < BandOffsets [band + 1] ; index++) - { - RightSpectrum [index] = LeftSpectrum [index] * scale ; - } - } - } - } - } -} diff --git a/Src/vlb/stereo.h b/Src/vlb/stereo.h deleted file mode 100644 index d38ba312c..000000000 --- a/Src/vlb/stereo.h +++ /dev/null @@ -1,62 +0,0 @@ -/* $Header: /cvs/root/winamp/vlb/stereo.h,v 1.1 2009/04/28 20:21:10 audiodsp Exp $ */ - -/***************************************************************************\ - * - * Copyright 2000-2002 Dolby Laboratories, Inc. All Rights - * Reserved. Do not copy. Do not distribute. - * Confidential information. - * - * (C) copyright Fraunhofer - IIS (1998) - * All Rights Reserved - * - * filename: stereo.h - * project : MPEG-2 AAC Decoder - * contents/description: mid/side and intensity stereo processing - * -\***************************************************************************/ - -#ifndef __STEREO_H__ -#define __STEREO_H__ - -#include "bitsequence.h" - -class CChannelInfo ; -class CBlock ; - -/** Joint Stereo Processing. - - This class represents the stereo processing tool for decoding mid/side and - intensity coded bands of spectral coefficients. - - The Stereo Processing tool is not profile-dependent and the CJointStereo - implementation follows the Read()/Apply() convention used for all tools - as far as applicable. -*/ - -class CJointStereo -{ -public : - - CJointStereo () ; - ~CJointStereo () ; - - void Read (const CChannelInfo &info, CDolbyBitStream &bs) ; - - void ApplyMS (const CChannelInfo &info, CBlock &left, CBlock &right) ; - void ApplyIS (const CChannelInfo &info, CBlock &left, CBlock &right) ; - -protected : - - enum - { - MaximumGroups = 8, - MaximumBands = 64 - } ; - - bool m_MsUsed [CJointStereo::MaximumGroups][CJointStereo::MaximumBands] ; - - CVLBBitSequence m_MsMaskPresent ; - -} ; - -#endif diff --git a/Src/vlb/streaminfo.h b/Src/vlb/streaminfo.h deleted file mode 100644 index d4224901b..000000000 --- a/Src/vlb/streaminfo.h +++ /dev/null @@ -1,394 +0,0 @@ -/* $Header: /cvs/root/winamp/vlb/streaminfo.h,v 1.1 2009/04/28 20:21:11 audiodsp Exp $ */ - -/***************************************************************************\ - * - * Copyright 2000-2002 Dolby Laboratories, Inc. All Rights - * Reserved. Do not copy. Do not distribute. - * Confidential information. - * - * (C) copyright Fraunhofer - IIS (1998) - * All Rights Reserved - * - * filename: streaminfo.h - * project : MPEG-2 AAC Decoder - * contents/description: current bitstream parameters - * -\***************************************************************************/ - -#ifndef __STREAMINFO_H__ -#define __STREAMINFO_H__ - -#define COPYRIGHT_SIZE 9 -#define BYTE_SIZE 8 - -typedef struct -{ - unsigned int m_SamplingRateIndex ; - unsigned int m_SamplingRate ; - unsigned int m_Profile ; - unsigned int m_ChannelConfig ; - unsigned int m_Channels ; - unsigned int m_BitRate ; - - unsigned int m_ProtectionAbsent; - unsigned int m_OriginalCopy; - unsigned int m_Home; - char m_CopyrightID[COPYRIGHT_SIZE]; - unsigned int m_FrameLength; - - unsigned int m_ChannelMask ; - - unsigned int m_NumberOfFrontChannels ; - unsigned int m_NumberOfSideChannels ; - unsigned int m_NumberOfBackChannels ; - unsigned int m_NumberOfLfeChannels ; - - unsigned int m_ADTSFrameLength; - unsigned int m_ADTSNumberOfRawDataBlocks; - - bool m_UseDblLengthXfrm; - -} STREAMINFO, * PSTREAMINFO ; - -#ifdef __cplusplus - -/** Stream Configuration and Information. - - This class holds configuration and information data for a stream to be decoded. It - provides the calling application as well as the decoder with substantial information, - e.g. profile, sampling rate, number of channels found in the bitstream etc. -*/ - -class CStreamInfo : protected STREAMINFO -{ - -public : - - /// Object Constructor. Initializes all the STREAMINFO members to zero. - - CStreamInfo () - { - m_SamplingRateIndex = 0 ; - m_SamplingRate = 0 ; - m_Profile = 0 ; - m_ChannelConfig = 0 ; - m_Channels = 0 ; - m_BitRate = 0 ; - m_UseDblLengthXfrm = false; - } - - virtual ~CStreamInfo() - { - } - - void SetUseDblLengthXfrm(bool flag) - { - m_UseDblLengthXfrm = flag; - } - - - /// Configures the sampling rate by index. - - void SetSamplingRateIndex (unsigned int sf) - { - m_SamplingRateIndex = sf ; - } - - /// Retrieves the sampling rate by index. - - unsigned int GetSamplingRateIndex (void) const - { - return m_SamplingRateIndex ; - } - - /// Configures the decoder profile. - - void SetProfile (unsigned int profile) - { - m_Profile = profile ; - } - - /// Retrieves the decoder profile. - - unsigned int GetProfile (void) const - { - return m_Profile ; - } - - /// Configures the channel configuration. - - void SetChannelConfig (unsigned int config) - { - m_ChannelConfig = config ; - } - - /// Retrieves the channel configuration. - - unsigned int GetChannelConfig (void) const - { - return m_ChannelConfig ; - } - - /// Configures the number of decoded channels (by value). - - void SetChannels (unsigned int chan) - { - m_Channels = chan ; - } - - /// Configures the number of decoded channels (incrementally). - - void IncChannels (unsigned int chan) - { - m_Channels += chan ; - } - - /// Retrieves the number of decoded channels. - - unsigned int GetChannels (void) const - { - return m_Channels ; - } - - /// Configures the bitrate. - - void SetBitRate (unsigned int bps) - { - m_BitRate = bps ; - } - - /// Retrieves the bitrate. - - unsigned int GetBitRate (void) const - { - return m_BitRate ; - } - - /// Configures the sampling rate by value. - - void SetSamplingRate (unsigned int sf) - { - m_SamplingRate = sf ; - } - - /// Retrieves the sampling rate by value. - - unsigned int GetSamplingRate (void) const - { - if (m_UseDblLengthXfrm) - { - return m_SamplingRate << 1; - } - else - { - return m_SamplingRate ; - } - } - - /// Retrieves the sampling rate by value. - - unsigned int GetRawSamplingRate (void) const - { - return m_SamplingRate ; - } - - /// Configures the protection absent flag. - - void SetProtectionAbsent (unsigned int pa) - { - m_ProtectionAbsent = pa ; - } - - /// Retrieves the protection absent flag. - - unsigned int GetProtectionAbsent (void) const - { - return m_ProtectionAbsent ; - } - - /// Configures the original copy flag. - - void SetOriginalCopy (unsigned int oc) - { - m_OriginalCopy = oc ; - } - - /// Retrieves the original copy flag. - - unsigned int GetOriginalCopy (void) const - { - return m_OriginalCopy ; - } - - /// Configures the home flag. - - void SetHome (unsigned int h) - { - m_Home = h ; - } - - /// Retrieves the home flag. - - unsigned int GetHome (void) const - { - return m_Home ; - } - - /// Configures the copyright id. - - void SetCopyrightID (char cid, int index) - { - m_CopyrightID[index] = cid ; - } - - /// Retrieves the copyright id. - - char GetCopyrightID (int index) const - { - return m_CopyrightID[index] ; - } - - /// Configures the frame length. - - void SetFrameLength (unsigned int fl) - { - m_FrameLength = fl ; - } - - /// Retrieves the frame length. - - unsigned int GetFrameLength (void) const - { - return m_FrameLength ; - } - - // Configures the channel present indicator mask - - void SetChannelMask (unsigned int channelMask) - { - m_ChannelMask = channelMask ; - } - - /// Retrieves the channel present indicator mask - - unsigned int GetChannelMask (void) - { - return m_ChannelMask ; - } - - /// Configures the number of front channels - - void SetNumberOfFrontChannels (unsigned int frontChannels) - { - m_NumberOfFrontChannels = frontChannels ; - } - - /// Retrieves the number of front channels - - int GetNumberOfFrontChannels (void) - { - return m_NumberOfFrontChannels ; - } - - /// Configures the number of side channels - - void SetNumberOfSideChannels (unsigned int sideChannels) - { - m_NumberOfSideChannels = sideChannels ; - } - - /// Retrieves the number of side channels - - int GetNumberOfSideChannels (void) - { - return m_NumberOfSideChannels ; - } - - /// Configures the number of back channels - - void SetNumberOfBackChannels (unsigned int backChannels) - { - m_NumberOfBackChannels = backChannels ; - } - - /// Retrieves the number of back channels - - int GetNumberOfBackChannels (void) - { - return m_NumberOfBackChannels ; - } - - // Configures the number of Low Frequency Enhancement channels - - void SetNumberOfLfeChannels (unsigned int lfeChannels) - { - m_NumberOfLfeChannels = lfeChannels ; - } - - // Retrieves the number of Low Frequency Enhancement channels - - int GetNumberOfLfeChannels (void) - { - return m_NumberOfLfeChannels ; - } - - // - - enum - { - SamplesPerFrame = 1024 - } ; - - /// Retrieves the number of delivered samples per audio frame. - - unsigned int GetSamplesPerFrame (void) const - { - return SamplesPerFrame ; - } - - /// Retrieves the number of delivered bytes per audio frame - - unsigned int GetOutputBytes (void) const - { - return GetSamplesPerFrame () * GetChannels () * sizeof (short) ; - } - - void setSampleRate(); -} ; - -#endif - -/// constants for speaker positions and channel index mapping - -enum -{ - Channel_FrontLeft = 0, - Channel_FrontRight = 1, - Channel_FrontCenter = 2, - Channel_LowFrequency = 3, - Channel_BackLeft = 4, - Channel_BackRight = 5, - Channel_FrontLeftOfCenter = 6, - Channel_FrontRightOfCenter = 7, - Channel_BackCenter = 8, - Channel_SideLeft = 9, - Channel_SideRight = 10, - Speaker_StandardPositions, - - Speaker_FrontLeft = 1 << Channel_FrontLeft, - Speaker_FrontRight = 1 << Channel_FrontRight, - Speaker_FrontCenter = 1 << Channel_FrontCenter, - Speaker_LowFrequency = 1 << Channel_LowFrequency, - Speaker_BackLeft = 1 << Channel_BackLeft, - Speaker_BackRight = 1 << Channel_BackRight, - Speaker_FrontLeftOfCenter = 1 << Channel_FrontLeftOfCenter, - Speaker_FrontRightOfCenter = 1 << Channel_FrontRightOfCenter, - Speaker_BackCenter = 1 << Channel_BackCenter, - Speaker_SideLeft = 1 << Channel_SideLeft, - Speaker_SideRight = 1 << Channel_SideRight, - - Speaker_FrontSpeakers = Speaker_FrontLeft + Speaker_FrontRight + Speaker_FrontCenter - -} ; - -#endif diff --git a/Src/vlb/tables.cpp b/Src/vlb/tables.cpp deleted file mode 100644 index 4ffae4387..000000000 --- a/Src/vlb/tables.cpp +++ /dev/null @@ -1,1175 +0,0 @@ -/* $Header: /cvs/root/winamp/vlb/tables.cpp,v 1.1 2009/04/28 20:21:11 audiodsp Exp $ */ - -/***************************************************************************\ - * - * Copyright 2000-2002 Dolby Laboratories, Inc. All Rights - * Reserved. Do not copy. Do not distribute. - * Confidential information. - * - * (C) copyright Fraunhofer - IIS (1998) - * All Rights Reserved - * - * filename: tables.cpp - * project : MPEG-2 AAC Decoder - * contents/description: scalefactor band widths, huffman tables and - * window functions - * -\***************************************************************************/ - -#include "channelinfo.h" -#include "block.h" - -static const int sfb_96_1024 [] = -{ - 0, 4, 8, 12, 16, 20, 24, 28, - 32, 36, 40, 44, 48, 52, 56, - 64, 72, 80, 88, 96, 108, 120, - 132, 144, 156, 172, 188, 212, 240, - 276, 320, 384, 448, 512, 576, 640, - 704, 768, 832, 896, 960, 1024 -} ; /* 41 scfbands */ - -static const int sfb_96_128 [] = -{ - 0, 4, 8, 12, 16, 20, 24, 32, - 40, 48, 64, 92, 128 -} ; /* 12 scfbands */ - -static const int sfb_64_1024 [] = -{ - 0, 4, 8, 12, 16, 20, 24, 28, - 32, 36, 40, 44, 48, 52, 56, - 64, 72, 80, 88, 100, 112, 124, - 140, 156, 172, 192, 216, 240, 268, - 304, 344, 384, 424, 464, 504, 544, - 584, 624, 664, 704, 744, 784, 824, - 864, 904, 944, 984, 1024 -} ; /* 41 scfbands 47 */ - -static const int sfb_64_128 [] = -{ - 0, 4, 8, 12, 16, 20, 24, 32, - 40, 48, 64, 92, 128 -} ; /* 12 scfbands */ - -static const int sfb_48_1024 [] = -{ - 0, 4, 8, 12, 16, 20, 24, 28, - 32, 36, 40, 48, 56, 64, 72, - 80, 88, 96, 108, 120, 132, 144, - 160, 176, 196, 216, 240, 264, 292, - 320, 352, 384, 416, 448, 480, 512, - 544, 576, 608, 640, 672, 704, 736, - 768, 800, 832, 864, 896, 928, 1024 -} ; - -static const int sfb_48_128 [] = -{ - 0, 4, 8, 12, 16, 20, 28, 36, - 44, 56, 68, 80, 96, 112, 128 -} ; - -static const int sfb_32_1024 [] = -{ - 0, 4, 8, 12, 16, 20, 24, 28, - 32, 36, 40, 48, 56, 64, 72, - 80, 88, 96, 108, 120, 132, 144, - 160, 176, 196, 216, 240, 264, 292, - 320, 352, 384, 416, 448, 480, 512, - 544, 576, 608, 640, 672, 704, 736, - 768, 800, 832, 864, 896, 928, 960, - 992, 1024 -} ; - -static const int sfb_24_1024 [] = -{ - 0, 4, 8, 12, 16, 20, 24, 28, - 32, 36, 40, 44, 52, 60, 68, - 76, 84, 92, 100, 108, 116, 124, - 136, 148, 160, 172, 188, 204, 220, - 240, 260, 284, 308, 336, 364, 396, - 432, 468, 508, 552, 600, 652, 704, - 768, 832, 896, 960, 1024 -} ; /* 47 scfbands */ - -static const int sfb_24_128 [] = -{ - 0, 4, 8, 12, 16, 20, 24, 28, - 36, 44, 52, 64, 76, 92, 108, - 128 -} ; /* 15 scfbands */ - -static const int sfb_16_1024 [] = -{ - 0, 8, 16, 24, 32, 40, 48, 56, - 64, 72, 80, 88, 100, 112, 124, - 136, 148, 160, 172, 184, 196, 212, - 228, 244, 260, 280, 300, 320, 344, - 368, 396, 424, 456, 492, 532, 572, - 616, 664, 716, 772, 832, 896, 960, - 1024 -}; /* 43 scfbands */ - -static const int sfb_16_128 [] = -{ - 0, 4, 8, 12, 16, 20, 24, 28, - 32, 40, 48, 60, 72, 88, 108, - 128 -} ; /* 15 scfbands */ - -static const int sfb_8_1024 [] = -{ - 0, 12, 24, 36, 48, 60, 72, 84, - 96, 108, 120, 132, 144, 156, 172, - 188, 204, 220, 236, 252, 268, 288, - 308, 328, 348, 372, 396, 420, 448, - 476, 508, 544, 580, 620, 664, 712, - 764, 820, 880, 944, 1024 -} ; /* 40 scfbands */ - -static const int sfb_8_128 [] = -{ - 0, 4, 8, 12, 16, 20, 24, 28, - 36, 44, 52, 60, 72, 88, 108, - 128 -} ; /* 15 scfbands */ - -const CChannelInfo::SamplingRateInfo CChannelInfo::m_SamplingRateInfoTable [16] = -{ - // sampling_frequency, #long sfb, long sfb, #short sfb, short sfb - // fs num_swb_long_window sfbands_long num_swb_short_window sfbands_short pred_max_sfb - { 96000, 41, sfb_96_1024, 12, sfb_96_128, 33 }, /* 96000 */ - { 88200, 41, sfb_96_1024, 12, sfb_96_128, 33 }, /* 88200 */ - { 64000, 47, sfb_64_1024, 12, sfb_64_128, 38 }, /* 64000 */ - { 48000, 49, sfb_48_1024, 14, sfb_48_128, 40 }, /* 48000 */ - { 44100, 49, sfb_48_1024, 14, sfb_48_128, 40 }, /* 44100 */ - { 32000, 51, sfb_32_1024, 14, sfb_48_128, 40 }, /* 32000 */ - { 24000, 47, sfb_24_1024, 15, sfb_24_128, 41 }, /* 24000 */ - { 22050, 47, sfb_24_1024, 15, sfb_24_128, 41 }, /* 22050 */ - { 16000, 43, sfb_16_1024, 15, sfb_16_128, 37 }, /* 16000 */ - { 12000, 43, sfb_16_1024, 15, sfb_16_128, 37 }, /* 12000 */ - { 11025, 43, sfb_16_1024, 15, sfb_16_128, 37 }, /* 11025 */ - { 8000, 40, sfb_8_1024, 15, sfb_8_128, 34 }, /* 8000 */ - { 0,0,0,0,0,0 }, - { 0,0,0,0,0,0 }, - { 0,0,0,0,0,0 }, - { 0,0,0,0,0,0 } -} ; - -// CBlock::HuffmanBits parallel huffman tables -// LSB:CODE , MSB:Len, if Len == 0x00 LSB is next row index - -static const unsigned int HuffmanCodeBook_1[25][CBlock::HuffmanEntries]= -{ -{0x00010028,0x00010028,0x00010028,0x00010028,0x00010028,0x00010028,0x00010028,0x00010028,0x00000001,0x00000002,0x00000003,0x00000004,0x00000005,0x00000006,0x00000007,0x00000008}, -{0x00050043,0x00050043,0x00050043,0x00050043,0x00050043,0x00050043,0x00050043,0x00050043,0x0005000d,0x0005000d,0x0005000d,0x0005000d,0x0005000d,0x0005000d,0x0005000d,0x0005000d}, -{0x00050027,0x00050027,0x00050027,0x00050027,0x00050027,0x00050027,0x00050027,0x00050027,0x00050031,0x00050031,0x00050031,0x00050031,0x00050031,0x00050031,0x00050031,0x00050031}, -{0x00050029,0x00050029,0x00050029,0x00050029,0x00050029,0x00050029,0x00050029,0x00050029,0x00050025,0x00050025,0x00050025,0x00050025,0x00050025,0x00050025,0x00050025,0x00050025}, -{0x0005002b,0x0005002b,0x0005002b,0x0005002b,0x0005002b,0x0005002b,0x0005002b,0x0005002b,0x0005001f,0x0005001f,0x0005001f,0x0005001f,0x0005001f,0x0005001f,0x0005001f,0x0005001f}, -{0x0007003a,0x0007003a,0x00070016,0x00070016,0x00070026,0x00070026,0x0007002e,0x0007002e,0x00070022,0x00070022,0x0007002a,0x0007002a,0x0007004c,0x0007004c,0x00070024,0x00070024}, -{0x00070004,0x00070004,0x0007001c,0x0007001c,0x00070040,0x00070040,0x00070030,0x00070030,0x00070010,0x00070010,0x0007002c,0x0007002c,0x00070046,0x00070046,0x00070020,0x00070020}, -{0x00070034,0x00070034,0x00070032,0x00070032,0x0007000a,0x0007000a,0x00070044,0x00070044,0x0007000c,0x0007000c,0x00070042,0x00070042,0x0007000e,0x0007000e,0x0007001e,0x0007001e}, -{0x00000009,0x0000000a,0x0000000b,0x0000000c,0x0000000d,0x0000000e,0x0000000f,0x00000010,0x00000011,0x00000012,0x00000013,0x00000014,0x00000015,0x00000016,0x00000017,0x00000018}, -{0x00090049,0x00090049,0x00090049,0x00090049,0x00090049,0x00090049,0x00090049,0x00090049,0x00090013,0x00090013,0x00090013,0x00090013,0x00090013,0x00090013,0x00090013,0x00090013}, -{0x0009003d,0x0009003d,0x0009003d,0x0009003d,0x0009003d,0x0009003d,0x0009003d,0x0009003d,0x00090033,0x00090033,0x00090033,0x00090033,0x00090033,0x00090033,0x00090033,0x00090033}, -{0x0009002f,0x0009002f,0x0009002f,0x0009002f,0x0009002f,0x0009002f,0x0009002f,0x0009002f,0x00090023,0x00090023,0x00090023,0x00090023,0x00090023,0x00090023,0x00090023,0x00090023}, -{0x00090021,0x00090021,0x00090021,0x00090021,0x00090021,0x00090021,0x00090021,0x00090021,0x00090037,0x00090037,0x00090037,0x00090037,0x00090037,0x00090037,0x00090037,0x00090037}, -{0x00090041,0x00090041,0x00090041,0x00090041,0x00090041,0x00090041,0x00090041,0x00090041,0x0009002d,0x0009002d,0x0009002d,0x0009002d,0x0009002d,0x0009002d,0x0009002d,0x0009002d}, -{0x00090019,0x00090019,0x00090019,0x00090019,0x00090019,0x00090019,0x00090019,0x00090019,0x0009000f,0x0009000f,0x0009000f,0x0009000f,0x0009000f,0x0009000f,0x0009000f,0x0009000f}, -{0x00090007,0x00090007,0x00090007,0x00090007,0x00090007,0x00090007,0x00090007,0x00090007,0x0009001d,0x0009001d,0x0009001d,0x0009001d,0x0009001d,0x0009001d,0x0009001d,0x0009001d}, -{0x0009003b,0x0009003b,0x0009003b,0x0009003b,0x0009003b,0x0009003b,0x0009003b,0x0009003b,0x00090039,0x00090039,0x00090039,0x00090039,0x00090039,0x00090039,0x00090039,0x00090039}, -{0x00090015,0x00090015,0x00090015,0x00090015,0x00090015,0x00090015,0x00090015,0x00090015,0x00090001,0x00090001,0x00090001,0x00090001,0x00090001,0x00090001,0x00090001,0x00090001}, -{0x0009001b,0x0009001b,0x0009001b,0x0009001b,0x0009001b,0x0009001b,0x0009001b,0x0009001b,0x00090035,0x00090035,0x00090035,0x00090035,0x00090035,0x00090035,0x00090035,0x00090035}, -{0x00090045,0x00090045,0x00090045,0x00090045,0x00090045,0x00090045,0x00090045,0x00090045,0x0009004d,0x0009004d,0x0009004d,0x0009004d,0x0009004d,0x0009004d,0x0009004d,0x0009004d}, -{0x00090017,0x00090017,0x00090017,0x00090017,0x00090017,0x00090017,0x00090017,0x00090017,0x0009004f,0x0009004f,0x0009004f,0x0009004f,0x0009004f,0x0009004f,0x0009004f,0x0009004f}, -{0x000a0005,0x000a0005,0x000a0005,0x000a0005,0x000a0009,0x000a0009,0x000a0009,0x000a0009,0x000a004b,0x000a004b,0x000a004b,0x000a004b,0x000a003f,0x000a003f,0x000a003f,0x000a003f}, -{0x000a000b,0x000a000b,0x000a000b,0x000a000b,0x000a0003,0x000a0003,0x000a0003,0x000a0003,0x000a0011,0x000a0011,0x000a0011,0x000a0011,0x000a0047,0x000a0047,0x000a0047,0x000a0047}, -{0x000b003c,0x000b003c,0x000b0014,0x000b0014,0x000b0018,0x000b0018,0x000b0038,0x000b0038,0x000b0050,0x000b0050,0x000b0008,0x000b0008,0x000b0048,0x000b0048,0x000b0006,0x000b0006}, -{0x000b0000,0x000b0000,0x000b004a,0x000b004a,0x000b003e,0x000b003e,0x000b001a,0x000b001a,0x000b0012,0x000b0012,0x000b0002,0x000b0002,0x000b0036,0x000b0036,0x000b004e,0x000b004e} -}; - -static const unsigned int HuffmanCodeBook_2[21][CBlock::HuffmanEntries]= -{ -{0x00030028,0x00030028,0x00040043,0x00000001,0x00000002,0x00000003,0x00000004,0x00000005,0x00000006,0x00000007,0x00000008,0x00000009,0x0000000a,0x0000000b,0x0000000c,0x0000000d}, -{0x0005000d,0x0005000d,0x0005000d,0x0005000d,0x0005000d,0x0005000d,0x0005000d,0x0005000d,0x00050029,0x00050029,0x00050029,0x00050029,0x00050029,0x00050029,0x00050029,0x00050029}, -{0x00050025,0x00050025,0x00050025,0x00050025,0x00050025,0x00050025,0x00050025,0x00050025,0x00050027,0x00050027,0x00050027,0x00050027,0x00050027,0x00050027,0x00050027,0x00050027}, -{0x0005001f,0x0005001f,0x0005001f,0x0005001f,0x0005001f,0x0005001f,0x0005001f,0x0005001f,0x0005002b,0x0005002b,0x0005002b,0x0005002b,0x0005002b,0x0005002b,0x0005002b,0x0005002b}, -{0x00050031,0x00050031,0x00050031,0x00050031,0x00050031,0x00050031,0x00050031,0x00050031,0x00060022,0x00060022,0x00060022,0x00060022,0x00060016,0x00060016,0x00060016,0x00060016}, -{0x0006002e,0x0006002e,0x0006002e,0x0006002e,0x0006002a,0x0006002a,0x0006002a,0x0006002a,0x00060030,0x00060030,0x00060030,0x00060030,0x00060026,0x00060026,0x00060026,0x00060026}, -{0x0006000c,0x0006000c,0x0006000c,0x0006000c,0x0006003a,0x0006003a,0x0006003a,0x0006003a,0x00060040,0x00060040,0x00060040,0x00060040,0x00060004,0x00060004,0x00060004,0x00060004}, -{0x00060024,0x00060024,0x00060024,0x00060024,0x00060046,0x00060046,0x00060046,0x00060046,0x00060044,0x00060044,0x00060044,0x00060044,0x00060020,0x00060020,0x00060020,0x00060020}, -{0x00060010,0x00060010,0x00060010,0x00060010,0x00060032,0x00060032,0x00060032,0x00060032,0x0006001c,0x0006001c,0x0006001c,0x0006001c,0x0006000e,0x0006000e,0x0006000e,0x0006000e}, -{0x0006001e,0x0006001e,0x0006001e,0x0006001e,0x0006000a,0x0006000a,0x0006000a,0x0006000a,0x0006004c,0x0006004c,0x0006004c,0x0006004c,0x00060034,0x00060034,0x00060034,0x00060034}, -{0x0006002c,0x0006002c,0x0006002c,0x0006002c,0x00060042,0x00060042,0x00060042,0x00060042,0x0007002f,0x0007002f,0x00070041,0x00070041,0x00070013,0x00070013,0x00070021,0x00070021}, -{0x0007003d,0x0007003d,0x0007004b,0x0007004b,0x00070047,0x00070047,0x00070019,0x00070019,0x0007001d,0x0007001d,0x0007004f,0x0007004f,0x0007000f,0x0007000f,0x00070001,0x00070001}, -{0x0007000b,0x0007000b,0x00070037,0x00070037,0x00070049,0x00070049,0x0008003b,0x00080015,0x00080007,0x00080011,0x00080005,0x00080003,0x0008001b,0x00080045,0x0008003f,0x0008002d}, -{0x00080035,0x00080017,0x00080009,0x00080033,0x00080039,0x00080023,0x0008004d,0x0008003c,0x00080014,0x0000000e,0x0000000f,0x00000010,0x00000011,0x00000012,0x00000013,0x00000014}, -{0x00090038,0x00090038,0x00090038,0x00090038,0x00090038,0x00090038,0x00090038,0x00090038,0x00090000,0x00090000,0x00090000,0x00090000,0x00090000,0x00090000,0x00090000,0x00090000}, -{0x00090018,0x00090018,0x00090018,0x00090018,0x00090018,0x00090018,0x00090018,0x00090018,0x0009001a,0x0009001a,0x0009001a,0x0009001a,0x0009001a,0x0009001a,0x0009001a,0x0009001a}, -{0x00090050,0x00090050,0x00090050,0x00090050,0x00090050,0x00090050,0x00090050,0x00090050,0x00090006,0x00090006,0x00090006,0x00090006,0x00090006,0x00090006,0x00090006,0x00090006}, -{0x0009003e,0x0009003e,0x0009003e,0x0009003e,0x0009003e,0x0009003e,0x0009003e,0x0009003e,0x00090012,0x00090012,0x00090012,0x00090012,0x00090012,0x00090012,0x00090012,0x00090012}, -{0x00090008,0x00090008,0x00090008,0x00090008,0x00090008,0x00090008,0x00090008,0x00090008,0x00090048,0x00090048,0x00090048,0x00090048,0x00090048,0x00090048,0x00090048,0x00090048}, -{0x00090036,0x00090036,0x00090036,0x00090036,0x00090036,0x00090036,0x00090036,0x00090036,0x00090002,0x00090002,0x00090002,0x00090002,0x00090002,0x00090002,0x00090002,0x00090002}, -{0x0009004a,0x0009004a,0x0009004a,0x0009004a,0x0009004a,0x0009004a,0x0009004a,0x0009004a,0x0009004e,0x0009004e,0x0009004e,0x0009004e,0x0009004e,0x0009004e,0x0009004e,0x0009004e} -}; - -static const unsigned int HuffmanCodeBook_3[21][CBlock::HuffmanEntries]= -{ -{0x00010000,0x00010000,0x00010000,0x00010000,0x00010000,0x00010000,0x00010000,0x00010000,0x0004001b,0x00040001,0x00040009,0x00040003,0x00000001,0x00000002,0x00000003,0x00000004}, -{0x00050024,0x00050024,0x00050024,0x00050024,0x00050024,0x00050024,0x00050024,0x00050024,0x00050004,0x00050004,0x00050004,0x00050004,0x00050004,0x00050004,0x00050004,0x00050004}, -{0x0006000c,0x0006000c,0x0006000c,0x0006000c,0x0006000a,0x0006000a,0x0006000a,0x0006000a,0x0006001e,0x0006001e,0x0006001e,0x0006001e,0x0006000d,0x0006000d,0x0006000d,0x0006000d}, -{0x0006001c,0x0006001c,0x0006001c,0x0006001c,0x00060027,0x00060027,0x00060027,0x00060027,0x00070028,0x00070028,0x0007001f,0x0007001f,0x00070025,0x00070025,0x00080036,0x00080002}, -{0x00080005,0x0008003f,0x00080030,0x00000005,0x00000006,0x00000007,0x00000008,0x00000009,0x0000000a,0x0000000b,0x0000000c,0x0000000d,0x0000000e,0x0000000f,0x00000010,0x00000011}, -{0x00090007,0x00090007,0x00090007,0x00090007,0x00090007,0x00090007,0x00090007,0x00090007,0x00090010,0x00090010,0x00090010,0x00090010,0x00090010,0x00090010,0x00090010,0x00090010}, -{0x0009002d,0x0009002d,0x0009002d,0x0009002d,0x0009002d,0x0009002d,0x0009002d,0x0009002d,0x0009000e,0x0009000e,0x0009000e,0x0009000e,0x0009000e,0x0009000e,0x0009000e,0x0009000e}, -{0x00090042,0x00090042,0x00090042,0x00090042,0x00090042,0x00090042,0x00090042,0x00090042,0x00090006,0x00090006,0x00090006,0x00090006,0x00090006,0x00090006,0x00090006,0x00090006}, -{0x00090015,0x00090015,0x00090015,0x00090015,0x00090015,0x00090015,0x00090015,0x00090015,0x0009000f,0x0009000f,0x0009000f,0x0009000f,0x0009000f,0x0009000f,0x0009000f,0x0009000f}, -{0x00090012,0x00090012,0x00090012,0x00090012,0x00090012,0x00090012,0x00090012,0x00090012,0x0009000b,0x0009000b,0x0009000b,0x0009000b,0x0009000b,0x0009000b,0x0009000b,0x0009000b}, -{0x00090039,0x00090039,0x00090039,0x00090039,0x00090039,0x00090039,0x00090039,0x00090039,0x00090031,0x00090031,0x00090031,0x00090031,0x00090031,0x00090031,0x00090031,0x00090031}, -{0x00090016,0x00090016,0x00090016,0x00090016,0x00090016,0x00090016,0x00090016,0x00090016,0x0009002a,0x0009002a,0x0009002a,0x0009002a,0x0009002a,0x0009002a,0x0009002a,0x0009002a}, -{0x0009002b,0x0009002b,0x0009002b,0x0009002b,0x0009002b,0x0009002b,0x0009002b,0x0009002b,0x000a002e,0x000a002e,0x000a002e,0x000a002e,0x000a0021,0x000a0021,0x000a0021,0x000a0021}, -{0x000a0022,0x000a0022,0x000a0022,0x000a0022,0x000a0013,0x000a0013,0x000a0013,0x000a0013,0x000a0043,0x000a0043,0x000a0043,0x000a0043,0x000a0029,0x000a0029,0x000a0029,0x000a0029}, -{0x000a0040,0x000a0040,0x000a0040,0x000a0040,0x000a0020,0x000a0020,0x000a0020,0x000a0020,0x000a0008,0x000a0008,0x000a0008,0x000a0008,0x000a0011,0x000a0011,0x000a0011,0x000a0011}, -{0x000a004b,0x000a004b,0x000a004b,0x000a004b,0x000a0033,0x000a0033,0x000a0033,0x000a0033,0x000a001d,0x000a001d,0x000a001d,0x000a001d,0x000a0037,0x000a0037,0x000a0037,0x000a0037}, -{0x000a0019,0x000a0019,0x000a0019,0x000a0019,0x000b0048,0x000b0048,0x000b0034,0x000b0034,0x000b0026,0x000b0026,0x000b003a,0x000b003a,0x000b002c,0x000b002c,0x000b004c,0x000b004c}, -{0x000b0018,0x000b0018,0x000b0017,0x000b0017,0x000c0023,0x000c0049,0x000c0045,0x000c004e,0x000c001a,0x000c004f,0x000c0046,0x000c0032,0x000c0035,0x00000012,0x00000013,0x00000014}, -{0x000d0014,0x000d0014,0x000d0014,0x000d0014,0x000d0014,0x000d0014,0x000d0014,0x000d0014,0x000d003c,0x000d003c,0x000d003c,0x000d003c,0x000d003c,0x000d003c,0x000d003c,0x000d003c}, -{0x000d002f,0x000d002f,0x000d002f,0x000d002f,0x000d002f,0x000d002f,0x000d002f,0x000d002f,0x000e003d,0x000e003d,0x000e003d,0x000e003d,0x000e0044,0x000e0044,0x000e0044,0x000e0044}, -{0x000e0041,0x000e0041,0x000e0041,0x000e0041,0x000f0050,0x000f0050,0x000f004d,0x000f004d,0x000f0047,0x000f0047,0x000f003b,0x000f003b,0x000f0038,0x000f0038,0x0010004a,0x0010003e} -}; - -static const unsigned int HuffmanCodeBook_4[16][CBlock::HuffmanEntries]= -{ -{0x00040028,0x0004000d,0x00040025,0x00040027,0x0004001f,0x0004001b,0x00040024,0x00040000,0x00040004,0x0004001e,0x00000001,0x00000002,0x00000003,0x00000004,0x00000005,0x00000006}, -{0x0005001c,0x0005001c,0x0005001c,0x0005001c,0x0005001c,0x0005001c,0x0005001c,0x0005001c,0x0005000c,0x0005000c,0x0005000c,0x0005000c,0x0005000c,0x0005000c,0x0005000c,0x0005000c}, -{0x00050001,0x00050001,0x00050001,0x00050001,0x00050001,0x00050001,0x00050001,0x00050001,0x0005000a,0x0005000a,0x0005000a,0x0005000a,0x0005000a,0x0005000a,0x0005000a,0x0005000a}, -{0x00050003,0x00050003,0x00050003,0x00050003,0x00050003,0x00050003,0x00050003,0x00050003,0x00050009,0x00050009,0x00050009,0x00050009,0x00050009,0x00050009,0x00050009,0x00050009}, -{0x00070043,0x00070043,0x0007002b,0x0007002b,0x00070031,0x00070031,0x00070029,0x00070029,0x00070042,0x00070042,0x00070040,0x00070040,0x00070030,0x00070030,0x0007003a,0x0007003a}, -{0x00070010,0x00070010,0x0008000e,0x0008002a,0x00080016,0x00080020,0x0008002e,0x00080026,0x00080022,0x0008003f,0x00080039,0x0008002d,0x00080037,0x0008000b,0x00080015,0x00080005}, -{0x0008000f,0x00080013,0x0008001d,0x00080007,0x00080021,0x00080036,0x00080002,0x00000007,0x00000008,0x00000009,0x0000000a,0x0000000b,0x0000000c,0x0000000d,0x0000000e,0x0000000f}, -{0x00090012,0x00090012,0x00090012,0x00090012,0x00090012,0x00090012,0x00090012,0x00090012,0x00090006,0x00090006,0x00090006,0x00090006,0x00090006,0x00090006,0x00090006,0x00090006}, -{0x00090034,0x00090034,0x00090034,0x00090034,0x00090034,0x00090034,0x00090034,0x00090034,0x0009004c,0x0009004c,0x0009004c,0x0009004c,0x0009004c,0x0009004c,0x0009004c,0x0009004c}, -{0x00090046,0x00090046,0x00090046,0x00090046,0x00090046,0x00090046,0x00090046,0x00090046,0x0009002c,0x0009002c,0x0009002c,0x0009002c,0x0009002c,0x0009002c,0x0009002c,0x0009002c}, -{0x00090032,0x00090032,0x00090032,0x00090032,0x00090032,0x00090032,0x00090032,0x00090032,0x00090044,0x00090044,0x00090044,0x00090044,0x00090044,0x00090044,0x00090044,0x00090044}, -{0x000a0033,0x000a0033,0x000a0033,0x000a0033,0x000a004b,0x000a004b,0x000a004b,0x000a004b,0x000a0045,0x000a0045,0x000a0045,0x000a0045,0x000a0019,0x000a0019,0x000a0019,0x000a0019}, -{0x000a0011,0x000a0011,0x000a0011,0x000a0011,0x000a0049,0x000a0049,0x000a0049,0x000a0049,0x000a0017,0x000a0017,0x000a0017,0x000a0017,0x000a003d,0x000a003d,0x000a003d,0x000a003d}, -{0x000a0023,0x000a0023,0x000a0023,0x000a0023,0x000a004f,0x000a004f,0x000a004f,0x000a004f,0x000a002f,0x000a002f,0x000a002f,0x000a002f,0x000a003b,0x000a003b,0x000a003b,0x000a003b}, -{0x000a0041,0x000a0041,0x000a0041,0x000a0041,0x000a0035,0x000a0035,0x000a0035,0x000a0035,0x000b0047,0x000b0047,0x000b004d,0x000b004d,0x000b0018,0x000b0018,0x000b0048,0x000b0048}, -{0x000b0008,0x000b0008,0x000b003c,0x000b003c,0x000b0014,0x000b0014,0x000b0038,0x000b0038,0x000b0050,0x000b0050,0x000b001a,0x000b001a,0x000b004e,0x000b004e,0x000c004a,0x000c003e} -}; - -static const unsigned int HuffmanCodeBook_5[19][CBlock::HuffmanEntries]= -{ -{0x00010028,0x00010028,0x00010028,0x00010028,0x00010028,0x00010028,0x00010028,0x00010028,0x0004001f,0x00040031,0x00040029,0x00040027,0x00000001,0x00000002,0x00000003,0x00000004}, -{0x00050030,0x00050030,0x00050030,0x00050030,0x00050030,0x00050030,0x00050030,0x00050030,0x00050020,0x00050020,0x00050020,0x00050020,0x00050020,0x00050020,0x00050020,0x00050020}, -{0x0005001e,0x0005001e,0x0005001e,0x0005001e,0x0005001e,0x0005001e,0x0005001e,0x0005001e,0x00050032,0x00050032,0x00050032,0x00050032,0x00050032,0x00050032,0x00050032,0x00050032}, -{0x00070016,0x00070016,0x0007002a,0x0007002a,0x0007003a,0x0007003a,0x00070026,0x00070026,0x00080015,0x0008003b,0x0008001d,0x00080033,0x00080017,0x00080039,0x00080021,0x0008002f}, -{0x0008000d,0x00080043,0x00080025,0x0008002b,0x00000005,0x00000006,0x00000007,0x00000008,0x00000009,0x0000000a,0x0000000b,0x0000000c,0x0000000d,0x0000000e,0x0000000f,0x00000010}, -{0x0009000c,0x0009000c,0x0009000c,0x0009000c,0x0009000c,0x0009000c,0x0009000c,0x0009000c,0x00090034,0x00090034,0x00090034,0x00090034,0x00090034,0x00090034,0x00090034,0x00090034}, -{0x00090044,0x00090044,0x00090044,0x00090044,0x00090044,0x00090044,0x00090044,0x00090044,0x0009001c,0x0009001c,0x0009001c,0x0009001c,0x0009001c,0x0009001c,0x0009001c,0x0009001c}, -{0x0009000e,0x0009000e,0x0009000e,0x0009000e,0x0009000e,0x0009000e,0x0009000e,0x0009000e,0x00090042,0x00090042,0x00090042,0x00090042,0x00090042,0x00090042,0x00090042,0x00090042}, -{0x0009002e,0x0009002e,0x0009002e,0x0009002e,0x0009002e,0x0009002e,0x0009002e,0x0009002e,0x00090022,0x00090022,0x00090022,0x00090022,0x00090022,0x00090022,0x00090022,0x00090022}, -{0x00090018,0x00090018,0x00090018,0x00090018,0x00090018,0x00090018,0x00090018,0x00090018,0x0009003c,0x0009003c,0x0009003c,0x0009003c,0x0009003c,0x0009003c,0x0009003c,0x0009003c}, -{0x00090014,0x00090014,0x00090014,0x00090014,0x00090014,0x00090014,0x00090014,0x00090014,0x00090038,0x00090038,0x00090038,0x00090038,0x00090038,0x00090038,0x00090038,0x00090038}, -{0x000a000b,0x000a000b,0x000a000b,0x000a000b,0x000a0041,0x000a0041,0x000a0041,0x000a0041,0x000a0019,0x000a0019,0x000a0019,0x000a0019,0x000a0037,0x000a0037,0x000a0037,0x000a0037}, -{0x000a0045,0x000a0045,0x000a0045,0x000a0045,0x000a003d,0x000a003d,0x000a003d,0x000a003d,0x000a000f,0x000a000f,0x000a000f,0x000a000f,0x000a0013,0x000a0013,0x000a0013,0x000a0013}, -{0x000a0024,0x000a0024,0x000a0024,0x000a0024,0x000a0004,0x000a0004,0x000a0004,0x000a0004,0x000a004d,0x000a004d,0x000a004d,0x000a004d,0x000a004c,0x000a004c,0x000a004c,0x000a004c}, -{0x000b0003,0x000b0003,0x000b002c,0x000b002c,0x000b004b,0x000b004b,0x000b001b,0x000b001b,0x000b0035,0x000b0035,0x000b0023,0x000b0023,0x000b0005,0x000b0005,0x000b002d,0x000b002d}, -{0x000b0040,0x000b0040,0x000b000a,0x000b000a,0x000b0010,0x000b0010,0x000b001a,0x000b001a,0x000b0002,0x000b0002,0x000b004e,0x000b004e,0x000b0036,0x000b0036,0x000b003e,0x000b003e}, -{0x000b0046,0x000b0046,0x000b0006,0x000b0006,0x000c0012,0x000c004a,0x000c003f,0x000c0001,0x000c0007,0x000c0047,0x000c0011,0x000c004f,0x000c0049,0x000c0009,0x00000011,0x00000012}, -{0x000d0048,0x000d0048,0x000d0048,0x000d0048,0x000d0048,0x000d0048,0x000d0048,0x000d0048,0x000d0008,0x000d0008,0x000d0008,0x000d0008,0x000d0008,0x000d0008,0x000d0008,0x000d0008}, -{0x000d0050,0x000d0050,0x000d0050,0x000d0050,0x000d0050,0x000d0050,0x000d0050,0x000d0050,0x000d0000,0x000d0000,0x000d0000,0x000d0000,0x000d0000,0x000d0000,0x000d0000,0x000d0000} -}; - -static const unsigned int HuffmanCodeBook_6[22][CBlock::HuffmanEntries]= -{ -{0x00040028,0x00040031,0x00040027,0x00040029,0x0004001f,0x00040032,0x00040020,0x00040030,0x0004001e,0x00000001,0x00000002,0x00000003,0x00000004,0x00000005,0x00000006,0x00000007}, -{0x00060039,0x00060039,0x00060039,0x00060039,0x0006003b,0x0006003b,0x0006003b,0x0006003b,0x00060017,0x00060017,0x00060017,0x00060017,0x00060015,0x00060015,0x00060015,0x00060015}, -{0x00060016,0x00060016,0x00060016,0x00060016,0x00060021,0x00060021,0x00060021,0x00060021,0x0006003a,0x0006003a,0x0006003a,0x0006003a,0x0006002f,0x0006002f,0x0006002f,0x0006002f}, -{0x00060033,0x00060033,0x00060033,0x00060033,0x00060026,0x00060026,0x00060026,0x00060026,0x0006001d,0x0006001d,0x0006001d,0x0006001d,0x0006002a,0x0006002a,0x0006002a,0x0006002a}, -{0x00060038,0x00060038,0x00060038,0x00060038,0x00060018,0x00060018,0x00060018,0x00060018,0x00060014,0x00060014,0x00060014,0x00060014,0x0006003c,0x0006003c,0x0006003c,0x0006003c}, -{0x0007000e,0x0007000e,0x00070044,0x00070044,0x00070042,0x00070042,0x00070022,0x00070022,0x0007000c,0x0007000c,0x00070034,0x00070034,0x0007002e,0x0007002e,0x0007001c,0x0007001c}, -{0x00070043,0x00070043,0x0007000d,0x0007000d,0x00070025,0x00070025,0x0007002b,0x0007002b,0x00070045,0x00070045,0x0008000b,0x00080019,0x0008003d,0x00080041,0x00080037,0x00080013}, -{0x0008000f,0x00080046,0x00000008,0x00000009,0x0000000a,0x0000000b,0x0000000c,0x0000000d,0x0000000e,0x0000000f,0x00000010,0x00000011,0x00000012,0x00000013,0x00000014,0x00000015}, -{0x00090040,0x00090040,0x00090040,0x00090040,0x00090040,0x00090040,0x00090040,0x00090040,0x0009000a,0x0009000a,0x0009000a,0x0009000a,0x0009000a,0x0009000a,0x0009000a,0x0009000a}, -{0x00090010,0x00090010,0x00090010,0x00090010,0x00090010,0x00090010,0x00090010,0x00090010,0x0009002d,0x0009002d,0x0009002d,0x0009002d,0x0009002d,0x0009002d,0x0009002d,0x0009002d}, -{0x0009001b,0x0009001b,0x0009001b,0x0009001b,0x0009001b,0x0009001b,0x0009001b,0x0009001b,0x0009004d,0x0009004d,0x0009004d,0x0009004d,0x0009004d,0x0009004d,0x0009004d,0x0009004d}, -{0x00090005,0x00090005,0x00090005,0x00090005,0x00090005,0x00090005,0x00090005,0x00090005,0x00090003,0x00090003,0x00090003,0x00090003,0x00090003,0x00090003,0x00090003,0x00090003}, -{0x00090035,0x00090035,0x00090035,0x00090035,0x00090035,0x00090035,0x00090035,0x00090035,0x0009004b,0x0009004b,0x0009004b,0x0009004b,0x0009004b,0x0009004b,0x0009004b,0x0009004b}, -{0x00090023,0x00090023,0x00090023,0x00090023,0x00090023,0x00090023,0x00090023,0x00090023,0x00090024,0x00090024,0x00090024,0x00090024,0x00090024,0x00090024,0x00090024,0x00090024}, -{0x00090006,0x00090006,0x00090006,0x00090006,0x00090006,0x00090006,0x00090006,0x00090006,0x00090002,0x00090002,0x00090002,0x00090002,0x00090002,0x00090002,0x00090002,0x00090002}, -{0x0009003e,0x0009003e,0x0009003e,0x0009003e,0x0009003e,0x0009003e,0x0009003e,0x0009003e,0x00090012,0x00090012,0x00090012,0x00090012,0x00090012,0x00090012,0x00090012,0x00090012}, -{0x00090004,0x00090004,0x00090004,0x00090004,0x00090004,0x00090004,0x00090004,0x00090004,0x0009004e,0x0009004e,0x0009004e,0x0009004e,0x0009004e,0x0009004e,0x0009004e,0x0009004e}, -{0x0009004a,0x0009004a,0x0009004a,0x0009004a,0x0009004a,0x0009004a,0x0009004a,0x0009004a,0x0009001a,0x0009001a,0x0009001a,0x0009001a,0x0009001a,0x0009001a,0x0009001a,0x0009001a}, -{0x0009004c,0x0009004c,0x0009004c,0x0009004c,0x0009004c,0x0009004c,0x0009004c,0x0009004c,0x00090036,0x00090036,0x00090036,0x00090036,0x00090036,0x00090036,0x00090036,0x00090036}, -{0x0009002c,0x0009002c,0x0009002c,0x0009002c,0x0009002c,0x0009002c,0x0009002c,0x0009002c,0x000a0009,0x000a0009,0x000a0009,0x000a0009,0x000a0011,0x000a0011,0x000a0011,0x000a0011}, -{0x000a003f,0x000a003f,0x000a003f,0x000a003f,0x000a0049,0x000a0049,0x000a0049,0x000a0049,0x000a0047,0x000a0047,0x000a0047,0x000a0047,0x000a004f,0x000a004f,0x000a004f,0x000a004f}, -{0x000a0007,0x000a0007,0x000a0007,0x000a0007,0x000a0001,0x000a0001,0x000a0001,0x000a0001,0x000b0050,0x000b0050,0x000b0008,0x000b0008,0x000b0000,0x000b0000,0x000b0048,0x000b0048} -}; - -static const unsigned int HuffmanCodeBook_7[16][CBlock::HuffmanEntries]= -{ -{0x00010000,0x00010000,0x00010000,0x00010000,0x00010000,0x00010000,0x00010000,0x00010000,0x00030008,0x00030008,0x00030001,0x00030001,0x00040009,0x00000001,0x00000002,0x00000003}, -{0x00060011,0x00060011,0x00060011,0x00060011,0x0006000a,0x0006000a,0x0006000a,0x0006000a,0x00060010,0x00060010,0x00060010,0x00060010,0x00060002,0x00060002,0x00060002,0x00060002}, -{0x00070019,0x00070019,0x0007000b,0x0007000b,0x00070012,0x00070012,0x00070018,0x00070018,0x00070003,0x00070003,0x00080013,0x0008001a,0x0008000c,0x00080021,0x0008000d,0x00080029}, -{0x0008001b,0x00080014,0x00080004,0x00080020,0x00000004,0x00000005,0x00000006,0x00000007,0x00000008,0x00000009,0x0000000a,0x0000000b,0x0000000c,0x0000000d,0x0000000e,0x0000000f}, -{0x00090022,0x00090022,0x00090022,0x00090022,0x00090022,0x00090022,0x00090022,0x00090022,0x00090015,0x00090015,0x00090015,0x00090015,0x00090015,0x00090015,0x00090015,0x00090015}, -{0x0009002a,0x0009002a,0x0009002a,0x0009002a,0x0009002a,0x0009002a,0x0009002a,0x0009002a,0x00090005,0x00090005,0x00090005,0x00090005,0x00090005,0x00090005,0x00090005,0x00090005}, -{0x00090031,0x00090031,0x00090031,0x00090031,0x00090031,0x00090031,0x00090031,0x00090031,0x00090028,0x00090028,0x00090028,0x00090028,0x00090028,0x00090028,0x00090028,0x00090028}, -{0x0009000e,0x0009000e,0x0009000e,0x0009000e,0x0009000e,0x0009000e,0x0009000e,0x0009000e,0x00090023,0x00090023,0x00090023,0x00090023,0x00090023,0x00090023,0x00090023,0x00090023}, -{0x0009001d,0x0009001d,0x0009001d,0x0009001d,0x0009001d,0x0009001d,0x0009001d,0x0009001d,0x0009001c,0x0009001c,0x0009001c,0x0009001c,0x0009001c,0x0009001c,0x0009001c,0x0009001c}, -{0x0009002b,0x0009002b,0x0009002b,0x0009002b,0x0009002b,0x0009002b,0x0009002b,0x0009002b,0x00090016,0x00090016,0x00090016,0x00090016,0x00090016,0x00090016,0x00090016,0x00090016}, -{0x00090032,0x00090032,0x00090032,0x00090032,0x00090032,0x00090032,0x00090032,0x00090032,0x0009000f,0x0009000f,0x0009000f,0x0009000f,0x0009000f,0x0009000f,0x0009000f,0x0009000f}, -{0x000a001e,0x000a001e,0x000a001e,0x000a001e,0x000a0006,0x000a0006,0x000a0006,0x000a0006,0x000a0030,0x000a0030,0x000a0030,0x000a0030,0x000a0024,0x000a0024,0x000a0024,0x000a0024}, -{0x000a0039,0x000a0039,0x000a0039,0x000a0039,0x000a0025,0x000a0025,0x000a0025,0x000a0025,0x000a003a,0x000a003a,0x000a003a,0x000a003a,0x000a002c,0x000a002c,0x000a002c,0x000a002c}, -{0x000a0033,0x000a0033,0x000a0033,0x000a0033,0x000a0017,0x000a0017,0x000a0017,0x000a0017,0x000a003b,0x000a003b,0x000a003b,0x000a003b,0x000a0034,0x000a0034,0x000a0034,0x000a0034}, -{0x000a002d,0x000a002d,0x000a002d,0x000a002d,0x000a0026,0x000a0026,0x000a0026,0x000a0026,0x000a001f,0x000a001f,0x000a001f,0x000a001f,0x000b0038,0x000b0038,0x000b0007,0x000b0007}, -{0x000b0035,0x000b0035,0x000b002e,0x000b002e,0x000b003c,0x000b003c,0x000b0027,0x000b0027,0x000b002f,0x000b002f,0x000b003d,0x000b003d,0x000c003e,0x000c0036,0x000c0037,0x000c003f} -}; - -static const unsigned int HuffmanCodeBook_8[15][CBlock::HuffmanEntries]= -{ -{0x00030009,0x00030009,0x00040011,0x00040008,0x0004000a,0x00040001,0x00040012,0x00000001,0x00000002,0x00000003,0x00000004,0x00000005,0x00000006,0x00000007,0x00000008,0x00000009}, -{0x00050000,0x00050000,0x00050000,0x00050000,0x00050000,0x00050000,0x00050000,0x00050000,0x00050010,0x00050010,0x00050010,0x00050010,0x00050010,0x00050010,0x00050010,0x00050010}, -{0x00050002,0x00050002,0x00050002,0x00050002,0x00050002,0x00050002,0x00050002,0x00050002,0x00050019,0x00050019,0x00050019,0x00050019,0x00050019,0x00050019,0x00050019,0x00050019}, -{0x0005000b,0x0005000b,0x0005000b,0x0005000b,0x0005000b,0x0005000b,0x0005000b,0x0005000b,0x0005001a,0x0005001a,0x0005001a,0x0005001a,0x0005001a,0x0005001a,0x0005001a,0x0005001a}, -{0x00050013,0x00050013,0x00050013,0x00050013,0x00050013,0x00050013,0x00050013,0x00050013,0x0006001b,0x0006001b,0x0006001b,0x0006001b,0x00060021,0x00060021,0x00060021,0x00060021}, -{0x0006000c,0x0006000c,0x0006000c,0x0006000c,0x00060022,0x00060022,0x00060022,0x00060022,0x00060014,0x00060014,0x00060014,0x00060014,0x00060018,0x00060018,0x00060018,0x00060018}, -{0x00060003,0x00060003,0x00060003,0x00060003,0x00060023,0x00060023,0x00060023,0x00060023,0x0006001c,0x0006001c,0x0006001c,0x0006001c,0x0006002a,0x0006002a,0x0006002a,0x0006002a}, -{0x00070029,0x00070029,0x00070015,0x00070015,0x0007000d,0x0007000d,0x0007002b,0x0007002b,0x0007001d,0x0007001d,0x00070024,0x00070024,0x0007002c,0x0007002c,0x00070004,0x00070004}, -{0x00070025,0x00070025,0x00070020,0x00070020,0x00070016,0x00070016,0x00070032,0x00070032,0x00070031,0x00070031,0x0007000e,0x0007000e,0x0008001e,0x00080033,0x0008002d,0x00080028}, -{0x00080034,0x00080005,0x00080026,0x00080039,0x0008003a,0x00080017,0x00080035,0x0008003b,0x0008000f,0x0008002e,0x0008001f,0x0000000a,0x0000000b,0x0000000c,0x0000000d,0x0000000e}, -{0x00090036,0x00090036,0x00090036,0x00090036,0x00090036,0x00090036,0x00090036,0x00090036,0x0009003c,0x0009003c,0x0009003c,0x0009003c,0x0009003c,0x0009003c,0x0009003c,0x0009003c}, -{0x00090030,0x00090030,0x00090030,0x00090030,0x00090030,0x00090030,0x00090030,0x00090030,0x00090027,0x00090027,0x00090027,0x00090027,0x00090027,0x00090027,0x00090027,0x00090027}, -{0x00090006,0x00090006,0x00090006,0x00090006,0x00090006,0x00090006,0x00090006,0x00090006,0x0009003d,0x0009003d,0x0009003d,0x0009003d,0x0009003d,0x0009003d,0x0009003d,0x0009003d}, -{0x0009003e,0x0009003e,0x0009003e,0x0009003e,0x0009003e,0x0009003e,0x0009003e,0x0009003e,0x00090037,0x00090037,0x00090037,0x00090037,0x00090037,0x00090037,0x00090037,0x00090037}, -{0x000a002f,0x000a002f,0x000a002f,0x000a002f,0x000a0038,0x000a0038,0x000a0038,0x000a0038,0x000a0007,0x000a0007,0x000a0007,0x000a0007,0x000a003f,0x000a003f,0x000a003f,0x000a003f} -}; - -static const unsigned int HuffmanCodeBook_9[42][CBlock::HuffmanEntries]= -{ -{0x00010000,0x00010000,0x00010000,0x00010000,0x00010000,0x00010000,0x00010000,0x00010000,0x0003000d,0x0003000d,0x00030001,0x00030001,0x0004000e,0x00000001,0x00000002,0x00000005}, -{0x0006001b,0x0006001b,0x0006001b,0x0006001b,0x0006000f,0x0006000f,0x0006000f,0x0006000f,0x0006001a,0x0006001a,0x0006001a,0x0006001a,0x00060002,0x00060002,0x00060002,0x00060002}, -{0x00070028,0x00070028,0x0007001c,0x0007001c,0x00070010,0x00070010,0x00080027,0x00080003,0x0008001d,0x00080029,0x00080011,0x00080035,0x0008001e,0x00080012,0x00000003,0x00000004}, -{0x00090036,0x00090036,0x00090036,0x00090036,0x00090036,0x00090036,0x00090036,0x00090036,0x0009002a,0x0009002a,0x0009002a,0x0009002a,0x0009002a,0x0009002a,0x0009002a,0x0009002a}, -{0x00090004,0x00090004,0x00090004,0x00090004,0x00090004,0x00090004,0x00090004,0x00090004,0x00090034,0x00090034,0x00090034,0x00090034,0x00090034,0x00090034,0x00090034,0x00090034}, -{0x00000006,0x00000007,0x00000008,0x00000009,0x0000000a,0x0000000b,0x0000000c,0x0000000d,0x0000000e,0x0000000f,0x00000010,0x00000011,0x00000012,0x00000013,0x00000014,0x00000019}, -{0x00090042,0x00090042,0x00090042,0x00090042,0x00090042,0x00090042,0x00090042,0x00090042,0x0009001f,0x0009001f,0x0009001f,0x0009001f,0x0009001f,0x0009001f,0x0009001f,0x0009001f}, -{0x00090013,0x00090013,0x00090013,0x00090013,0x00090013,0x00090013,0x00090013,0x00090013,0x0009002b,0x0009002b,0x0009002b,0x0009002b,0x0009002b,0x0009002b,0x0009002b,0x0009002b}, -{0x00090043,0x00090043,0x00090043,0x00090043,0x00090043,0x00090043,0x00090043,0x00090043,0x0009004f,0x0009004f,0x0009004f,0x0009004f,0x0009004f,0x0009004f,0x0009004f,0x0009004f}, -{0x00090037,0x00090037,0x00090037,0x00090037,0x00090037,0x00090037,0x00090037,0x00090037,0x000a0005,0x000a0005,0x000a0005,0x000a0005,0x000a0020,0x000a0020,0x000a0020,0x000a0020}, -{0x000a0041,0x000a0041,0x000a0041,0x000a0041,0x000a0014,0x000a0014,0x000a0014,0x000a0014,0x000a002c,0x000a002c,0x000a002c,0x000a002c,0x000a0015,0x000a0015,0x000a0015,0x000a0015}, -{0x000a0069,0x000a0069,0x000a0069,0x000a0069,0x000a0038,0x000a0038,0x000a0038,0x000a0038,0x000a0044,0x000a0044,0x000a0044,0x000a0044,0x000a0050,0x000a0050,0x000a0050,0x000a0050}, -{0x000a005c,0x000a005c,0x000a005c,0x000a005c,0x000a0006,0x000a0006,0x000a0006,0x000a0006,0x000a006a,0x000a006a,0x000a006a,0x000a006a,0x000a0022,0x000a0022,0x000a0022,0x000a0022}, -{0x000a002d,0x000a002d,0x000a002d,0x000a002d,0x000a0021,0x000a0021,0x000a0021,0x000a0021,0x000a0039,0x000a0039,0x000a0039,0x000a0039,0x000a0076,0x000a0076,0x000a0076,0x000a0076}, -{0x000a0016,0x000a0016,0x000a0016,0x000a0016,0x000a005d,0x000a005d,0x000a005d,0x000a005d,0x000b004e,0x000b004e,0x000b0045,0x000b0045,0x000b0051,0x000b0051,0x000b006b,0x000b006b}, -{0x000b0007,0x000b0007,0x000b0077,0x000b0077,0x000b002f,0x000b002f,0x000b003a,0x000b003a,0x000b002e,0x000b002e,0x000b0008,0x000b0008,0x000b0083,0x000b0083,0x000b0052,0x000b0052}, -{0x000b0023,0x000b0023,0x000b0046,0x000b0046,0x000b0068,0x000b0068,0x000b005b,0x000b005b,0x000b005e,0x000b005e,0x000b0084,0x000b0084,0x000b0078,0x000b0078,0x000b006c,0x000b006c}, -{0x000b0017,0x000b0017,0x000b005f,0x000b005f,0x000b0053,0x000b0053,0x000b0047,0x000b0047,0x000b003c,0x000b003c,0x000b003b,0x000b003b,0x000b0030,0x000b0030,0x000b0090,0x000b0090}, -{0x000b0049,0x000b0049,0x000b0075,0x000b0075,0x000b006d,0x000b006d,0x000c0085,0x000c0024,0x000c0009,0x000c0091,0x000c0079,0x000c0054,0x000c009d,0x000c003d,0x000c006e,0x000c0018}, -{0x000c007a,0x000c0086,0x000c0048,0x000c0060,0x000c0025,0x000c0019,0x000c009e,0x000c0092,0x000c0031,0x000c004a,0x000c0055,0x000c006f,0x000c0093,0x000c000a,0x000c0061,0x000c009f}, -{0x000c0082,0x000c0087,0x000c003e,0x000c0056,0x000c0026,0x000c007b,0x000c007c,0x000c003f,0x000c008f,0x000c0057,0x000c0032,0x000c004b,0x00000015,0x00000016,0x00000017,0x00000018}, -{0x000d0070,0x000d0070,0x000d0070,0x000d0070,0x000d0070,0x000d0070,0x000d0070,0x000d0070,0x000d0063,0x000d0063,0x000d0063,0x000d0063,0x000d0063,0x000d0063,0x000d0063,0x000d0063}, -{0x000d00a1,0x000d00a1,0x000d00a1,0x000d00a1,0x000d00a1,0x000d00a1,0x000d00a1,0x000d00a1,0x000d0033,0x000d0033,0x000d0033,0x000d0033,0x000d0033,0x000d0033,0x000d0033,0x000d0033}, -{0x000d0094,0x000d0094,0x000d0094,0x000d0094,0x000d0094,0x000d0094,0x000d0094,0x000d0094,0x000d0062,0x000d0062,0x000d0062,0x000d0062,0x000d0062,0x000d0062,0x000d0062,0x000d0062}, -{0x000d00a0,0x000d00a0,0x000d00a0,0x000d00a0,0x000d00a0,0x000d00a0,0x000d00a0,0x000d00a0,0x000d0095,0x000d0095,0x000d0095,0x000d0095,0x000d0095,0x000d0095,0x000d0095,0x000d0095}, -{0x0000001a,0x0000001b,0x0000001c,0x0000001d,0x0000001e,0x0000001f,0x00000020,0x00000021,0x00000022,0x00000023,0x00000024,0x00000025,0x00000026,0x00000027,0x00000028,0x00000029}, -{0x000d0088,0x000d0088,0x000d0088,0x000d0088,0x000d0088,0x000d0088,0x000d0088,0x000d0088,0x000d0040,0x000d0040,0x000d0040,0x000d0040,0x000d0040,0x000d0040,0x000d0040,0x000d0040}, -{0x000d0064,0x000d0064,0x000d0064,0x000d0064,0x000d0064,0x000d0064,0x000d0064,0x000d0064,0x000d004c,0x000d004c,0x000d004c,0x000d004c,0x000d004c,0x000d004c,0x000d004c,0x000d004c}, -{0x000d000b,0x000d000b,0x000d000b,0x000d000b,0x000d000b,0x000d000b,0x000d000b,0x000d000b,0x000d00a2,0x000d00a2,0x000d00a2,0x000d00a2,0x000d00a2,0x000d00a2,0x000d00a2,0x000d00a2}, -{0x000d0058,0x000d0058,0x000d0058,0x000d0058,0x000d0058,0x000d0058,0x000d0058,0x000d0058,0x000d009c,0x000d009c,0x000d009c,0x000d009c,0x000d009c,0x000d009c,0x000d009c,0x000d009c}, -{0x000d0089,0x000d0089,0x000d0089,0x000d0089,0x000d0089,0x000d0089,0x000d0089,0x000d0089,0x000d004d,0x000d004d,0x000d004d,0x000d004d,0x000d004d,0x000d004d,0x000d004d,0x000d004d}, -{0x000d0065,0x000d0065,0x000d0065,0x000d0065,0x000d0065,0x000d0065,0x000d0065,0x000d0065,0x000d007d,0x000d007d,0x000d007d,0x000d007d,0x000d007d,0x000d007d,0x000d007d,0x000d007d}, -{0x000d000c,0x000d000c,0x000d000c,0x000d000c,0x000d000c,0x000d000c,0x000d000c,0x000d000c,0x000d0096,0x000d0096,0x000d0096,0x000d0096,0x000d0096,0x000d0096,0x000d0096,0x000d0096}, -{0x000d0071,0x000d0071,0x000d0071,0x000d0071,0x000d0071,0x000d0071,0x000d0071,0x000d0071,0x000d007e,0x000d007e,0x000d007e,0x000d007e,0x000d007e,0x000d007e,0x000d007e,0x000d007e}, -{0x000d008a,0x000d008a,0x000d008a,0x000d008a,0x000d008a,0x000d008a,0x000d008a,0x000d008a,0x000d0066,0x000d0066,0x000d0066,0x000d0066,0x000d0066,0x000d0066,0x000d0066,0x000d0066}, -{0x000d00a3,0x000d00a3,0x000d00a3,0x000d00a3,0x000d00a3,0x000d00a3,0x000d00a3,0x000d00a3,0x000d0059,0x000d0059,0x000d0059,0x000d0059,0x000d0059,0x000d0059,0x000d0059,0x000d0059}, -{0x000d0073,0x000d0073,0x000d0073,0x000d0073,0x000d0073,0x000d0073,0x000d0073,0x000d0073,0x000d0097,0x000d0097,0x000d0097,0x000d0097,0x000d0097,0x000d0097,0x000d0097,0x000d0097}, -{0x000d0067,0x000d0067,0x000d0067,0x000d0067,0x000d0067,0x000d0067,0x000d0067,0x000d0067,0x000d005a,0x000d005a,0x000d005a,0x000d005a,0x000d005a,0x000d005a,0x000d005a,0x000d005a}, -{0x000e0072,0x000e0072,0x000e0072,0x000e0072,0x000e008b,0x000e008b,0x000e008b,0x000e008b,0x000e0074,0x000e0074,0x000e0074,0x000e0074,0x000e007f,0x000e007f,0x000e007f,0x000e007f}, -{0x000e0080,0x000e0080,0x000e0080,0x000e0080,0x000e0081,0x000e0081,0x000e0081,0x000e0081,0x000e008d,0x000e008d,0x000e008d,0x000e008d,0x000e00a5,0x000e00a5,0x000e00a5,0x000e00a5}, -{0x000e008c,0x000e008c,0x000e008c,0x000e008c,0x000e0098,0x000e0098,0x000e0098,0x000e0098,0x000e00a4,0x000e00a4,0x000e00a4,0x000e00a4,0x000e0099,0x000e0099,0x000e0099,0x000e0099}, -{0x000e00a6,0x000e00a6,0x000e00a6,0x000e00a6,0x000e00a7,0x000e00a7,0x000e00a7,0x000e00a7,0x000f008e,0x000f008e,0x000f009a,0x000f009a,0x000f009b,0x000f009b,0x000f00a8,0x000f00a8} -}; - -static const unsigned int HuffmanCodeBook_10[43][CBlock::HuffmanEntries]= -{ -{0x0004000e,0x0004000f,0x0004001b,0x00000001,0x00000002,0x00000003,0x00000004,0x00000005,0x00000006,0x00000007,0x00000008,0x00000009,0x0000000a,0x0000000b,0x0000000c,0x0000001a}, -{0x0005001c,0x0005001c,0x0005001c,0x0005001c,0x0005001c,0x0005001c,0x0005001c,0x0005001c,0x0005000d,0x0005000d,0x0005000d,0x0005000d,0x0005000d,0x0005000d,0x0005000d,0x0005000d}, -{0x00050001,0x00050001,0x00050001,0x00050001,0x00050001,0x00050001,0x00050001,0x00050001,0x00050010,0x00050010,0x00050010,0x00050010,0x00050010,0x00050010,0x00050010,0x00050010}, -{0x00050029,0x00050029,0x00050029,0x00050029,0x00050029,0x00050029,0x00050029,0x00050029,0x00050028,0x00050028,0x00050028,0x00050028,0x00050028,0x00050028,0x00050028,0x00050028}, -{0x0005001d,0x0005001d,0x0005001d,0x0005001d,0x0005001d,0x0005001d,0x0005001d,0x0005001d,0x0005002a,0x0005002a,0x0005002a,0x0005002a,0x0005002a,0x0005002a,0x0005002a,0x0005002a}, -{0x0006001a,0x0006001a,0x0006001a,0x0006001a,0x00060002,0x00060002,0x00060002,0x00060002,0x0006001e,0x0006001e,0x0006001e,0x0006001e,0x00060036,0x00060036,0x00060036,0x00060036}, -{0x00060011,0x00060011,0x00060011,0x00060011,0x00060035,0x00060035,0x00060035,0x00060035,0x00060000,0x00060000,0x00060000,0x00060000,0x00060037,0x00060037,0x00060037,0x00060037}, -{0x0006002b,0x0006002b,0x0006002b,0x0006002b,0x00060027,0x00060027,0x00060027,0x00060027,0x00060003,0x00060003,0x00060003,0x00060003,0x00060038,0x00060038,0x00060038,0x00060038}, -{0x0006001f,0x0006001f,0x0006001f,0x0006001f,0x00060043,0x00060043,0x00060043,0x00060043,0x00070012,0x00070012,0x00070042,0x00070042,0x00070044,0x00070044,0x0007002c,0x0007002c}, -{0x00070045,0x00070045,0x00070039,0x00070039,0x00070050,0x00070050,0x00070020,0x00070020,0x00070051,0x00070051,0x00070034,0x00070034,0x0007004f,0x0007004f,0x00070004,0x00070004}, -{0x00070013,0x00070013,0x0007002d,0x0007002d,0x00070046,0x00070046,0x00070052,0x00070052,0x0007003a,0x0007003a,0x00080053,0x0008005d,0x0008002e,0x00080021,0x00080047,0x0008006a}, -{0x0008005e,0x00080041,0x0008005c,0x00080005,0x00080069,0x00080014,0x0008006b,0x0008005f,0x0008003b,0x00080022,0x00080054,0x00080060,0x00080015,0x0008002f,0x0008006c,0x0008003c}, -{0x00080048,0x0008006d,0x00080049,0x0000000d,0x0000000e,0x0000000f,0x00000010,0x00000011,0x00000012,0x00000013,0x00000014,0x00000015,0x00000016,0x00000017,0x00000018,0x00000019}, -{0x00090061,0x00090061,0x00090061,0x00090061,0x00090061,0x00090061,0x00090061,0x00090061,0x00090055,0x00090055,0x00090055,0x00090055,0x00090055,0x00090055,0x00090055,0x00090055}, -{0x00090077,0x00090077,0x00090077,0x00090077,0x00090077,0x00090077,0x00090077,0x00090077,0x0009004e,0x0009004e,0x0009004e,0x0009004e,0x0009004e,0x0009004e,0x0009004e,0x0009004e}, -{0x00090056,0x00090056,0x00090056,0x00090056,0x00090056,0x00090056,0x00090056,0x00090056,0x00090078,0x00090078,0x00090078,0x00090078,0x00090078,0x00090078,0x00090078,0x00090078}, -{0x00090030,0x00090030,0x00090030,0x00090030,0x00090030,0x00090030,0x00090030,0x00090030,0x00090076,0x00090076,0x00090076,0x00090076,0x00090076,0x00090076,0x00090076,0x00090076}, -{0x00090023,0x00090023,0x00090023,0x00090023,0x00090023,0x00090023,0x00090023,0x00090023,0x00090006,0x00090006,0x00090006,0x00090006,0x00090006,0x00090006,0x00090006,0x00090006}, -{0x0009006e,0x0009006e,0x0009006e,0x0009006e,0x0009006e,0x0009006e,0x0009006e,0x0009006e,0x00090079,0x00090079,0x00090079,0x00090079,0x00090079,0x00090079,0x00090079,0x00090079}, -{0x0009003d,0x0009003d,0x0009003d,0x0009003d,0x0009003d,0x0009003d,0x0009003d,0x0009003d,0x00090084,0x00090084,0x00090084,0x00090084,0x00090084,0x00090084,0x00090084,0x00090084}, -{0x00090016,0x00090016,0x00090016,0x00090016,0x00090016,0x00090016,0x00090016,0x00090016,0x00090062,0x00090062,0x00090062,0x00090062,0x00090062,0x00090062,0x00090062,0x00090062}, -{0x0009006f,0x0009006f,0x0009006f,0x0009006f,0x0009006f,0x0009006f,0x0009006f,0x0009006f,0x0009007a,0x0009007a,0x0009007a,0x0009007a,0x0009007a,0x0009007a,0x0009007a,0x0009007a}, -{0x00090063,0x00090063,0x00090063,0x00090063,0x00090063,0x00090063,0x00090063,0x00090063,0x00090085,0x00090085,0x00090085,0x00090085,0x00090085,0x00090085,0x00090085,0x00090085}, -{0x0009004a,0x0009004a,0x0009004a,0x0009004a,0x0009004a,0x0009004a,0x0009004a,0x0009004a,0x00090086,0x00090086,0x00090086,0x00090086,0x00090086,0x00090086,0x00090086,0x00090086}, -{0x00090024,0x00090024,0x00090024,0x00090024,0x00090024,0x00090024,0x00090024,0x00090024,0x00090083,0x00090083,0x00090083,0x00090083,0x00090083,0x00090083,0x00090083,0x00090083}, -{0x00090031,0x00090031,0x00090031,0x00090031,0x00090031,0x00090031,0x00090031,0x00090031,0x0009007b,0x0009007b,0x0009007b,0x0009007b,0x0009007b,0x0009007b,0x0009007b,0x0009007b}, -{0x0000001b,0x0000001c,0x0000001d,0x0000001e,0x0000001f,0x00000020,0x00000021,0x00000022,0x00000023,0x00000024,0x00000025,0x00000026,0x00000027,0x00000028,0x00000029,0x0000002a}, -{0x00090057,0x00090057,0x00090057,0x00090057,0x00090057,0x00090057,0x00090057,0x00090057,0x00090068,0x00090068,0x00090068,0x00090068,0x00090068,0x00090068,0x00090068,0x00090068}, -{0x0009003e,0x0009003e,0x0009003e,0x0009003e,0x0009003e,0x0009003e,0x0009003e,0x0009003e,0x0009005b,0x0009005b,0x0009005b,0x0009005b,0x0009005b,0x0009005b,0x0009005b,0x0009005b}, -{0x00090091,0x00090091,0x00090091,0x00090091,0x00090091,0x00090091,0x00090091,0x00090091,0x000a0064,0x000a0064,0x000a0064,0x000a0064,0x000a0092,0x000a0092,0x000a0092,0x000a0092}, -{0x000a0088,0x000a0088,0x000a0088,0x000a0088,0x000a0017,0x000a0017,0x000a0017,0x000a0017,0x000a0090,0x000a0090,0x000a0090,0x000a0090,0x000a007c,0x000a007c,0x000a007c,0x000a007c}, -{0x000a0007,0x000a0007,0x000a0007,0x000a0007,0x000a0070,0x000a0070,0x000a0070,0x000a0070,0x000a0087,0x000a0087,0x000a0087,0x000a0087,0x000a0032,0x000a0032,0x000a0032,0x000a0032}, -{0x000a004b,0x000a004b,0x000a004b,0x000a004b,0x000a0071,0x000a0071,0x000a0071,0x000a0071,0x000a0094,0x000a0094,0x000a0094,0x000a0094,0x000a0008,0x000a0008,0x000a0008,0x000a0008}, -{0x000a0093,0x000a0093,0x000a0093,0x000a0093,0x000a0025,0x000a0025,0x000a0025,0x000a0025,0x000a0065,0x000a0065,0x000a0065,0x000a0065,0x000a0058,0x000a0058,0x000a0058,0x000a0058}, -{0x000a0089,0x000a0089,0x000a0089,0x000a0089,0x000a003f,0x000a003f,0x000a003f,0x000a003f,0x000a0018,0x000a0018,0x000a0018,0x000a0018,0x000a009e,0x000a009e,0x000a009e,0x000a009e}, -{0x000a007d,0x000a007d,0x000a007d,0x000a007d,0x000a009f,0x000a009f,0x000a009f,0x000a009f,0x000a0095,0x000a0095,0x000a0095,0x000a0095,0x000a004c,0x000a004c,0x000a004c,0x000a004c}, -{0x000a00a0,0x000a00a0,0x000a00a0,0x000a00a0,0x000a0096,0x000a0096,0x000a0096,0x000a0096,0x000a00a1,0x000a00a1,0x000a00a1,0x000a00a1,0x000a0033,0x000a0033,0x000a0033,0x000a0033}, -{0x000a0059,0x000a0059,0x000a0059,0x000a0059,0x000a0075,0x000a0075,0x000a0075,0x000a0075,0x000a008a,0x000a008a,0x000a008a,0x000a008a,0x000a0082,0x000a0082,0x000a0082,0x000a0082}, -{0x000a009d,0x000a009d,0x000a009d,0x000a009d,0x000a0009,0x000a0009,0x000a0009,0x000a0009,0x000a0040,0x000a0040,0x000a0040,0x000a0040,0x000a007e,0x000a007e,0x000a007e,0x000a007e}, -{0x000a00a2,0x000a00a2,0x000a00a2,0x000a00a2,0x000a0026,0x000a0026,0x000a0026,0x000a0026,0x000a0072,0x000a0072,0x000a0072,0x000a0072,0x000b007f,0x000b007f,0x000b0019,0x000b0019}, -{0x000b0097,0x000b0097,0x000b00a3,0x000b00a3,0x000b0066,0x000b0066,0x000b004d,0x000b004d,0x000b005a,0x000b005a,0x000b008b,0x000b008b,0x000b0073,0x000b0073,0x000b00a4,0x000b00a4}, -{0x000b000a,0x000b000a,0x000b0067,0x000b0067,0x000b008f,0x000b008f,0x000b008c,0x000b008c,0x000b0098,0x000b0098,0x000b0099,0x000b0099,0x000b000b,0x000b000b,0x000b009a,0x000b009a}, -{0x000b0080,0x000b0080,0x000b008d,0x000b008d,0x000b009c,0x000b009c,0x000b0074,0x000b0074,0x000c00a5,0x000c008e,0x000c0081,0x000c009b,0x000c00a7,0x000c000c,0x000c00a6,0x000c00a8} -}; - -static const unsigned int HuffmanCodeBook_11[72][CBlock::HuffmanEntries]= -{ -{0x00040000,0x00040012,0x00000001,0x00000002,0x00000003,0x00000004,0x00000005,0x00000006,0x00000007,0x00000008,0x00000009,0x0000000a,0x0000000b,0x00000015,0x00000026,0x00000037}, -{0x00050120,0x00050120,0x00050120,0x00050120,0x00050120,0x00050120,0x00050120,0x00050120,0x00050011,0x00050011,0x00050011,0x00050011,0x00050011,0x00050011,0x00050011,0x00050011}, -{0x00050001,0x00050001,0x00050001,0x00050001,0x00050001,0x00050001,0x00050001,0x00050001,0x00050023,0x00050023,0x00050023,0x00050023,0x00050023,0x00050023,0x00050023,0x00050023}, -{0x00050013,0x00050013,0x00050013,0x00050013,0x00050013,0x00050013,0x00050013,0x00050013,0x00050024,0x00050024,0x00050024,0x00050024,0x00050024,0x00050024,0x00050024,0x00050024}, -{0x00060014,0x00060014,0x00060014,0x00060014,0x00060034,0x00060034,0x00060034,0x00060034,0x00060035,0x00060035,0x00060035,0x00060035,0x00060022,0x00060022,0x00060022,0x00060022}, -{0x00060025,0x00060025,0x00060025,0x00060025,0x00060002,0x00060002,0x00060002,0x00060002,0x00060036,0x00060036,0x00060036,0x00060036,0x00070045,0x00070045,0x00070015,0x00070015}, -{0x00070046,0x00070046,0x00070026,0x00070026,0x00070047,0x00070047,0x00070037,0x00070037,0x00070033,0x00070033,0x00070003,0x00070003,0x00070056,0x00070056,0x00070057,0x00070057}, -{0x00070027,0x00070027,0x00070048,0x00070048,0x00070016,0x00070016,0x00070058,0x00070058,0x00070038,0x00070038,0x00070059,0x00070059,0x00080049,0x00080068,0x00080028,0x00080067}, -{0x00080069,0x00080039,0x00080017,0x00080054,0x00080043,0x00080115,0x00080113,0x00080114,0x0008006a,0x00080116,0x00080044,0x0008004a,0x00080004,0x00080032,0x0008005a,0x00080065}, -{0x00080117,0x00080112,0x00080118,0x00080029,0x00080079,0x0008003a,0x0008006b,0x0008005b,0x00080076,0x0008011a,0x0008007a,0x00080078,0x00080119,0x00080087,0x00080021,0x00080018}, -{0x0008004b,0x0008011b,0x0008007b,0x0008011c,0x00080098,0x00080111,0x0008006c,0x000800a9,0x0008002a,0x0008005c,0x000800ba,0x0008011d,0x0008008b,0x0008008a,0x0008003b,0x00080055}, -{0x0008011e,0x000800cb,0x0008007c,0x0008004c,0x0008006d,0x0008007d,0x00080005,0x0000000c,0x0000000d,0x0000000e,0x0000000f,0x00000010,0x00000011,0x00000012,0x00000013,0x00000014}, -{0x0009008c,0x0009008c,0x0009008c,0x0009008c,0x0009008c,0x0009008c,0x0009008c,0x0009008c,0x0009011f,0x0009011f,0x0009011f,0x0009011f,0x0009011f,0x0009011f,0x0009011f,0x0009011f}, -{0x000900dc,0x000900dc,0x000900dc,0x000900dc,0x000900dc,0x000900dc,0x000900dc,0x000900dc,0x00090019,0x00090019,0x00090019,0x00090019,0x00090019,0x00090019,0x00090019,0x00090019}, -{0x00090089,0x00090089,0x00090089,0x00090089,0x00090089,0x00090089,0x00090089,0x00090089,0x000900fe,0x000900fe,0x000900fe,0x000900fe,0x000900fe,0x000900fe,0x000900fe,0x000900fe}, -{0x0009005d,0x0009005d,0x0009005d,0x0009005d,0x0009005d,0x0009005d,0x0009005d,0x0009005d,0x000900ed,0x000900ed,0x000900ed,0x000900ed,0x000900ed,0x000900ed,0x000900ed,0x000900ed}, -{0x0009003c,0x0009003c,0x0009003c,0x0009003c,0x0009003c,0x0009003c,0x0009003c,0x0009003c,0x0009008d,0x0009008d,0x0009008d,0x0009008d,0x0009008d,0x0009008d,0x0009008d,0x0009008d}, -{0x0009007e,0x0009007e,0x0009007e,0x0009007e,0x0009007e,0x0009007e,0x0009007e,0x0009007e,0x0009002b,0x0009002b,0x0009002b,0x0009002b,0x0009002b,0x0009002b,0x0009002b,0x0009002b}, -{0x0009008e,0x0009008e,0x0009008e,0x0009008e,0x0009008e,0x0009008e,0x0009008e,0x0009008e,0x0009009b,0x0009009b,0x0009009b,0x0009009b,0x0009009b,0x0009009b,0x0009009b,0x0009009b}, -{0x0009009c,0x0009009c,0x0009009c,0x0009009c,0x0009009c,0x0009009c,0x0009009c,0x0009009c,0x0009010f,0x0009010f,0x0009010f,0x0009010f,0x0009010f,0x0009010f,0x0009010f,0x0009010f}, -{0x0009004d,0x0009004d,0x0009004d,0x0009004d,0x0009004d,0x0009004d,0x0009004d,0x0009004d,0x0009006e,0x0009006e,0x0009006e,0x0009006e,0x0009006e,0x0009006e,0x0009006e,0x0009006e}, -{0x00000016,0x00000017,0x00000018,0x00000019,0x0000001a,0x0000001b,0x0000001c,0x0000001d,0x0000001e,0x0000001f,0x00000020,0x00000021,0x00000022,0x00000023,0x00000024,0x00000025}, -{0x00090066,0x00090066,0x00090066,0x00090066,0x00090066,0x00090066,0x00090066,0x00090066,0x0009009d,0x0009009d,0x0009009d,0x0009009d,0x0009009d,0x0009009d,0x0009009d,0x0009009d}, -{0x0009005e,0x0009005e,0x0009005e,0x0009005e,0x0009005e,0x0009005e,0x0009005e,0x0009005e,0x0009008f,0x0009008f,0x0009008f,0x0009008f,0x0009008f,0x0009008f,0x0009008f,0x0009008f}, -{0x0009007f,0x0009007f,0x0009007f,0x0009007f,0x0009007f,0x0009007f,0x0009007f,0x0009007f,0x0009001a,0x0009001a,0x0009001a,0x0009001a,0x0009001a,0x0009001a,0x0009001a,0x0009001a}, -{0x000900ad,0x000900ad,0x000900ad,0x000900ad,0x000900ad,0x000900ad,0x000900ad,0x000900ad,0x00090006,0x00090006,0x00090006,0x00090006,0x00090006,0x00090006,0x00090006,0x00090006}, -{0x000900ac,0x000900ac,0x000900ac,0x000900ac,0x000900ac,0x000900ac,0x000900ac,0x000900ac,0x0009009a,0x0009009a,0x0009009a,0x0009009a,0x0009009a,0x0009009a,0x0009009a,0x0009009a}, -{0x0009009e,0x0009009e,0x0009009e,0x0009009e,0x0009009e,0x0009009e,0x0009009e,0x0009009e,0x0009004e,0x0009004e,0x0009004e,0x0009004e,0x0009004e,0x0009004e,0x0009004e,0x0009004e}, -{0x0009002c,0x0009002c,0x0009002c,0x0009002c,0x0009002c,0x0009002c,0x0009002c,0x0009002c,0x0009009f,0x0009009f,0x0009009f,0x0009009f,0x0009009f,0x0009009f,0x0009009f,0x0009009f}, -{0x0009003d,0x0009003d,0x0009003d,0x0009003d,0x0009003d,0x0009003d,0x0009003d,0x0009003d,0x0009006f,0x0009006f,0x0009006f,0x0009006f,0x0009006f,0x0009006f,0x0009006f,0x0009006f}, -{0x000900ae,0x000900ae,0x000900ae,0x000900ae,0x000900ae,0x000900ae,0x000900ae,0x000900ae,0x00090090,0x00090090,0x00090090,0x00090090,0x00090090,0x00090090,0x00090090,0x00090090}, -{0x000900af,0x000900af,0x000900af,0x000900af,0x000900af,0x000900af,0x000900af,0x000900af,0x000900a0,0x000900a0,0x000900a0,0x000900a0,0x000900a0,0x000900a0,0x000900a0,0x000900a0}, -{0x000900be,0x000900be,0x000900be,0x000900be,0x000900be,0x000900be,0x000900be,0x000900be,0x0009001b,0x0009001b,0x0009001b,0x0009001b,0x0009001b,0x0009001b,0x0009001b,0x0009001b}, -{0x00090077,0x00090077,0x00090077,0x00090077,0x00090077,0x00090077,0x00090077,0x00090077,0x000900b0,0x000900b0,0x000900b0,0x000900b0,0x000900b0,0x000900b0,0x000900b0,0x000900b0}, -{0x00090080,0x00090080,0x00090080,0x00090080,0x00090080,0x00090080,0x00090080,0x00090080,0x0009003e,0x0009003e,0x0009003e,0x0009003e,0x0009003e,0x0009003e,0x0009003e,0x0009003e}, -{0x0009005f,0x0009005f,0x0009005f,0x0009005f,0x0009005f,0x0009005f,0x0009005f,0x0009005f,0x000900ab,0x000900ab,0x000900ab,0x000900ab,0x000900ab,0x000900ab,0x000900ab,0x000900ab}, -{0x0009004f,0x0009004f,0x0009004f,0x0009004f,0x0009004f,0x0009004f,0x0009004f,0x0009004f,0x000900bd,0x000900bd,0x000900bd,0x000900bd,0x000900bd,0x000900bd,0x000900bd,0x000900bd}, -{0x000900df,0x000900df,0x000900df,0x000900df,0x000900df,0x000900df,0x000900df,0x000900df,0x00090070,0x00090070,0x00090070,0x00090070,0x00090070,0x00090070,0x00090070,0x00090070}, -{0x00000027,0x00000028,0x00000029,0x0000002a,0x0000002b,0x0000002c,0x0000002d,0x0000002e,0x0000002f,0x00000030,0x00000031,0x00000032,0x00000033,0x00000034,0x00000035,0x00000036}, -{0x000900e0,0x000900e0,0x000900e0,0x000900e0,0x000900e0,0x000900e0,0x000900e0,0x000900e0,0x0009002d,0x0009002d,0x0009002d,0x0009002d,0x0009002d,0x0009002d,0x0009002d,0x0009002d}, -{0x00090110,0x00090110,0x00090110,0x00090110,0x00090110,0x00090110,0x00090110,0x00090110,0x00090060,0x00090060,0x00090060,0x00090060,0x00090060,0x00090060,0x00090060,0x00090060}, -{0x000900c0,0x000900c0,0x000900c0,0x000900c0,0x000900c0,0x000900c0,0x000900c0,0x000900c0,0x000a00bf,0x000a00bf,0x000a00bf,0x000a00bf,0x000a00a1,0x000a00a1,0x000a00a1,0x000a00a1}, -{0x000a0081,0x000a0081,0x000a0081,0x000a0081,0x000a0091,0x000a0091,0x000a0091,0x000a0091,0x000a0010,0x000a0010,0x000a0010,0x000a0010,0x000a0051,0x000a0051,0x000a0051,0x000a0051}, -{0x000a0007,0x000a0007,0x000a0007,0x000a0007,0x000a0040,0x000a0040,0x000a0040,0x000a0040,0x000a00c1,0x000a00c1,0x000a00c1,0x000a00c1,0x000a00de,0x000a00de,0x000a00de,0x000a00de}, -{0x000a00e1,0x000a00e1,0x000a00e1,0x000a00e1,0x000a00cf,0x000a00cf,0x000a00cf,0x000a00cf,0x000a002f,0x000a002f,0x000a002f,0x000a002f,0x000a00e2,0x000a00e2,0x000a00e2,0x000a00e2}, -{0x000a0092,0x000a0092,0x000a0092,0x000a0092,0x000a0071,0x000a0071,0x000a0071,0x000a0071,0x000a00b2,0x000a00b2,0x000a00b2,0x000a00b2,0x000a00b1,0x000a00b1,0x000a00b1,0x000a00b1}, -{0x000a00f0,0x000a00f0,0x000a00f0,0x000a00f0,0x000a00d0,0x000a00d0,0x000a00d0,0x000a00d0,0x000a001c,0x000a001c,0x000a001c,0x000a001c,0x000a0050,0x000a0050,0x000a0050,0x000a0050}, -{0x000a00bc,0x000a00bc,0x000a00bc,0x000a00bc,0x000a003f,0x000a003f,0x000a003f,0x000a003f,0x000a001e,0x000a001e,0x000a001e,0x000a001e,0x000a00ce,0x000a00ce,0x000a00ce,0x000a00ce}, -{0x000a0082,0x000a0082,0x000a0082,0x000a0082,0x000a0041,0x000a0041,0x000a0041,0x000a0041,0x000a0061,0x000a0061,0x000a0061,0x000a0061,0x000a0062,0x000a0062,0x000a0062,0x000a0062}, -{0x000a00f2,0x000a00f2,0x000a00f2,0x000a00f2,0x000a0052,0x000a0052,0x000a0052,0x000a0052,0x000a00c2,0x000a00c2,0x000a00c2,0x000a00c2,0x000a00f1,0x000a00f1,0x000a00f1,0x000a00f1}, -{0x000a00d1,0x000a00d1,0x000a00d1,0x000a00d1,0x000a00e3,0x000a00e3,0x000a00e3,0x000a00e3,0x000a00d2,0x000a00d2,0x000a00d2,0x000a00d2,0x000a0088,0x000a0088,0x000a0088,0x000a0088}, -{0x000a00c3,0x000a00c3,0x000a00c3,0x000a00c3,0x000a002e,0x000a002e,0x000a002e,0x000a002e,0x000a00a2,0x000a00a2,0x000a00a2,0x000a00a2,0x000a00f3,0x000a00f3,0x000a00f3,0x000a00f3}, -{0x000a0073,0x000a0073,0x000a0073,0x000a0073,0x000a00b4,0x000a00b4,0x000a00b4,0x000a00b4,0x000a0101,0x000a0101,0x000a0101,0x000a0101,0x000a0093,0x000a0093,0x000a0093,0x000a0093}, -{0x000a00a3,0x000a00a3,0x000a00a3,0x000a00a3,0x000a00f4,0x000a00f4,0x000a00f4,0x000a00f4,0x000a00b3,0x000a00b3,0x000a00b3,0x000a00b3,0x000a0063,0x000a0063,0x000a0063,0x000a0063}, -{0x000a00c4,0x000a00c4,0x000a00c4,0x000a00c4,0x000a00ef,0x000a00ef,0x000a00ef,0x000a00ef,0x000a0030,0x000a0030,0x000a0030,0x000a0030,0x000a0072,0x000a0072,0x000a0072,0x000a0072}, -{0x00000038,0x00000039,0x0000003a,0x0000003b,0x0000003c,0x0000003d,0x0000003e,0x0000003f,0x00000040,0x00000041,0x00000042,0x00000043,0x00000044,0x00000045,0x00000046,0x00000047}, -{0x000a001d,0x000a001d,0x000a001d,0x000a001d,0x000a00e5,0x000a00e5,0x000a00e5,0x000a00e5,0x000a0008,0x000a0008,0x000a0008,0x000a0008,0x000a00e4,0x000a00e4,0x000a00e4,0x000a00e4}, -{0x000a0083,0x000a0083,0x000a0083,0x000a0083,0x000a00d3,0x000a00d3,0x000a00d3,0x000a00d3,0x000a0084,0x000a0084,0x000a0084,0x000a0084,0x000a0102,0x000a0102,0x000a0102,0x000a0102}, -{0x000a00cd,0x000a00cd,0x000a00cd,0x000a00cd,0x000a0074,0x000a0074,0x000a0074,0x000a0074,0x000a0031,0x000a0031,0x000a0031,0x000a0031,0x000a0104,0x000a0104,0x000a0104,0x000a0104}, -{0x000a0103,0x000a0103,0x000a0103,0x000a0103,0x000a001f,0x000a001f,0x000a001f,0x000a001f,0x000a00a4,0x000a00a4,0x000a00a4,0x000a00a4,0x000a0053,0x000a0053,0x000a0053,0x000a0053}, -{0x000a00f5,0x000a00f5,0x000a00f5,0x000a00f5,0x000a0095,0x000a0095,0x000a0095,0x000a0095,0x000a00e6,0x000a00e6,0x000a00e6,0x000a00e6,0x000a0094,0x000a0094,0x000a0094,0x000a0094}, -{0x000a0064,0x000a0064,0x000a0064,0x000a0064,0x000a0042,0x000a0042,0x000a0042,0x000a0042,0x000a00b5,0x000a00b5,0x000a00b5,0x000a00b5,0x000a00c5,0x000a00c5,0x000a00c5,0x000a00c5}, -{0x000a00d4,0x000a00d4,0x000a00d4,0x000a00d4,0x000a0105,0x000a0105,0x000a0105,0x000a0105,0x000a0106,0x000a0106,0x000a0106,0x000a0106,0x000a0096,0x000a0096,0x000a0096,0x000a0096}, -{0x000a0100,0x000a0100,0x000a0100,0x000a0100,0x000a0085,0x000a0085,0x000a0085,0x000a0085,0x000a0099,0x000a0099,0x000a0099,0x000a0099,0x000a0009,0x000a0009,0x000a0009,0x000a0009}, -{0x000a00a6,0x000a00a6,0x000a00a6,0x000a00a6,0x000a00a5,0x000a00a5,0x000a00a5,0x000a00a5,0x000a00d5,0x000a00d5,0x000a00d5,0x000a00d5,0x000a00f6,0x000a00f6,0x000a00f6,0x000a00f6}, -{0x000a00b7,0x000a00b7,0x000a00b7,0x000a00b7,0x000a00f7,0x000a00f7,0x000a00f7,0x000a00f7,0x000a00d6,0x000a00d6,0x000a00d6,0x000a00d6,0x000a0075,0x000a0075,0x000a0075,0x000a0075}, -{0x000a0086,0x000a0086,0x000a0086,0x000a0086,0x000b00a7,0x000b00a7,0x000b0107,0x000b0107,0x000b00c6,0x000b00c6,0x000b00c9,0x000b00c9,0x000b0020,0x000b0020,0x000b00b6,0x000b00b6}, -{0x000b00b8,0x000b00b8,0x000b00e8,0x000b00e8,0x000b00e7,0x000b00e7,0x000b00c8,0x000b00c8,0x000b00c7,0x000b00c7,0x000b0097,0x000b0097,0x000b00f9,0x000b00f9,0x000b00e9,0x000b00e9}, -{0x000b00d9,0x000b00d9,0x000b0108,0x000b0108,0x000b00f8,0x000b00f8,0x000b00aa,0x000b00aa,0x000b00d7,0x000b00d7,0x000b00a8,0x000b00a8,0x000b000a,0x000b000a,0x000b00d8,0x000b00d8}, -{0x000b00bb,0x000b00bb,0x000b00da,0x000b00da,0x000b00b9,0x000b00b9,0x000b00ea,0x000b00ea,0x000b000d,0x000b000d,0x000b00fa,0x000b00fa,0x000b0109,0x000b0109,0x000b010a,0x000b010a}, -{0x000b00ca,0x000b00ca,0x000b00fb,0x000b00fb,0x000b00dd,0x000b00dd,0x000b000b,0x000b000b,0x000b00eb,0x000b00eb,0x000b010b,0x000b010b,0x000b010c,0x000b010c,0x000b00db,0x000b00db}, -{0x000b00ee,0x000b00ee,0x000b00fc,0x000b00fc,0x000b00ec,0x000b00ec,0x000b00cc,0x000b00cc,0x000b00fd,0x000b00fd,0x000c000e,0x000c000c,0x000c010d,0x000c00ff,0x000c000f,0x000c010e} -}; - -static const unsigned int HuffmanCodeBook_SCL[24][CBlock::HuffmanEntries]= -{ -{0x0001003c,0x0001003c,0x0001003c,0x0001003c,0x0001003c,0x0001003c,0x0001003c,0x0001003c,0x0003003b,0x0003003b,0x0004003d,0x0004003a,0x0004003e,0x00000001,0x00000002,0x00000003}, -{0x00050039,0x00050039,0x00050039,0x00050039,0x00050039,0x00050039,0x00050039,0x00050039,0x0005003f,0x0005003f,0x0005003f,0x0005003f,0x0005003f,0x0005003f,0x0005003f,0x0005003f}, -{0x00060038,0x00060038,0x00060038,0x00060038,0x00060040,0x00060040,0x00060040,0x00060040,0x00060037,0x00060037,0x00060037,0x00060037,0x00060041,0x00060041,0x00060041,0x00060041}, -{0x00070042,0x00070042,0x00070036,0x00070036,0x00070043,0x00070043,0x00080035,0x00080044,0x00080034,0x00080045,0x00080033,0x00000004,0x00000005,0x00000006,0x00000007,0x00000008}, -{0x00090046,0x00090046,0x00090046,0x00090046,0x00090046,0x00090046,0x00090046,0x00090046,0x00090032,0x00090032,0x00090032,0x00090032,0x00090032,0x00090032,0x00090032,0x00090032}, -{0x00090031,0x00090031,0x00090031,0x00090031,0x00090031,0x00090031,0x00090031,0x00090031,0x00090047,0x00090047,0x00090047,0x00090047,0x00090047,0x00090047,0x00090047,0x00090047}, -{0x000a0048,0x000a0048,0x000a0048,0x000a0048,0x000a0030,0x000a0030,0x000a0030,0x000a0030,0x000a0049,0x000a0049,0x000a0049,0x000a0049,0x000a002f,0x000a002f,0x000a002f,0x000a002f}, -{0x000a004a,0x000a004a,0x000a004a,0x000a004a,0x000a002e,0x000a002e,0x000a002e,0x000a002e,0x000b004c,0x000b004c,0x000b004b,0x000b004b,0x000b004d,0x000b004d,0x000b004e,0x000b004e}, -{0x000b002d,0x000b002d,0x000b002b,0x000b002b,0x000c002c,0x000c004f,0x000c002a,0x000c0029,0x000c0050,0x000c0028,0x00000009,0x0000000a,0x0000000b,0x0000000c,0x0000000d,0x0000000e}, -{0x000d0051,0x000d0051,0x000d0051,0x000d0051,0x000d0051,0x000d0051,0x000d0051,0x000d0051,0x000d0027,0x000d0027,0x000d0027,0x000d0027,0x000d0027,0x000d0027,0x000d0027,0x000d0027}, -{0x000d0052,0x000d0052,0x000d0052,0x000d0052,0x000d0052,0x000d0052,0x000d0052,0x000d0052,0x000d0026,0x000d0026,0x000d0026,0x000d0026,0x000d0026,0x000d0026,0x000d0026,0x000d0026}, -{0x000d0053,0x000d0053,0x000d0053,0x000d0053,0x000d0053,0x000d0053,0x000d0053,0x000d0053,0x000e0025,0x000e0025,0x000e0025,0x000e0025,0x000e0023,0x000e0023,0x000e0023,0x000e0023}, -{0x000e0055,0x000e0055,0x000e0055,0x000e0055,0x000e0021,0x000e0021,0x000e0021,0x000e0021,0x000e0024,0x000e0024,0x000e0024,0x000e0024,0x000e0022,0x000e0022,0x000e0022,0x000e0022}, -{0x000e0054,0x000e0054,0x000e0054,0x000e0054,0x000e0020,0x000e0020,0x000e0020,0x000e0020,0x000f0057,0x000f0057,0x000f0059,0x000f0059,0x000f001e,0x000f001e,0x000f001f,0x000f001f}, -{0x00100056,0x0010001d,0x0010001a,0x0010001b,0x0010001c,0x00100018,0x00100058,0x0000000f,0x00000010,0x00000011,0x00000012,0x00000013,0x00000014,0x00000015,0x00000016,0x00000017}, -{0x00110019,0x00110019,0x00110019,0x00110019,0x00110019,0x00110019,0x00110019,0x00110019,0x00110016,0x00110016,0x00110016,0x00110016,0x00110016,0x00110016,0x00110016,0x00110016}, -{0x00110017,0x00110017,0x00110017,0x00110017,0x00110017,0x00110017,0x00110017,0x00110017,0x0012005a,0x0012005a,0x0012005a,0x0012005a,0x00120015,0x00120015,0x00120015,0x00120015}, -{0x00120013,0x00120013,0x00120013,0x00120013,0x00120003,0x00120003,0x00120003,0x00120003,0x00120001,0x00120001,0x00120001,0x00120001,0x00120002,0x00120002,0x00120002,0x00120002}, -{0x00120000,0x00120000,0x00120000,0x00120000,0x00130062,0x00130062,0x00130063,0x00130063,0x00130064,0x00130064,0x00130065,0x00130065,0x00130066,0x00130066,0x00130075,0x00130075}, -{0x00130061,0x00130061,0x0013005b,0x0013005b,0x0013005c,0x0013005c,0x0013005d,0x0013005d,0x0013005e,0x0013005e,0x0013005f,0x0013005f,0x00130060,0x00130060,0x00130068,0x00130068}, -{0x0013006f,0x0013006f,0x00130070,0x00130070,0x00130071,0x00130071,0x00130072,0x00130072,0x00130073,0x00130073,0x00130074,0x00130074,0x0013006e,0x0013006e,0x00130069,0x00130069}, -{0x0013006a,0x0013006a,0x0013006b,0x0013006b,0x0013006c,0x0013006c,0x0013006d,0x0013006d,0x00130076,0x00130076,0x00130006,0x00130006,0x00130008,0x00130008,0x00130009,0x00130009}, -{0x0013000a,0x0013000a,0x00130005,0x00130005,0x00130067,0x00130067,0x00130078,0x00130078,0x00130077,0x00130077,0x00130004,0x00130004,0x00130007,0x00130007,0x0013000f,0x0013000f}, -{0x00130010,0x00130010,0x00130012,0x00130012,0x00130014,0x00130014,0x00130011,0x00130011,0x0013000b,0x0013000b,0x0013000c,0x0013000c,0x0013000e,0x0013000e,0x0013000d,0x0013000d} -}; - - -static const int NTuples_1 [324] = // 81 * 4 -{ - -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, 1, -1, -1, 0, -1, -1, -1, 0, 0, -1, -1, 0, 1, -1, -1, 1, -1, -1, -1, 1, 0, - -1, -1, 1, 1, -1, 0, -1, -1, -1, 0, -1, 0, -1, 0, -1, 1, -1, 0, 0, -1, -1, 0, 0, 0, -1, 0, 0, 1, -1, 0, 1, -1, - -1, 0, 1, 0, -1, 0, 1, 1, -1, 1, -1, -1, -1, 1, -1, 0, -1, 1, -1, 1, -1, 1, 0, -1, -1, 1, 0, 0, -1, 1, 0, 1, - -1, 1, 1, -1, -1, 1, 1, 0, -1, 1, 1, 1, 0, -1, -1, -1, 0, -1, -1, 0, 0, -1, -1, 1, 0, -1, 0, -1, 0, -1, 0, 0, - 0, -1, 0, 1, 0, -1, 1, -1, 0, -1, 1, 0, 0, -1, 1, 1, 0, 0, -1, -1, 0, 0, -1, 0, 0, 0, -1, 1, 0, 0, 0, -1, - 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, -1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, -1, -1, 0, 1, -1, 0, 0, 1, -1, 1, - 0, 1, 0, -1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, -1, 0, 1, 1, 0, 0, 1, 1, 1, 1, -1, -1, -1, 1, -1, -1, 0, - 1, -1, -1, 1, 1, -1, 0, -1, 1, -1, 0, 0, 1, -1, 0, 1, 1, -1, 1, -1, 1, -1, 1, 0, 1, -1, 1, 1, 1, 0, -1, -1, - 1, 0, -1, 0, 1, 0, -1, 1, 1, 0, 0, -1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, -1, 1, 0, 1, 0, 1, 0, 1, 1, - 1, 1, -1, -1, 1, 1, -1, 0, 1, 1, -1, 1, 1, 1, 0, -1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, -1, 1, 1, 1, 0, 1, 1, 1, 1 -} ; - -static const int NTuples_2 [324] = // 81 * 4 -{ - -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, 1, -1, -1, 0, -1, -1, -1, 0, 0, -1, -1, 0, 1, -1, -1, 1, -1, -1, -1, 1, 0, - -1, -1, 1, 1, -1, 0, -1, -1, -1, 0, -1, 0, -1, 0, -1, 1, -1, 0, 0, -1, -1, 0, 0, 0, -1, 0, 0, 1, -1, 0, 1, -1, - -1, 0, 1, 0, -1, 0, 1, 1, -1, 1, -1, -1, -1, 1, -1, 0, -1, 1, -1, 1, -1, 1, 0, -1, -1, 1, 0, 0, -1, 1, 0, 1, - -1, 1, 1, -1, -1, 1, 1, 0, -1, 1, 1, 1, 0, -1, -1, -1, 0, -1, -1, 0, 0, -1, -1, 1, 0, -1, 0, -1, 0, -1, 0, 0, - 0, -1, 0, 1, 0, -1, 1, -1, 0, -1, 1, 0, 0, -1, 1, 1, 0, 0, -1, -1, 0, 0, -1, 0, 0, 0, -1, 1, 0, 0, 0, -1, - 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, -1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, -1, -1, 0, 1, -1, 0, 0, 1, -1, 1, - 0, 1, 0, -1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, -1, 0, 1, 1, 0, 0, 1, 1, 1, 1, -1, -1, -1, 1, -1, -1, 0, - 1, -1, -1, 1, 1, -1, 0, -1, 1, -1, 0, 0, 1, -1, 0, 1, 1, -1, 1, -1, 1, -1, 1, 0, 1, -1, 1, 1, 1, 0, -1, -1, - 1, 0, -1, 0, 1, 0, -1, 1, 1, 0, 0, -1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, -1, 1, 0, 1, 0, 1, 0, 1, 1, - 1, 1, -1, -1, 1, 1, -1, 0, 1, 1, -1, 1, 1, 1, 0, -1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, -1, 1, 1, 1, 0, 1, 1, 1, 1 -} ; - -static const int NTuples_3 [324] = // 81 * 4 -{ - 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 2, 0, 0, 2, 0, 0, 0, 2, 1, - 0, 0, 2, 2, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 2, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 2, 0, 1, 2, 0, - 0, 1, 2, 1, 0, 1, 2, 2, 0, 2, 0, 0, 0, 2, 0, 1, 0, 2, 0, 2, 0, 2, 1, 0, 0, 2, 1, 1, 0, 2, 1, 2, - 0, 2, 2, 0, 0, 2, 2, 1, 0, 2, 2, 2, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 2, 1, 0, 1, 0, 1, 0, 1, 1, - 1, 0, 1, 2, 1, 0, 2, 0, 1, 0, 2, 1, 1, 0, 2, 2, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 2, 1, 1, 1, 0, - 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 0, 1, 1, 2, 1, 1, 1, 2, 2, 1, 2, 0, 0, 1, 2, 0, 1, 1, 2, 0, 2, - 1, 2, 1, 0, 1, 2, 1, 1, 1, 2, 1, 2, 1, 2, 2, 0, 1, 2, 2, 1, 1, 2, 2, 2, 2, 0, 0, 0, 2, 0, 0, 1, - 2, 0, 0, 2, 2, 0, 1, 0, 2, 0, 1, 1, 2, 0, 1, 2, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 2, 2, 2, 1, 0, 0, - 2, 1, 0, 1, 2, 1, 0, 2, 2, 1, 1, 0, 2, 1, 1, 1, 2, 1, 1, 2, 2, 1, 2, 0, 2, 1, 2, 1, 2, 1, 2, 2, - 2, 2, 0, 0, 2, 2, 0, 1, 2, 2, 0, 2, 2, 2, 1, 0, 2, 2, 1, 1, 2, 2, 1, 2, 2, 2, 2, 0, 2, 2, 2, 1, - 2, 2, 2, 2 -} ; - -static const int NTuples_4 [324] = // 81 * 4 -{ - 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 2, 0, 0, 2, 0, 0, 0, 2, 1, - 0, 0, 2, 2, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 2, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 2, 0, 1, 2, 0, - 0, 1, 2, 1, 0, 1, 2, 2, 0, 2, 0, 0, 0, 2, 0, 1, 0, 2, 0, 2, 0, 2, 1, 0, 0, 2, 1, 1, 0, 2, 1, 2, - 0, 2, 2, 0, 0, 2, 2, 1, 0, 2, 2, 2, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 2, 1, 0, 1, 0, 1, 0, 1, 1, - 1, 0, 1, 2, 1, 0, 2, 0, 1, 0, 2, 1, 1, 0, 2, 2, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 2, 1, 1, 1, 0, - 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 0, 1, 1, 2, 1, 1, 1, 2, 2, 1, 2, 0, 0, 1, 2, 0, 1, 1, 2, 0, 2, - 1, 2, 1, 0, 1, 2, 1, 1, 1, 2, 1, 2, 1, 2, 2, 0, 1, 2, 2, 1, 1, 2, 2, 2, 2, 0, 0, 0, 2, 0, 0, 1, - 2, 0, 0, 2, 2, 0, 1, 0, 2, 0, 1, 1, 2, 0, 1, 2, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 2, 2, 2, 1, 0, 0, - 2, 1, 0, 1, 2, 1, 0, 2, 2, 1, 1, 0, 2, 1, 1, 1, 2, 1, 1, 2, 2, 1, 2, 0, 2, 1, 2, 1, 2, 1, 2, 2, - 2, 2, 0, 0, 2, 2, 0, 1, 2, 2, 0, 2, 2, 2, 1, 0, 2, 2, 1, 1, 2, 2, 1, 2, 2, 2, 2, 0, 2, 2, 2, 1, - 2, 2, 2, 2 -} ; - -static const int NTuples_5 [162] = // 81 * 2 -{ - -4, -4, -4, -3, -4, -2, -4, -1, -4, 0, -4, 1, -4, 2, -4, 3, -4, 4, -3, -4, -3, -3, -3, -2, -3, -1, -3, 0, -3, 1, -3, 2, - -3, 3, -3, 4, -2, -4, -2, -3, -2, -2, -2, -1, -2, 0, -2, 1, -2, 2, -2, 3, -2, 4, -1, -4, -1, -3, -1, -2, -1, -1, -1, 0, - -1, 1, -1, 2, -1, 3, -1, 4, 0, -4, 0, -3, 0, -2, 0, -1, 0, 0, 0, 1, 0, 2, 0, 3, 0, 4, 1, -4, 1, -3, 1, -2, - 1, -1, 1, 0, 1, 1, 1, 2, 1, 3, 1, 4, 2, -4, 2, -3, 2, -2, 2, -1, 2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 3, -4, - 3, -3, 3, -2, 3, -1, 3, 0, 3, 1, 3, 2, 3, 3, 3, 4, 4, -4, 4, -3, 4, -2, 4, -1, 4, 0, 4, 1, 4, 2, 4, 3, 4, 4 -} ; - -static const int NTuples_6 [162] = // 81 * 2 -{ - -4, -4, -4, -3, -4, -2, -4, -1, -4, 0, -4, 1, -4, 2, -4, 3, -4, 4, -3, -4, -3, -3, -3, -2, -3, -1, -3, 0, -3, 1, -3, 2, - -3, 3, -3, 4, -2, -4, -2, -3, -2, -2, -2, -1, -2, 0, -2, 1, -2, 2, -2, 3, -2, 4, -1, -4, -1, -3, -1, -2, -1, -1, -1, 0, - -1, 1, -1, 2, -1, 3, -1, 4, 0, -4, 0, -3, 0, -2, 0, -1, 0, 0, 0, 1, 0, 2, 0, 3, 0, 4, 1, -4, 1, -3, 1, -2, - 1, -1, 1, 0, 1, 1, 1, 2, 1, 3, 1, 4, 2, -4, 2, -3, 2, -2, 2, -1, 2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 3, -4, - 3, -3, 3, -2, 3, -1, 3, 0, 3, 1, 3, 2, 3, 3, 3, 4, 4, -4, 4, -3, 4, -2, 4, -1, 4, 0, 4, 1, 4, 2, 4, 3, 4, 4 -} ; - -static const int NTuples_7 [128] = // 64 * 2 -{ - 0, 0, 0, 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 1, 0, 1, 1, 1, 2, 1, 3, 1, 4, 1, 5, 1, 6, 1, 7, - 2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 2, 5, 2, 6, 2, 7, 3, 0, 3, 1, 3, 2, 3, 3, 3, 4, 3, 5, 3, 6, 3, 7, - 4, 0, 4, 1, 4, 2, 4, 3, 4, 4, 4, 5, 4, 6, 4, 7, 5, 0, 5, 1, 5, 2, 5, 3, 5, 4, 5, 5, 5, 6, 5, 7, - 6, 0, 6, 1, 6, 2, 6, 3, 6, 4, 6, 5, 6, 6, 6, 7, 7, 0, 7, 1, 7, 2, 7, 3, 7, 4, 7, 5, 7, 6, 7, 7 -} ; - -static const int NTuples_8 [128] = // 64 * 2 -{ - 0, 0, 0, 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 1, 0, 1, 1, 1, 2, 1, 3, 1, 4, 1, 5, 1, 6, 1, 7, - 2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 2, 5, 2, 6, 2, 7, 3, 0, 3, 1, 3, 2, 3, 3, 3, 4, 3, 5, 3, 6, 3, 7, - 4, 0, 4, 1, 4, 2, 4, 3, 4, 4, 4, 5, 4, 6, 4, 7, 5, 0, 5, 1, 5, 2, 5, 3, 5, 4, 5, 5, 5, 6, 5, 7, - 6, 0, 6, 1, 6, 2, 6, 3, 6, 4, 6, 5, 6, 6, 6, 7, 7, 0, 7, 1, 7, 2, 7, 3, 7, 4, 7, 5, 7, 6, 7, 7 -} ; - -static const int NTuples_9 [338] = // 169 * 2 -{ - 0, 0, 0, 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 8, 0, 9, 0, 10, 0, 11, 0, 12, 1, 0, 1, 1, 1, 2, - 1, 3, 1, 4, 1, 5, 1, 6, 1, 7, 1, 8, 1, 9, 1, 10, 1, 11, 1, 12, 2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 2, 5, - 2, 6, 2, 7, 2, 8, 2, 9, 2, 10, 2, 11, 2, 12, 3, 0, 3, 1, 3, 2, 3, 3, 3, 4, 3, 5, 3, 6, 3, 7, 3, 8, - 3, 9, 3, 10, 3, 11, 3, 12, 4, 0, 4, 1, 4, 2, 4, 3, 4, 4, 4, 5, 4, 6, 4, 7, 4, 8, 4, 9, 4, 10, 4, 11, - 4, 12, 5, 0, 5, 1, 5, 2, 5, 3, 5, 4, 5, 5, 5, 6, 5, 7, 5, 8, 5, 9, 5, 10, 5, 11, 5, 12, 6, 0, 6, 1, - 6, 2, 6, 3, 6, 4, 6, 5, 6, 6, 6, 7, 6, 8, 6, 9, 6, 10, 6, 11, 6, 12, 7, 0, 7, 1, 7, 2, 7, 3, 7, 4, - 7, 5, 7, 6, 7, 7, 7, 8, 7, 9, 7, 10, 7, 11, 7, 12, 8, 0, 8, 1, 8, 2, 8, 3, 8, 4, 8, 5, 8, 6, 8, 7, - 8, 8, 8, 9, 8, 10, 8, 11, 8, 12, 9, 0, 9, 1, 9, 2, 9, 3, 9, 4, 9, 5, 9, 6, 9, 7, 9, 8, 9, 9, 9, 10, - 9, 11, 9, 12, 10, 0, 10, 1, 10, 2, 10, 3, 10, 4, 10, 5, 10, 6, 10, 7, 10, 8, 10, 9, 10, 10, 10, 11, 10, 12, 11, 0, - 11, 1, 11, 2, 11, 3, 11, 4, 11, 5, 11, 6, 11, 7, 11, 8, 11, 9, 11, 10, 11, 11, 11, 12, 12, 0, 12, 1, 12, 2, 12, 3, - 12, 4, 12, 5, 12, 6, 12, 7, 12, 8, 12, 9, 12, 10, 12, 11, 12, 12 -} ; - -static const int NTuples_10 [338] = // 169 * 2 -{ - 0, 0, 0, 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 8, 0, 9, 0, 10, 0, 11, 0, 12, 1, 0, 1, 1, 1, 2, - 1, 3, 1, 4, 1, 5, 1, 6, 1, 7, 1, 8, 1, 9, 1, 10, 1, 11, 1, 12, 2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 2, 5, - 2, 6, 2, 7, 2, 8, 2, 9, 2, 10, 2, 11, 2, 12, 3, 0, 3, 1, 3, 2, 3, 3, 3, 4, 3, 5, 3, 6, 3, 7, 3, 8, - 3, 9, 3, 10, 3, 11, 3, 12, 4, 0, 4, 1, 4, 2, 4, 3, 4, 4, 4, 5, 4, 6, 4, 7, 4, 8, 4, 9, 4, 10, 4, 11, - 4, 12, 5, 0, 5, 1, 5, 2, 5, 3, 5, 4, 5, 5, 5, 6, 5, 7, 5, 8, 5, 9, 5, 10, 5, 11, 5, 12, 6, 0, 6, 1, - 6, 2, 6, 3, 6, 4, 6, 5, 6, 6, 6, 7, 6, 8, 6, 9, 6, 10, 6, 11, 6, 12, 7, 0, 7, 1, 7, 2, 7, 3, 7, 4, - 7, 5, 7, 6, 7, 7, 7, 8, 7, 9, 7, 10, 7, 11, 7, 12, 8, 0, 8, 1, 8, 2, 8, 3, 8, 4, 8, 5, 8, 6, 8, 7, - 8, 8, 8, 9, 8, 10, 8, 11, 8, 12, 9, 0, 9, 1, 9, 2, 9, 3, 9, 4, 9, 5, 9, 6, 9, 7, 9, 8, 9, 9, 9, 10, - 9, 11, 9, 12, 10, 0, 10, 1, 10, 2, 10, 3, 10, 4, 10, 5, 10, 6, 10, 7, 10, 8, 10, 9, 10, 10, 10, 11, 10, 12, 11, 0, - 11, 1, 11, 2, 11, 3, 11, 4, 11, 5, 11, 6, 11, 7, 11, 8, 11, 9, 11, 10, 11, 11, 11, 12, 12, 0, 12, 1, 12, 2, 12, 3, - 12, 4, 12, 5, 12, 6, 12, 7, 12, 8, 12, 9, 12, 10, 12, 11, 12, 12 -} ; - -static const int NTuples_11 [578] = // 289 * 2 -{ - 0, 0, 0, 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 8, 0, 9, 0, 10, 0, 11, 0, 12, 0, 13, 0, 14, 0, 15, - 0, 16, 1, 0, 1, 1, 1, 2, 1, 3, 1, 4, 1, 5, 1, 6, 1, 7, 1, 8, 1, 9, 1, 10, 1, 11, 1, 12, 1, 13, 1, 14, - 1, 15, 1, 16, 2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 2, 5, 2, 6, 2, 7, 2, 8, 2, 9, 2, 10, 2, 11, 2, 12, 2, 13, - 2, 14, 2, 15, 2, 16, 3, 0, 3, 1, 3, 2, 3, 3, 3, 4, 3, 5, 3, 6, 3, 7, 3, 8, 3, 9, 3, 10, 3, 11, 3, 12, - 3, 13, 3, 14, 3, 15, 3, 16, 4, 0, 4, 1, 4, 2, 4, 3, 4, 4, 4, 5, 4, 6, 4, 7, 4, 8, 4, 9, 4, 10, 4, 11, - 4, 12, 4, 13, 4, 14, 4, 15, 4, 16, 5, 0, 5, 1, 5, 2, 5, 3, 5, 4, 5, 5, 5, 6, 5, 7, 5, 8, 5, 9, 5, 10, - 5, 11, 5, 12, 5, 13, 5, 14, 5, 15, 5, 16, 6, 0, 6, 1, 6, 2, 6, 3, 6, 4, 6, 5, 6, 6, 6, 7, 6, 8, 6, 9, - 6, 10, 6, 11, 6, 12, 6, 13, 6, 14, 6, 15, 6, 16, 7, 0, 7, 1, 7, 2, 7, 3, 7, 4, 7, 5, 7, 6, 7, 7, 7, 8, - 7, 9, 7, 10, 7, 11, 7, 12, 7, 13, 7, 14, 7, 15, 7, 16, 8, 0, 8, 1, 8, 2, 8, 3, 8, 4, 8, 5, 8, 6, 8, 7, - 8, 8, 8, 9, 8, 10, 8, 11, 8, 12, 8, 13, 8, 14, 8, 15, 8, 16, 9, 0, 9, 1, 9, 2, 9, 3, 9, 4, 9, 5, 9, 6, - 9, 7, 9, 8, 9, 9, 9, 10, 9, 11, 9, 12, 9, 13, 9, 14, 9, 15, 9, 16, 10, 0, 10, 1, 10, 2, 10, 3, 10, 4, 10, 5, - 10, 6, 10, 7, 10, 8, 10, 9, 10, 10, 10, 11, 10, 12, 10, 13, 10, 14, 10, 15, 10, 16, 11, 0, 11, 1, 11, 2, 11, 3, 11, 4, - 11, 5, 11, 6, 11, 7, 11, 8, 11, 9, 11, 10, 11, 11, 11, 12, 11, 13, 11, 14, 11, 15, 11, 16, 12, 0, 12, 1, 12, 2, 12, 3, - 12, 4, 12, 5, 12, 6, 12, 7, 12, 8, 12, 9, 12, 10, 12, 11, 12, 12, 12, 13, 12, 14, 12, 15, 12, 16, 13, 0, 13, 1, 13, 2, - 13, 3, 13, 4, 13, 5, 13, 6, 13, 7, 13, 8, 13, 9, 13, 10, 13, 11, 13, 12, 13, 13, 13, 14, 13, 15, 13, 16, 14, 0, 14, 1, - 14, 2, 14, 3, 14, 4, 14, 5, 14, 6, 14, 7, 14, 8, 14, 9, 14, 10, 14, 11, 14, 12, 14, 13, 14, 14, 14, 15, 14, 16, 15, 0, - 15, 1, 15, 2, 15, 3, 15, 4, 15, 5, 15, 6, 15, 7, 15, 8, 15, 9, 15, 10, 15, 11, 15, 12, 15, 13, 15, 14, 15, 15, 15, 16, - 16, 0, 16, 1, 16, 2, 16, 3, 16, 4, 16, 5, 16, 6, 16, 7, 16, 8, 16, 9, 16, 10, 16, 11, 16, 12, 16, 13, 16, 14, 16, 15, - 16, 16 -} ; - -/////////////////////////////////////////////////////////////////////////////////////////////// - -// Dimension IsSigned CodeBook N-Tuples - -const CBlock::CodeBookDescription CBlock::HuffmanCodeBooks [13] = -{ - { 0, false, 0L, 0L }, - { 4, true, HuffmanCodeBook_1, NTuples_1 }, - { 4, true, HuffmanCodeBook_2, NTuples_2 }, - { 4, false, HuffmanCodeBook_3, NTuples_3 }, - { 4, false, HuffmanCodeBook_4, NTuples_4 }, - { 2, true, HuffmanCodeBook_5, NTuples_5 }, - { 2, true, HuffmanCodeBook_6, NTuples_6 }, - { 2, false, HuffmanCodeBook_7, NTuples_7 }, - { 2, false, HuffmanCodeBook_8, NTuples_8 }, - { 2, false, HuffmanCodeBook_9, NTuples_9 }, - { 2, false, HuffmanCodeBook_10, NTuples_10 }, - { 2, false, HuffmanCodeBook_11, NTuples_11 }, - { 1, true, HuffmanCodeBook_SCL, 0L } -} ; - -const float CBlock::m_InverseQuantTable [CBlock::InverseQuantTableSize] = // pow (i, 4.0F / 3.0F) -{ - 0.000000F, 1.000000F, 2.519842F, 4.326749F, 6.349605F, 8.549880F, 10.902724F, 13.390519F, - 16.000002F, 18.720757F, 21.544350F, 24.463783F, 27.473145F, 30.567354F, 33.741997F, 36.993187F, - 40.317478F, 43.711792F, 47.173351F, 50.699638F, 54.288361F, 57.937416F, 61.644875F, 65.408951F, - 69.227989F, 73.100456F, 77.024910F, 81.000008F, 85.024506F, 89.097198F, 93.216988F, 97.382812F, - 101.593681F, 105.848648F, 110.146820F, 114.487335F, 118.869400F, 123.292229F, 127.755081F, 132.257263F, - 136.798096F, 141.376923F, 145.993134F, 150.646133F, 155.335358F, 160.060226F, 164.820221F, 169.614853F, - 174.443604F, 179.306015F, 184.201599F, 189.129944F, 194.090607F, 199.083176F, 204.107239F, 209.162415F, - 214.248322F, 219.364594F, 224.510880F, 229.686829F, 234.892090F, 240.126373F, 245.389313F, 250.680649F, - 256.000031F, 261.347229F, 266.721893F, 272.123779F, 277.552582F, 283.008087F, 288.490021F, 293.998108F, - 299.532135F, 305.091827F, 310.676941F, 316.287292F, 321.922638F, 327.582764F, 333.267426F, 338.976440F, - 344.709625F, 350.466705F, 356.247559F, 362.051941F, 367.879669F, 373.730591F, 379.604492F, 385.501221F, - 391.420563F, 397.362396F, 403.326508F, 409.312744F, 415.320953F, 421.350983F, 427.402649F, 433.475830F, - 439.570343F, 445.686066F, 451.822845F, 457.980530F, 464.158966F, 470.358032F, 476.577606F, 482.817535F, - 489.077698F, 495.357971F, 501.658173F, 507.978241F, 514.318054F, 520.677429F, 527.056274F, 533.454529F, - 539.871948F, 546.308533F, 552.764160F, 559.238708F, 565.731995F, 572.243958F, 578.774536F, 585.323608F, - 591.890991F, 598.476685F, 605.080566F, 611.702454F, 618.342346F, 625.000122F, 631.675659F, 638.368896F, - 645.079712F, 651.808044F, 658.553711F, 665.316772F, 672.097046F, 678.894470F, 685.708923F, 692.540405F, - 699.388733F, 706.253845F, 713.135742F, 720.034241F, 726.949341F, 733.880859F, 740.828857F, 747.793152F, - 754.773682F, 761.770386F, 768.783203F, 775.812073F, 782.856873F, 789.917603F, 796.994080F, 804.086365F, - 811.194275F, 818.317810F, 825.456848F, 832.611389F, 839.781311F, 846.966614F, 854.167175F, 861.382935F, - 868.613831F, 875.859802F, 883.120789F, 890.396729F, 897.687561F, 904.993286F, 912.313721F, 919.648865F, - 926.998718F, 934.363159F, 941.742065F, 949.135559F, 956.543396F, 963.965637F, 971.402222F, 978.853027F, - 986.318054F, 993.797241F, 1001.290466F, 1008.797791F, 1016.319092F, 1023.854370F, 1031.403564F, 1038.966553F, - 1046.543213F, 1054.133789F, 1061.737915F, 1069.355835F, 1076.987183F, 1084.632202F, 1092.290649F, 1099.962646F, - 1107.647949F, 1115.346558F, 1123.058594F, 1130.783813F, 1138.522217F, 1146.273926F, 1154.038574F, 1161.816406F, - 1169.607300F, 1177.411255F, 1185.228027F, 1193.057739F, 1200.900391F, 1208.755859F, 1216.624023F, 1224.505005F, - 1232.398682F, 1240.304932F, 1248.223877F, 1256.155396F, 1264.099487F, 1272.056030F, 1280.025024F, 1288.006470F, - 1296.000244F, 1304.006470F, 1312.024902F, 1320.055664F, 1328.098633F, 1336.153809F, 1344.221191F, 1352.300659F, - 1360.392212F, 1368.495728F, 1376.611328F, 1384.738892F, 1392.878418F, 1401.029907F, 1409.193237F, 1417.368408F, - 1425.555298F, 1433.754028F, 1441.964478F, 1450.186646F, 1458.420532F, 1466.666016F, 1474.923096F, 1483.191772F, - 1491.471924F, 1499.763672F, 1508.066772F, 1516.381470F, 1524.707520F, 1533.044922F, 1541.393677F, 1549.753784F, - 1558.125122F, 1566.507812F, 1574.901611F, 1583.306763F, 1591.723022F, 1600.150391F, 1608.588867F, 1617.038452F, - 1625.499023F, 1633.970703F, 1642.453369F, 1650.946899F, 1659.451538F, 1667.966919F, 1676.493286F, 1685.030518F, - 1693.578491F, 1702.137329F, 1710.706909F, 1719.287231F, 1727.878296F, 1736.480103F, 1745.092529F, 1753.715576F, - 1762.349243F, 1770.993408F, 1779.648315F, 1788.313599F, 1796.989502F, 1805.675903F, 1814.372681F, 1823.079834F, - 1831.797485F, 1840.525635F, 1849.263916F, 1858.012695F, 1866.771729F, 1875.541016F, 1884.320679F, 1893.110474F, - 1901.910522F, 1910.720703F, 1919.541138F, 1928.371704F, 1937.212402F, 1946.063110F, 1954.923950F, 1963.794922F, - 1972.675781F, 1981.566650F, 1990.467651F, 1999.378540F, 2008.299316F, 2017.229980F, 2026.170654F, 2035.121216F, - 2044.081543F, 2053.051758F, 2062.031738F, 2071.021484F, 2080.020996F, 2089.030273F, 2098.049316F, 2107.078125F, - 2116.116455F, 2125.164551F, 2134.222168F, 2143.289551F, 2152.366455F, 2161.452881F, 2170.549072F, 2179.654541F, - 2188.769775F, 2197.894287F, 2207.028320F, 2216.171875F, 2225.324951F, 2234.487305F, 2243.659180F, 2252.840576F, - 2262.031006F, 2271.230957F, 2280.440186F, 2289.658691F, 2298.886475F, 2308.123779F, 2317.370117F, 2326.625732F, - 2335.890381F, 2345.164551F, 2354.447510F, 2363.739990F, 2373.041504F, 2382.352051F, 2391.671875F, 2401.000488F, - 2410.338379F, 2419.685303F, 2429.041260F, 2438.406250F, 2447.780273F, 2457.163086F, 2466.555176F, 2475.956055F, - 2485.365723F, 2494.784424F, 2504.212158F, 2513.648682F, 2523.093994F, 2532.548340F, 2542.011230F, 2551.483154F, - 2560.963867F, 2570.453125F, 2579.951416F, 2589.458496F, 2598.974121F, 2608.498535F, 2618.031494F, 2627.573486F, - 2637.123779F, 2646.682861F, 2656.250732F, 2665.827148F, 2675.412109F, 2685.005615F, 2694.607910F, 2704.218506F, - 2713.837891F, 2723.465576F, 2733.102051F, 2742.746826F, 2752.400146F, 2762.061768F, 2771.732178F, 2781.410889F, - 2791.097900F, 2800.793457F, 2810.497314F, 2820.209717F, 2829.930176F, 2839.659424F, 2849.396729F, 2859.142334F, - 2868.896240F, 2878.658691F, 2888.429199F, 2898.208008F, 2907.995117F, 2917.790527F, 2927.594238F, 2937.406006F, - 2947.225830F, 2957.054199F, 2966.890381F, 2976.734863F, 2986.587646F, 2996.448486F, 3006.317383F, 3016.194336F, - 3026.079346F, 3035.972656F, 3045.873779F, 3055.783203F, 3065.700439F, 3075.625977F, 3085.559326F, 3095.500732F, - 3105.449951F, 3115.407471F, 3125.372803F, 3135.345947F, 3145.327148F, 3155.316162F, 3165.313232F, 3175.318359F, - 3185.331055F, 3195.351807F, 3205.380371F, 3215.416748F, 3225.460938F, 3235.513184F, 3245.572998F, 3255.640625F, - 3265.716064F, 3275.799316F, 3285.890381F, 3295.989258F, 3306.095703F, 3316.209961F, 3326.332031F, 3336.461670F, - 3346.598877F, 3356.744141F, 3366.896729F, 3377.057129F, 3387.225098F, 3397.400879F, 3407.583984F, 3417.774902F, - 3427.973633F, 3438.179688F, 3448.393311F, 3458.614502F, 3468.843262F, 3479.079590F, 3489.323486F, 3499.574951F, - 3509.833984F, 3520.100342F, 3530.374268F, 3540.655518F, 3550.944580F, 3561.240723F, 3571.544678F, 3581.855713F, - 3592.174316F, 3602.500488F, 3612.833984F, 3623.174805F, 3633.522949F, 3643.878662F, 3654.241455F, 3664.611816F, - 3674.989502F, 3685.374512F, 3695.766846F, 3706.166504F, 3716.573242F, 3726.987549F, 3737.409180F, 3747.837891F, - 3758.273926F, 3768.717041F, 3779.167725F, 3789.625488F, 3800.090332F, 3810.562500F, 3821.041992F, 3831.528564F, - 3842.022217F, 3852.523193F, 3863.031250F, 3873.546387F, 3884.068848F, 3894.598145F, 3905.134766F, 3915.678711F, - 3926.229492F, 3936.787354F, 3947.352295F, 3957.924561F, 3968.503662F, 3979.089844F, 3989.683105F, 4000.283447F, - 4010.890625F, 4021.504883F, 4032.126221F, 4042.754639F, 4053.389893F, 4064.032227F, 4074.681641F, 4085.337891F, - 4096.000977F, 4106.671387F, 4117.348145F, 4128.032227F, 4138.723145F, 4149.420898F, 4160.125488F, 4170.837402F, - 4181.555664F, 4192.281250F, 4203.013672F, 4213.752441F, 4224.498535F, 4235.251465F, 4246.010742F, 4256.777344F, - 4267.550293F, 4278.330566F, 4289.117188F, 4299.911133F, 4310.711426F, 4321.518555F, 4332.332520F, 4343.153320F, - 4353.980469F, 4364.814941F, 4375.655762F, 4386.503418F, 4397.357422F, 4408.218750F, 4419.086426F, 4429.960938F, - 4440.841797F, 4451.729492F, 4462.624023F, 4473.524902F, 4484.432617F, 4495.347168F, 4506.268066F, 4517.195801F, - 4528.129883F, 4539.070801F, 4550.018066F, 4560.972168F, 4571.932617F, 4582.899902F, 4593.873535F, 4604.854004F, - 4615.840820F, 4626.833984F, 4637.833984F, 4648.840332F, 4659.853516F, 4670.872559F, 4681.898926F, 4692.931152F, - 4703.970215F, 4715.015625F, 4726.067383F, 4737.125977F, 4748.190430F, 4759.261719F, 4770.339844F, 4781.423828F, - 4792.514160F, 4803.611328F, 4814.714844F, 4825.824707F, 4836.940918F, 4848.063477F, 4859.192383F, 4870.327637F, - 4881.469238F, 4892.617676F, 4903.771973F, 4914.932617F, 4926.100098F, 4937.273438F, 4948.453125F, 4959.639160F, - 4970.831543F, 4982.030273F, 4993.235352F, 5004.446777F, 5015.664062F, 5026.888184F, 5038.118164F, 5049.354492F, - 5060.597168F, 5071.846191F, 5083.101074F, 5094.362793F, 5105.630371F, 5116.904297F, 5128.184082F, 5139.470215F, - 5150.762695F, 5162.061523F, 5173.366211F, 5184.677246F, 5195.994629F, 5207.317871F, 5218.646973F, 5229.982910F, - 5241.324707F, 5252.672363F, 5264.026855F, 5275.386719F, 5286.752930F, 5298.125488F, 5309.503906F, 5320.888672F, - 5332.279297F, 5343.676270F, 5355.079102F, 5366.488281F, 5377.902832F, 5389.324219F, 5400.751465F, 5412.184570F, - 5423.623535F, 5435.068848F, 5446.520020F, 5457.977539F, 5469.440918F, 5480.910156F, 5492.385742F, 5503.866699F, - 5515.354004F, 5526.847656F, 5538.346680F, 5549.852051F, 5561.363281F, 5572.880371F, 5584.403809F, 5595.932617F, - 5607.467773F, 5619.008789F, 5630.555664F, 5642.108398F, 5653.666992F, 5665.231934F, 5676.802246F, 5688.378906F, - 5699.960938F, 5711.549316F, 5723.143555F, 5734.743652F, 5746.349121F, 5757.960938F, 5769.578613F, 5781.202148F, - 5792.831543F, 5804.466309F, 5816.107422F, 5827.754395F, 5839.406738F, 5851.064941F, 5862.729492F, 5874.399414F, - 5886.075195F, 5897.756836F, 5909.444336F, 5921.137695F, 5932.836426F, 5944.541016F, 5956.251465F, 5967.967773F, - 5979.689941F, 5991.417480F, 6003.151367F, 6014.890625F, 6026.635254F, 6038.386230F, 6050.142578F, 6061.904785F, - 6073.672363F, 6085.445801F, 6097.225098F, 6109.010254F, 6120.800781F, 6132.597168F, 6144.398926F, 6156.206543F, - 6168.020020F, 6179.838867F, 6191.663574F, 6203.493652F, 6215.329590F, 6227.171387F, 6239.018555F, 6250.871094F, - 6262.729492F, 6274.593750F, 6286.463379F, 6298.338379F, 6310.219238F, 6322.105957F, 6333.998047F, 6345.895508F, - 6357.798828F, 6369.707520F, 6381.621582F, 6393.541504F, 6405.467285F, 6417.398438F, 6429.334961F, 6441.276855F, - 6453.224609F, 6465.177734F, 6477.136230F, 6489.100586F, 6501.070312F, 6513.045410F, 6525.026367F, 6537.012695F, - 6549.004395F, 6561.001953F, 6573.004395F, 6585.012695F, 6597.026367F, 6609.045410F, 6621.070312F, 6633.100098F, - 6645.135742F, 6657.176758F, 6669.223145F, 6681.275391F, 6693.332520F, 6705.395508F, 6717.463379F, 6729.537109F, - 6741.616211F, 6753.700684F, 6765.790527F, 6777.885742F, 6789.986328F, 6802.092773F, 6814.204102F, 6826.320801F, - 6838.442871F, 6850.570801F, 6862.703613F, 6874.841797F, 6886.985840F, 6899.134766F, 6911.289062F, 6923.448730F, - 6935.613770F, 6947.784180F, 6959.959961F, 6972.141113F, 6984.327637F, 6996.519043F, 7008.716309F, 7020.918457F, - 7033.125977F, 7045.338867F, 7057.557129F, 7069.780762F, 7082.009766F, 7094.243652F, 7106.482910F, 7118.727539F, - 7130.977539F, 7143.232910F, 7155.493164F, 7167.758789F, 7180.029785F, 7192.306152F, 7204.587402F, 7216.874023F, - 7229.166016F, 7241.462891F, 7253.765625F, 7266.073242F, 7278.385742F, 7290.703613F, 7303.026855F, 7315.355469F, - 7327.688965F, 7340.027832F, 7352.371582F, 7364.720703F, 7377.075195F, 7389.434570F, 7401.799316F, 7414.168945F, - 7426.543945F, 7438.924316F, 7451.309570F, 7463.700195F, 7476.095703F, 7488.496582F, 7500.902344F, 7513.313477F, - 7525.729492F, 7538.150391F, 7550.577148F, 7563.008301F, 7575.445312F, 7587.886719F, 7600.333496F, 7612.785645F, - 7625.242676F, 7637.704590F, 7650.171875F, 7662.644043F, 7675.121582F, 7687.604004F, 7700.091309F, 7712.583984F, - 7725.081543F, 7737.583984F, 7750.091797F, 7762.604492F, 7775.122559F, 7787.645020F, 7800.172852F, 7812.706055F, - 7825.244141F, 7837.787109F, 7850.334961F, 7862.887695F, 7875.445801F, 7888.008789F, 7900.577148F, 7913.149902F, - 7925.728027F, 7938.311035F, 7950.898926F, 7963.492188F, 7976.089844F, 7988.692871F, 8001.300781F, 8013.913574F, - 8026.531738F, 8039.154297F, 8051.782227F, 8064.415039F, 8077.052734F, 8089.695312F, 8102.342773F, 8114.995117F, - 8127.652832F, 8140.314941F, 8152.982422F, 8165.654297F, 8178.331543F, 8191.013672F, 8203.700195F, 8216.392578F, - 8229.088867F, 8241.791016F, 8254.497070F, 8267.208984F, 8279.924805F, 8292.646484F, 8305.373047F, 8318.103516F, - 8330.839844F, 8343.580078F, 8356.326172F, 8369.076172F, 8381.831055F, 8394.591797F, 8407.356445F, 8420.126953F, - 8432.901367F, 8445.680664F, 8458.464844F, 8471.253906F, 8484.048828F, 8496.847656F, 8509.651367F, 8522.458984F, - 8535.272461F, 8548.090820F, 8560.914062F, 8573.741211F, 8586.574219F, 8599.411133F, 8612.253906F, 8625.100586F, - 8637.952148F, 8650.808594F, 8663.669922F, 8676.536133F, 8689.407227F, 8702.282227F, 8715.163086F, 8728.047852F, - 8740.937500F, 8753.832031F, 8766.731445F, 8779.635742F, 8792.544922F, 8805.458008F, 8818.376953F, 8831.299805F, - 8844.227539F, 8857.160156F, 8870.097656F, 8883.039062F, 8895.985352F, 8908.937500F, 8921.893555F, 8934.854492F, - 8947.819336F, 8960.790039F, 8973.764648F, 8986.744141F, 8999.728516F, 9012.717773F, 9025.710938F, 9038.709961F, - 9051.712891F, 9064.719727F, 9077.732422F, 9090.750000F, 9103.771484F, 9116.797852F, 9129.828125F, 9142.864258F, - 9155.904297F, 9168.949219F, 9181.999023F, 9195.052734F, 9208.112305F, 9221.175781F, 9234.243164F, 9247.316406F, - 9260.393555F, 9273.475586F, 9286.562500F, 9299.653320F, 9312.749023F, 9325.849609F, 9338.954102F, 9352.064453F, - 9365.178711F, 9378.296875F, 9391.420898F, 9404.548828F, 9417.680664F, 9430.818359F, 9443.959961F, 9457.106445F, - 9470.256836F, 9483.412109F, 9496.572266F, 9509.737305F, 9522.906250F, 9536.080078F, 9549.257812F, 9562.440430F, - 9575.627930F, 9588.819336F, 9602.016602F, 9615.216797F, 9628.422852F, 9641.632812F, 9654.846680F, 9668.066406F, - 9681.289062F, 9694.517578F, 9707.750000F, 9720.987305F, 9734.228516F, 9747.474609F, 9760.725586F, 9773.980469F, - 9787.240234F, 9800.503906F, 9813.772461F, 9827.045898F, 9840.323242F, 9853.605469F, 9866.891602F, 9880.182617F, - 9893.478516F, 9906.778320F, 9920.083008F, 9933.391602F, 9946.705078F, 9960.022461F, 9973.344727F, 9986.671875F, - 10000.002930F, 10013.337891F, 10026.678711F, 10040.022461F, 10053.372070F, 10066.724609F, 10080.083008F, 10093.445312F, - 10106.811523F, 10120.182617F, 10133.557617F, 10146.937500F, 10160.322266F, 10173.710938F, 10187.103516F, 10200.500977F, - 10213.903320F, 10227.309570F, 10240.719727F, 10254.134766F, 10267.554688F, 10280.978516F, 10294.406250F, 10307.838867F -} ; - -const float CBlock::m_ExpTable [CBlock::ExpTableSize] = // pow (2.0, 0.25 * i) -{ - 1.0F, 1.189207F, 1.414214F, 1.681793F, 2.0F, 2.378414F, 2.828427F, 3.363586F, - 4.0F, 4.756828F, 5.656854F, 6.727171F, 8.0F, 9.513657F, 11.313708F, 13.454343F, - 16.0F, 19.027313F, 22.627417F, 26.908686F, 32.0F, 38.054626F, 45.254833F, 53.817371F, - 64.0F, 76.109253F, 90.509666F, 107.634743F, 128.0F, 152.218506F, 181.019333F, 215.269485F, - 256.0F, 304.437012F, 362.038666F, 430.538971F, 512.0F, 608.874023F, 724.077332F, 861.077942F, - 1024.0F, 1217.748047F, 1448.154663F, 1722.155884F, 2048.0F, 2435.496094F, 2896.309326F, 3444.311768F, - 4096.0F, 4870.992188F, 5792.618652F, 6888.623535F, 8192.0F, 9741.984375F, 11585.237305F, 13777.247070F, - 16384.0F, 19483.968750F, 23170.474609F, 27554.494141F, 32768.0F, 38967.9375F, 46340.949219F, 55108.988281F, - 65536.0F, 77935.8750F, 92681.898438F, 110217.976563F, 131072.0F, 155871.75F, 185363.796875F, 220435.953125F, - 262144.0F, 311743.50F, 370727.593750F, 440871.906250F, 524288.0F, 623487.0F, 741455.187500F, 881743.812500F, - 1048576.0F, 1246974.0F, 1482910.375000F, 1763487.625000F, 2097152.0F, 2493948.0F, 2965820.750000F, 3526975.25F, - 4194304.0F, 4987896.0F, 5931641.50F, 7053950.50F, 8388608.0F, 9975792.0F, 11863283.0F, 14107901.0F, - 16777216.0F, 19951584.0F, 23726566.0F, 28215802.0F, 33554432.0F, 39903168.0F, 47453132.0F, 56431604.0F, - 67108864.0F, 79806336.0F, 94906264.0F, 112863208.0F, 134217728.0F, 159612672.0F, 189812528.0F, 225726416.0F, - 268435456.0F, 319225344.0F, 379625056.0F, 451452832.0F, 536870912.0F, 638450688.0F, 759250112.0F, 902905664.0F, - 1073741824.0F, 1276901376.0F, 1518500224.0F, 1805811328.0F, 2147483648.0F, 2553802752.0F, 3037000448.0F, 3611622656.0F, -} ; - -const float CBlock::m_OnlyLongWindowSine [1024] = -{ - 0.000767F, 0.002301F, 0.003835F, 0.005369F, 0.006903F, 0.008437F, 0.009971F, 0.011505F, - 0.013038F, 0.014572F, 0.016106F, 0.017640F, 0.019174F, 0.020707F, 0.022241F, 0.023774F, - 0.025308F, 0.026841F, 0.028375F, 0.029908F, 0.031441F, 0.032975F, 0.034508F, 0.036041F, - 0.037574F, 0.039107F, 0.040639F, 0.042172F, 0.043705F, 0.045237F, 0.046769F, 0.048302F, - 0.049834F, 0.051366F, 0.052898F, 0.054429F, 0.055961F, 0.057493F, 0.059024F, 0.060555F, - 0.062086F, 0.063617F, 0.065148F, 0.066679F, 0.068209F, 0.069739F, 0.071270F, 0.072800F, - 0.074329F, 0.075859F, 0.077389F, 0.078918F, 0.080447F, 0.081976F, 0.083505F, 0.085033F, - 0.086561F, 0.088090F, 0.089617F, 0.091145F, 0.092673F, 0.094200F, 0.095727F, 0.097254F, - 0.098780F, 0.100307F, 0.101833F, 0.103359F, 0.104884F, 0.106410F, 0.107935F, 0.109460F, - 0.110984F, 0.112509F, 0.114033F, 0.115557F, 0.117080F, 0.118604F, 0.120127F, 0.121649F, - 0.123172F, 0.124694F, 0.126216F, 0.127737F, 0.129259F, 0.130780F, 0.132300F, 0.133821F, - 0.135341F, 0.136860F, 0.138380F, 0.139899F, 0.141418F, 0.142936F, 0.144454F, 0.145972F, - 0.147489F, 0.149006F, 0.150523F, 0.152039F, 0.153555F, 0.155071F, 0.156586F, 0.158101F, - 0.159615F, 0.161129F, 0.162643F, 0.164157F, 0.165670F, 0.167182F, 0.168694F, 0.170206F, - 0.171718F, 0.173229F, 0.174739F, 0.176249F, 0.177759F, 0.179268F, 0.180777F, 0.182286F, - 0.183794F, 0.185301F, 0.186809F, 0.188315F, 0.189822F, 0.191328F, 0.192833F, 0.194338F, - 0.195843F, 0.197347F, 0.198850F, 0.200353F, 0.201856F, 0.203358F, 0.204860F, 0.206361F, - 0.207862F, 0.209362F, 0.210862F, 0.212361F, 0.213860F, 0.215358F, 0.216856F, 0.218353F, - 0.219850F, 0.221346F, 0.222841F, 0.224337F, 0.225831F, 0.227325F, 0.228819F, 0.230312F, - 0.231804F, 0.233296F, 0.234788F, 0.236278F, 0.237769F, 0.239258F, 0.240748F, 0.242236F, - 0.243724F, 0.245212F, 0.246698F, 0.248185F, 0.249670F, 0.251155F, 0.252640F, 0.254124F, - 0.255607F, 0.257090F, 0.258572F, 0.260054F, 0.261534F, 0.263015F, 0.264494F, 0.265973F, - 0.267452F, 0.268930F, 0.270407F, 0.271883F, 0.273359F, 0.274834F, 0.276309F, 0.277783F, - 0.279256F, 0.280729F, 0.282201F, 0.283672F, 0.285143F, 0.286613F, 0.288082F, 0.289551F, - 0.291019F, 0.292486F, 0.293952F, 0.295418F, 0.296883F, 0.298348F, 0.299812F, 0.301275F, - 0.302737F, 0.304199F, 0.305660F, 0.307120F, 0.308579F, 0.310038F, 0.311496F, 0.312953F, - 0.314410F, 0.315866F, 0.317321F, 0.318775F, 0.320229F, 0.321682F, 0.323134F, 0.324585F, - 0.326035F, 0.327485F, 0.328934F, 0.330382F, 0.331830F, 0.333277F, 0.334723F, 0.336168F, - 0.337612F, 0.339055F, 0.340498F, 0.341940F, 0.343381F, 0.344821F, 0.346261F, 0.347700F, - 0.349138F, 0.350575F, 0.352011F, 0.353446F, 0.354881F, 0.356314F, 0.357747F, 0.359179F, - 0.360611F, 0.362041F, 0.363470F, 0.364899F, 0.366327F, 0.367754F, 0.369180F, 0.370605F, - 0.372029F, 0.373453F, 0.374875F, 0.376297F, 0.377718F, 0.379138F, 0.380557F, 0.381975F, - 0.383392F, 0.384808F, 0.386224F, 0.387638F, 0.389052F, 0.390464F, 0.391876F, 0.393287F, - 0.394697F, 0.396106F, 0.397514F, 0.398921F, 0.400327F, 0.401732F, 0.403137F, 0.404540F, - 0.405942F, 0.407344F, 0.408744F, 0.410144F, 0.411542F, 0.412940F, 0.414337F, 0.415732F, - 0.417127F, 0.418520F, 0.419913F, 0.421305F, 0.422696F, 0.424085F, 0.425474F, 0.426862F, - 0.428248F, 0.429634F, 0.431019F, 0.432402F, 0.433785F, 0.435167F, 0.436547F, 0.437927F, - 0.439305F, 0.440683F, 0.442059F, 0.443435F, 0.444809F, 0.446183F, 0.447555F, 0.448926F, - 0.450296F, 0.451665F, 0.453034F, 0.454401F, 0.455766F, 0.457131F, 0.458495F, 0.459858F, - 0.461219F, 0.462580F, 0.463939F, 0.465298F, 0.466655F, 0.468011F, 0.469366F, 0.470720F, - 0.472073F, 0.473425F, 0.474775F, 0.476125F, 0.477473F, 0.478821F, 0.480167F, 0.481512F, - 0.482856F, 0.484198F, 0.485540F, 0.486880F, 0.488220F, 0.489558F, 0.490895F, 0.492231F, - 0.493565F, 0.494899F, 0.496231F, 0.497563F, 0.498893F, 0.500221F, 0.501549F, 0.502876F, - 0.504201F, 0.505525F, 0.506848F, 0.508170F, 0.509490F, 0.510810F, 0.512128F, 0.513445F, - 0.514760F, 0.516075F, 0.517388F, 0.518700F, 0.520011F, 0.521321F, 0.522629F, 0.523937F, - 0.525243F, 0.526547F, 0.527851F, 0.529153F, 0.530454F, 0.531754F, 0.533052F, 0.534350F, - 0.535645F, 0.536940F, 0.538234F, 0.539526F, 0.540817F, 0.542106F, 0.543395F, 0.544682F, - 0.545968F, 0.547252F, 0.548536F, 0.549818F, 0.551098F, 0.552378F, 0.553656F, 0.554932F, - 0.556208F, 0.557482F, 0.558755F, 0.560026F, 0.561297F, 0.562565F, 0.563833F, 0.565099F, - 0.566364F, 0.567628F, 0.568890F, 0.570151F, 0.571410F, 0.572669F, 0.573925F, 0.575181F, - 0.576435F, 0.577688F, 0.578939F, 0.580189F, 0.581438F, 0.582686F, 0.583932F, 0.585176F, - 0.586419F, 0.587661F, 0.588902F, 0.590141F, 0.591378F, 0.592615F, 0.593850F, 0.595083F, - 0.596315F, 0.597546F, 0.598775F, 0.600003F, 0.601230F, 0.602455F, 0.603678F, 0.604900F, - 0.606121F, 0.607341F, 0.608559F, 0.609775F, 0.610990F, 0.612204F, 0.613416F, 0.614627F, - 0.615836F, 0.617044F, 0.618250F, 0.619455F, 0.620659F, 0.621861F, 0.623061F, 0.624260F, - 0.625458F, 0.626654F, 0.627849F, 0.629042F, 0.630234F, 0.631424F, 0.632613F, 0.633800F, - 0.634986F, 0.636170F, 0.637353F, 0.638534F, 0.639714F, 0.640892F, 0.642069F, 0.643245F, - 0.644418F, 0.645590F, 0.646761F, 0.647930F, 0.649098F, 0.650264F, 0.651429F, 0.652592F, - 0.653753F, 0.654913F, 0.656072F, 0.657229F, 0.658384F, 0.659538F, 0.660690F, 0.661841F, - 0.662990F, 0.664138F, 0.665284F, 0.666428F, 0.667571F, 0.668713F, 0.669852F, 0.670990F, - 0.672127F, 0.673262F, 0.674396F, 0.675527F, 0.676658F, 0.677786F, 0.678913F, 0.680039F, - 0.681163F, 0.682285F, 0.683406F, 0.684525F, 0.685642F, 0.686758F, 0.687872F, 0.688985F, - 0.690096F, 0.691205F, 0.692313F, 0.693419F, 0.694524F, 0.695626F, 0.696728F, 0.697827F, - 0.698925F, 0.700021F, 0.701116F, 0.702209F, 0.703300F, 0.704390F, 0.705478F, 0.706564F, - 0.707649F, 0.708732F, 0.709813F, 0.710893F, 0.711971F, 0.713047F, 0.714122F, 0.715195F, - 0.716266F, 0.717336F, 0.718404F, 0.719470F, 0.720535F, 0.721597F, 0.722659F, 0.723718F, - 0.724776F, 0.725832F, 0.726886F, 0.727939F, 0.728990F, 0.730039F, 0.731086F, 0.732132F, - 0.733176F, 0.734218F, 0.735259F, 0.736298F, 0.737335F, 0.738370F, 0.739404F, 0.740436F, - 0.741466F, 0.742494F, 0.743521F, 0.744546F, 0.745569F, 0.746591F, 0.747610F, 0.748628F, - 0.749644F, 0.750659F, 0.751671F, 0.752682F, 0.753691F, 0.754698F, 0.755704F, 0.756708F, - 0.757710F, 0.758710F, 0.759708F, 0.760705F, 0.761700F, 0.762693F, 0.763684F, 0.764673F, - 0.765661F, 0.766647F, 0.767631F, 0.768613F, 0.769593F, 0.770572F, 0.771549F, 0.772524F, - 0.773497F, 0.774468F, 0.775438F, 0.776405F, 0.777371F, 0.778335F, 0.779297F, 0.780258F, - 0.781216F, 0.782173F, 0.783128F, 0.784081F, 0.785032F, 0.785981F, 0.786929F, 0.787874F, - 0.788818F, 0.789760F, 0.790700F, 0.791638F, 0.792575F, 0.793509F, 0.794442F, 0.795372F, - 0.796301F, 0.797228F, 0.798153F, 0.799076F, 0.799998F, 0.800917F, 0.801835F, 0.802750F, - 0.803664F, 0.804576F, 0.805486F, 0.806394F, 0.807300F, 0.808205F, 0.809107F, 0.810008F, - 0.810906F, 0.811803F, 0.812698F, 0.813591F, 0.814482F, 0.815371F, 0.816258F, 0.817143F, - 0.818026F, 0.818908F, 0.819787F, 0.820665F, 0.821540F, 0.822414F, 0.823285F, 0.824155F, - 0.825023F, 0.825889F, 0.826753F, 0.827615F, 0.828475F, 0.829333F, 0.830189F, 0.831043F, - 0.831895F, 0.832746F, 0.833594F, 0.834440F, 0.835285F, 0.836127F, 0.836968F, 0.837806F, - 0.838643F, 0.839477F, 0.840310F, 0.841140F, 0.841969F, 0.842796F, 0.843620F, 0.844443F, - 0.845264F, 0.846082F, 0.846899F, 0.847714F, 0.848526F, 0.849337F, 0.850146F, 0.850953F, - 0.851757F, 0.852560F, 0.853361F, 0.854159F, 0.854956F, 0.855751F, 0.856543F, 0.857334F, - 0.858123F, 0.858909F, 0.859694F, 0.860476F, 0.861257F, 0.862035F, 0.862812F, 0.863586F, - 0.864359F, 0.865129F, 0.865898F, 0.866664F, 0.867428F, 0.868190F, 0.868951F, 0.869709F, - 0.870465F, 0.871219F, 0.871971F, 0.872721F, 0.873469F, 0.874215F, 0.874958F, 0.875700F, - 0.876440F, 0.877177F, 0.877913F, 0.878646F, 0.879378F, 0.880107F, 0.880834F, 0.881559F, - 0.882283F, 0.883004F, 0.883723F, 0.884439F, 0.885154F, 0.885867F, 0.886578F, 0.887286F, - 0.887993F, 0.888697F, 0.889399F, 0.890099F, 0.890797F, 0.891493F, 0.892187F, 0.892879F, - 0.893569F, 0.894256F, 0.894942F, 0.895625F, 0.896307F, 0.896986F, 0.897663F, 0.898338F, - 0.899011F, 0.899681F, 0.900350F, 0.901016F, 0.901681F, 0.902343F, 0.903003F, 0.903661F, - 0.904317F, 0.904971F, 0.905622F, 0.906272F, 0.906919F, 0.907564F, 0.908207F, 0.908848F, - 0.909487F, 0.910124F, 0.910758F, 0.911391F, 0.912021F, 0.912649F, 0.913275F, 0.913899F, - 0.914520F, 0.915140F, 0.915757F, 0.916372F, 0.916985F, 0.917596F, 0.918205F, 0.918811F, - 0.919416F, 0.920018F, 0.920618F, 0.921216F, 0.921812F, 0.922405F, 0.922997F, 0.923586F, - 0.924173F, 0.924758F, 0.925340F, 0.925921F, 0.926499F, 0.927075F, 0.927649F, 0.928221F, - 0.928791F, 0.929358F, 0.929923F, 0.930486F, 0.931047F, 0.931606F, 0.932162F, 0.932716F, - 0.933269F, 0.933818F, 0.934366F, 0.934912F, 0.935455F, 0.935996F, 0.936535F, 0.937072F, - 0.937606F, 0.938138F, 0.938668F, 0.939196F, 0.939722F, 0.940245F, 0.940766F, 0.941285F, - 0.941802F, 0.942317F, 0.942829F, 0.943339F, 0.943847F, 0.944353F, 0.944856F, 0.945358F, - 0.945857F, 0.946353F, 0.946848F, 0.947340F, 0.947830F, 0.948318F, 0.948804F, 0.949287F, - 0.949768F, 0.950247F, 0.950724F, 0.951199F, 0.951671F, 0.952141F, 0.952609F, 0.953074F, - 0.953537F, 0.953998F, 0.954457F, 0.954914F, 0.955368F, 0.955820F, 0.956270F, 0.956717F, - 0.957163F, 0.957606F, 0.958047F, 0.958485F, 0.958921F, 0.959355F, 0.959787F, 0.960217F, - 0.960644F, 0.961069F, 0.961492F, 0.961912F, 0.962330F, 0.962746F, 0.963160F, 0.963571F, - 0.963980F, 0.964387F, 0.964792F, 0.965194F, 0.965594F, 0.965992F, 0.966388F, 0.966781F, - 0.967172F, 0.967560F, 0.967947F, 0.968331F, 0.968713F, 0.969092F, 0.969470F, 0.969845F, - 0.970217F, 0.970588F, 0.970956F, 0.971322F, 0.971685F, 0.972047F, 0.972406F, 0.972762F, - 0.973117F, 0.973469F, 0.973819F, 0.974166F, 0.974512F, 0.974855F, 0.975195F, 0.975534F, - 0.975870F, 0.976204F, 0.976535F, 0.976864F, 0.977191F, 0.977516F, 0.977838F, 0.978158F, - 0.978476F, 0.978791F, 0.979104F, 0.979415F, 0.979724F, 0.980030F, 0.980334F, 0.980635F, - 0.980935F, 0.981232F, 0.981526F, 0.981819F, 0.982109F, 0.982396F, 0.982682F, 0.982965F, - 0.983246F, 0.983524F, 0.983800F, 0.984074F, 0.984346F, 0.984615F, 0.984882F, 0.985146F, - 0.985408F, 0.985668F, 0.985926F, 0.986181F, 0.986434F, 0.986685F, 0.986933F, 0.987179F, - 0.987423F, 0.987664F, 0.987903F, 0.988140F, 0.988374F, 0.988607F, 0.988836F, 0.989064F, - 0.989289F, 0.989511F, 0.989732F, 0.989950F, 0.990166F, 0.990379F, 0.990590F, 0.990799F, - 0.991006F, 0.991210F, 0.991411F, 0.991611F, 0.991808F, 0.992003F, 0.992195F, 0.992385F, - 0.992573F, 0.992759F, 0.992942F, 0.993122F, 0.993301F, 0.993477F, 0.993651F, 0.993822F, - 0.993991F, 0.994158F, 0.994322F, 0.994484F, 0.994644F, 0.994802F, 0.994957F, 0.995109F, - 0.995260F, 0.995408F, 0.995553F, 0.995697F, 0.995838F, 0.995976F, 0.996113F, 0.996247F, - 0.996378F, 0.996507F, 0.996634F, 0.996759F, 0.996881F, 0.997001F, 0.997119F, 0.997234F, - 0.997347F, 0.997457F, 0.997565F, 0.997671F, 0.997774F, 0.997876F, 0.997974F, 0.998071F, - 0.998165F, 0.998257F, 0.998346F, 0.998433F, 0.998518F, 0.998600F, 0.998680F, 0.998758F, - 0.998833F, 0.998906F, 0.998976F, 0.999044F, 0.999110F, 0.999174F, 0.999235F, 0.999294F, - 0.999350F, 0.999404F, 0.999456F, 0.999506F, 0.999553F, 0.999597F, 0.999640F, 0.999680F, - 0.999717F, 0.999753F, 0.999786F, 0.999816F, 0.999844F, 0.999870F, 0.999894F, 0.999915F, - 0.999934F, 0.999950F, 0.999964F, 0.999976F, 0.999986F, 0.999993F, 0.999997F, 1.000000F -} ; - -#ifndef ONLY_SINE_WINDOW - -const float CBlock::m_OnlyLongWindowKBD [1024] = -{ - 0.000293F, 0.000430F, 0.000547F, 0.000655F, 0.000759F, 0.000861F, 0.000962F, 0.001063F, - 0.001165F, 0.001268F, 0.001372F, 0.001478F, 0.001586F, 0.001696F, 0.001807F, 0.001921F, - 0.002037F, 0.002156F, 0.002276F, 0.002400F, 0.002526F, 0.002654F, 0.002785F, 0.002919F, - 0.003056F, 0.003195F, 0.003337F, 0.003483F, 0.003631F, 0.003782F, 0.003936F, 0.004093F, - 0.004253F, 0.004417F, 0.004584F, 0.004754F, 0.004927F, 0.005103F, 0.005283F, 0.005466F, - 0.005653F, 0.005843F, 0.006036F, 0.006234F, 0.006434F, 0.006638F, 0.006846F, 0.007058F, - 0.007273F, 0.007492F, 0.007715F, 0.007942F, 0.008172F, 0.008407F, 0.008645F, 0.008887F, - 0.009133F, 0.009384F, 0.009638F, 0.009896F, 0.010159F, 0.010426F, 0.010697F, 0.010972F, - 0.011252F, 0.011535F, 0.011824F, 0.012116F, 0.012413F, 0.012714F, 0.013020F, 0.013331F, - 0.013646F, 0.013965F, 0.014290F, 0.014619F, 0.014952F, 0.015291F, 0.015634F, 0.015982F, - 0.016334F, 0.016692F, 0.017054F, 0.017422F, 0.017794F, 0.018172F, 0.018554F, 0.018942F, - 0.019334F, 0.019732F, 0.020135F, 0.020544F, 0.020957F, 0.021376F, 0.021800F, 0.022229F, - 0.022664F, 0.023104F, 0.023550F, 0.024001F, 0.024457F, 0.024920F, 0.025387F, 0.025861F, - 0.026340F, 0.026824F, 0.027315F, 0.027811F, 0.028313F, 0.028820F, 0.029334F, 0.029853F, - 0.030378F, 0.030910F, 0.031447F, 0.031990F, 0.032539F, 0.033094F, 0.033655F, 0.034223F, - 0.034796F, 0.035376F, 0.035962F, 0.036554F, 0.037152F, 0.037757F, 0.038367F, 0.038985F, - 0.039608F, 0.040238F, 0.040875F, 0.041517F, 0.042167F, 0.042823F, 0.043485F, 0.044154F, - 0.044829F, 0.045511F, 0.046200F, 0.046896F, 0.047598F, 0.048306F, 0.049022F, 0.049744F, - 0.050473F, 0.051209F, 0.051952F, 0.052702F, 0.053458F, 0.054221F, 0.054992F, 0.055769F, - 0.056553F, 0.057344F, 0.058143F, 0.058948F, 0.059760F, 0.060579F, 0.061406F, 0.062240F, - 0.063080F, 0.063928F, 0.064783F, 0.065646F, 0.066515F, 0.067392F, 0.068276F, 0.069167F, - 0.070066F, 0.070972F, 0.071885F, 0.072806F, 0.073733F, 0.074669F, 0.075611F, 0.076561F, - 0.077519F, 0.078484F, 0.079456F, 0.080436F, 0.081424F, 0.082418F, 0.083421F, 0.084431F, - 0.085448F, 0.086473F, 0.087505F, 0.088545F, 0.089593F, 0.090648F, 0.091711F, 0.092781F, - 0.093859F, 0.094945F, 0.096038F, 0.097139F, 0.098248F, 0.099364F, 0.100488F, 0.101620F, - 0.102759F, 0.103906F, 0.105060F, 0.106223F, 0.107393F, 0.108570F, 0.109756F, 0.110949F, - 0.112150F, 0.113358F, 0.114575F, 0.115799F, 0.117030F, 0.118270F, 0.119517F, 0.120772F, - 0.122034F, 0.123305F, 0.124583F, 0.125869F, 0.127162F, 0.128463F, 0.129772F, 0.131089F, - 0.132413F, 0.133745F, 0.135085F, 0.136433F, 0.137788F, 0.139151F, 0.140521F, 0.141900F, - 0.143285F, 0.144679F, 0.146080F, 0.147489F, 0.148906F, 0.150330F, 0.151761F, 0.153201F, - 0.154648F, 0.156102F, 0.157564F, 0.159034F, 0.160511F, 0.161996F, 0.163488F, 0.164988F, - 0.166496F, 0.168010F, 0.169533F, 0.171062F, 0.172600F, 0.174144F, 0.175696F, 0.177256F, - 0.178822F, 0.180397F, 0.181978F, 0.183567F, 0.185163F, 0.186766F, 0.188377F, 0.189995F, - 0.191620F, 0.193252F, 0.194892F, 0.196539F, 0.198192F, 0.199853F, 0.201521F, 0.203196F, - 0.204878F, 0.206568F, 0.208264F, 0.209967F, 0.211677F, 0.213394F, 0.215118F, 0.216848F, - 0.218586F, 0.220330F, 0.222081F, 0.223839F, 0.225604F, 0.227375F, 0.229153F, 0.230937F, - 0.232729F, 0.234526F, 0.236331F, 0.238141F, 0.239959F, 0.241782F, 0.243612F, 0.245449F, - 0.247291F, 0.249140F, 0.250996F, 0.252857F, 0.254725F, 0.256599F, 0.258479F, 0.260365F, - 0.262257F, 0.264155F, 0.266059F, 0.267969F, 0.269885F, 0.271807F, 0.273735F, 0.275668F, - 0.277607F, 0.279552F, 0.281502F, 0.283458F, 0.285420F, 0.287387F, 0.289360F, 0.291338F, - 0.293321F, 0.295310F, 0.297304F, 0.299303F, 0.301308F, 0.303318F, 0.305332F, 0.307352F, - 0.309377F, 0.311407F, 0.313442F, 0.315482F, 0.317526F, 0.319576F, 0.321630F, 0.323689F, - 0.325752F, 0.327820F, 0.329893F, 0.331970F, 0.334052F, 0.336138F, 0.338228F, 0.340323F, - 0.342421F, 0.344524F, 0.346632F, 0.348743F, 0.350858F, 0.352978F, 0.355101F, 0.357228F, - 0.359359F, 0.361493F, 0.363632F, 0.365774F, 0.367920F, 0.370069F, 0.372221F, 0.374378F, - 0.376537F, 0.378700F, 0.380866F, 0.383035F, 0.385208F, 0.387384F, 0.389562F, 0.391744F, - 0.393928F, 0.396116F, 0.398306F, 0.400499F, 0.402695F, 0.404893F, 0.407094F, 0.409297F, - 0.411503F, 0.413712F, 0.415922F, 0.418135F, 0.420350F, 0.422568F, 0.424787F, 0.427008F, - 0.429232F, 0.431457F, 0.433684F, 0.435913F, 0.438144F, 0.440376F, 0.442611F, 0.444846F, - 0.447083F, 0.449322F, 0.451562F, 0.453803F, 0.456045F, 0.458289F, 0.460533F, 0.462779F, - 0.465026F, 0.467274F, 0.469522F, 0.471772F, 0.474022F, 0.476273F, 0.478524F, 0.480776F, - 0.483029F, 0.485282F, 0.487535F, 0.489789F, 0.492042F, 0.494296F, 0.496551F, 0.498805F, - 0.501059F, 0.503313F, 0.505567F, 0.507821F, 0.510074F, 0.512328F, 0.514580F, 0.516833F, - 0.519085F, 0.521336F, 0.523587F, 0.525837F, 0.528086F, 0.530334F, 0.532582F, 0.534828F, - 0.537073F, 0.539318F, 0.541561F, 0.543803F, 0.546044F, 0.548283F, 0.550522F, 0.552758F, - 0.554993F, 0.557227F, 0.559459F, 0.561689F, 0.563917F, 0.566144F, 0.568368F, 0.570591F, - 0.572812F, 0.575031F, 0.577247F, 0.579461F, 0.581674F, 0.583883F, 0.586091F, 0.588296F, - 0.590498F, 0.592698F, 0.594895F, 0.597090F, 0.599282F, 0.601471F, 0.603657F, 0.605841F, - 0.608021F, 0.610198F, 0.612372F, 0.614543F, 0.616711F, 0.618876F, 0.621037F, 0.623195F, - 0.625350F, 0.627501F, 0.629648F, 0.631792F, 0.633932F, 0.636069F, 0.638202F, 0.640330F, - 0.642456F, 0.644577F, 0.646694F, 0.648807F, 0.650916F, 0.653021F, 0.655121F, 0.657217F, - 0.659310F, 0.661397F, 0.663480F, 0.665559F, 0.667633F, 0.669703F, 0.671768F, 0.673829F, - 0.675884F, 0.677935F, 0.679981F, 0.682023F, 0.684059F, 0.686090F, 0.688116F, 0.690138F, - 0.692154F, 0.694165F, 0.696170F, 0.698171F, 0.700166F, 0.702156F, 0.704140F, 0.706119F, - 0.708093F, 0.710061F, 0.712023F, 0.713980F, 0.715931F, 0.717877F, 0.719816F, 0.721750F, - 0.723678F, 0.725600F, 0.727517F, 0.729427F, 0.731331F, 0.733229F, 0.735122F, 0.737008F, - 0.738888F, 0.740761F, 0.742629F, 0.744490F, 0.746345F, 0.748194F, 0.750036F, 0.751872F, - 0.753701F, 0.755524F, 0.757340F, 0.759150F, 0.760953F, 0.762750F, 0.764540F, 0.766323F, - 0.768099F, 0.769869F, 0.771632F, 0.773389F, 0.775138F, 0.776880F, 0.778616F, 0.780345F, - 0.782066F, 0.783781F, 0.785489F, 0.787189F, 0.788883F, 0.790569F, 0.792249F, 0.793921F, - 0.795586F, 0.797244F, 0.798895F, 0.800538F, 0.802174F, 0.803803F, 0.805425F, 0.807039F, - 0.808646F, 0.810245F, 0.811838F, 0.813422F, 0.815000F, 0.816570F, 0.818132F, 0.819687F, - 0.821234F, 0.822774F, 0.824306F, 0.825831F, 0.827349F, 0.828858F, 0.830360F, 0.831855F, - 0.833342F, 0.834821F, 0.836293F, 0.837757F, 0.839213F, 0.840661F, 0.842102F, 0.843535F, - 0.844961F, 0.846379F, 0.847789F, 0.849191F, 0.850586F, 0.851972F, 0.853351F, 0.854723F, - 0.856086F, 0.857442F, 0.858790F, 0.860130F, 0.861463F, 0.862787F, 0.864104F, 0.865413F, - 0.866714F, 0.868008F, 0.869293F, 0.870571F, 0.871841F, 0.873103F, 0.874358F, 0.875605F, - 0.876843F, 0.878074F, 0.879298F, 0.880513F, 0.881721F, 0.882921F, 0.884113F, 0.885297F, - 0.886474F, 0.887642F, 0.888803F, 0.889957F, 0.891102F, 0.892240F, 0.893370F, 0.894492F, - 0.895607F, 0.896714F, 0.897813F, 0.898905F, 0.899989F, 0.901065F, 0.902133F, 0.903194F, - 0.904248F, 0.905293F, 0.906331F, 0.907362F, 0.908385F, 0.909400F, 0.910408F, 0.911408F, - 0.912401F, 0.913386F, 0.914364F, 0.915334F, 0.916297F, 0.917253F, 0.918201F, 0.919141F, - 0.920074F, 0.921000F, 0.921919F, 0.922830F, 0.923734F, 0.924630F, 0.925519F, 0.926401F, - 0.927276F, 0.928144F, 0.929004F, 0.929858F, 0.930704F, 0.931543F, 0.932375F, 0.933199F, - 0.934017F, 0.934828F, 0.935632F, 0.936429F, 0.937218F, 0.938001F, 0.938777F, 0.939546F, - 0.940309F, 0.941064F, 0.941813F, 0.942555F, 0.943290F, 0.944018F, 0.944740F, 0.945455F, - 0.946164F, 0.946865F, 0.947561F, 0.948249F, 0.948932F, 0.949607F, 0.950277F, 0.950939F, - 0.951596F, 0.952246F, 0.952890F, 0.953527F, 0.954158F, 0.954783F, 0.955401F, 0.956014F, - 0.956620F, 0.957220F, 0.957815F, 0.958403F, 0.958985F, 0.959561F, 0.960131F, 0.960695F, - 0.961253F, 0.961805F, 0.962352F, 0.962892F, 0.963427F, 0.963957F, 0.964480F, 0.964998F, - 0.965510F, 0.966017F, 0.966518F, 0.967014F, 0.967504F, 0.967988F, 0.968467F, 0.968941F, - 0.969410F, 0.969873F, 0.970331F, 0.970783F, 0.971231F, 0.971673F, 0.972110F, 0.972542F, - 0.972969F, 0.973390F, 0.973807F, 0.974219F, 0.974626F, 0.975028F, 0.975425F, 0.975818F, - 0.976205F, 0.976588F, 0.976966F, 0.977340F, 0.977709F, 0.978073F, 0.978432F, 0.978787F, - 0.979138F, 0.979484F, 0.979826F, 0.980163F, 0.980496F, 0.980825F, 0.981149F, 0.981469F, - 0.981785F, 0.982097F, 0.982404F, 0.982708F, 0.983007F, 0.983303F, 0.983594F, 0.983881F, - 0.984165F, 0.984444F, 0.984720F, 0.984992F, 0.985260F, 0.985525F, 0.985785F, 0.986042F, - 0.986296F, 0.986545F, 0.986791F, 0.987034F, 0.987273F, 0.987509F, 0.987741F, 0.987970F, - 0.988195F, 0.988417F, 0.988636F, 0.988851F, 0.989064F, 0.989273F, 0.989479F, 0.989681F, - 0.989881F, 0.990078F, 0.990271F, 0.990462F, 0.990649F, 0.990834F, 0.991016F, 0.991195F, - 0.991371F, 0.991544F, 0.991714F, 0.991882F, 0.992047F, 0.992209F, 0.992369F, 0.992526F, - 0.992680F, 0.992832F, 0.992981F, 0.993128F, 0.993273F, 0.993415F, 0.993554F, 0.993691F, - 0.993826F, 0.993959F, 0.994089F, 0.994217F, 0.994342F, 0.994466F, 0.994587F, 0.994706F, - 0.994823F, 0.994938F, 0.995051F, 0.995162F, 0.995271F, 0.995378F, 0.995483F, 0.995585F, - 0.995687F, 0.995786F, 0.995883F, 0.995978F, 0.996072F, 0.996164F, 0.996254F, 0.996343F, - 0.996429F, 0.996514F, 0.996598F, 0.996680F, 0.996760F, 0.996838F, 0.996915F, 0.996991F, - 0.997065F, 0.997137F, 0.997208F, 0.997278F, 0.997346F, 0.997413F, 0.997478F, 0.997542F, - 0.997605F, 0.997666F, 0.997727F, 0.997785F, 0.997843F, 0.997899F, 0.997954F, 0.998008F, - 0.998061F, 0.998113F, 0.998163F, 0.998213F, 0.998261F, 0.998308F, 0.998354F, 0.998400F, - 0.998444F, 0.998487F, 0.998529F, 0.998570F, 0.998610F, 0.998650F, 0.998688F, 0.998725F, - 0.998762F, 0.998798F, 0.998833F, 0.998867F, 0.998900F, 0.998932F, 0.998964F, 0.998995F, - 0.999025F, 0.999054F, 0.999083F, 0.999111F, 0.999138F, 0.999164F, 0.999190F, 0.999215F, - 0.999240F, 0.999264F, 0.999287F, 0.999310F, 0.999332F, 0.999353F, 0.999374F, 0.999394F, - 0.999414F, 0.999434F, 0.999452F, 0.999470F, 0.999488F, 0.999505F, 0.999522F, 0.999538F, - 0.999554F, 0.999570F, 0.999585F, 0.999599F, 0.999613F, 0.999627F, 0.999640F, 0.999653F, - 0.999666F, 0.999678F, 0.999689F, 0.999701F, 0.999712F, 0.999723F, 0.999733F, 0.999743F, - 0.999753F, 0.999762F, 0.999772F, 0.999780F, 0.999789F, 0.999797F, 0.999805F, 0.999813F, - 0.999821F, 0.999828F, 0.999835F, 0.999842F, 0.999848F, 0.999855F, 0.999861F, 0.999867F, - 0.999872F, 0.999878F, 0.999883F, 0.999888F, 0.999893F, 0.999898F, 0.999902F, 0.999907F, - 0.999911F, 0.999915F, 0.999919F, 0.999923F, 0.999927F, 0.999930F, 0.999933F, 0.999937F, - 0.999940F, 0.999943F, 0.999946F, 0.999948F, 0.999951F, 0.999954F, 0.999956F, 0.999958F, - 0.999960F, 0.999963F, 0.999965F, 0.999967F, 0.999968F, 0.999970F, 0.999972F, 0.999974F, - 0.999975F, 0.999977F, 0.999978F, 0.999979F, 0.999981F, 0.999982F, 0.999983F, 0.999984F, - 0.999985F, 0.999986F, 0.999987F, 0.999988F, 0.999989F, 0.999990F, 0.999990F, 0.999991F, - 0.999992F, 0.999992F, 0.999993F, 0.999993F, 0.999994F, 0.999994F, 0.999995F, 0.999995F, - 0.999996F, 0.999996F, 0.999996F, 0.999997F, 0.999997F, 0.999997F, 0.999998F, 0.999998F, - 0.999998F, 0.999998F, 0.999999F, 0.999999F, 0.999999F, 0.999999F, 0.999999F, 0.999999F, - 0.999999F, 1.000000F, 1.000000F, 1.000000F, 1.000000F, 1.000000F, 1.000000F, 1.000000F, -} ; - -#endif - -const float CBlock::m_OnlyShortWindowSine [128] = -{ - 0.006136F, 0.018407F, 0.030675F, 0.042938F, 0.055195F, 0.067444F, 0.079682F, 0.091909F, - 0.104122F, 0.116319F, 0.128498F, 0.140658F, 0.152797F, 0.164913F, 0.177004F, 0.189069F, - 0.201105F, 0.213110F, 0.225084F, 0.237024F, 0.248928F, 0.260794F, 0.272621F, 0.284408F, - 0.296151F, 0.307850F, 0.319502F, 0.331106F, 0.342661F, 0.354164F, 0.365613F, 0.377007F, - 0.388345F, 0.399624F, 0.410843F, 0.422000F, 0.433094F, 0.444122F, 0.455084F, 0.465977F, - 0.476799F, 0.487550F, 0.498228F, 0.508830F, 0.519356F, 0.529804F, 0.540172F, 0.550458F, - 0.560662F, 0.570781F, 0.580814F, 0.590760F, 0.600617F, 0.610383F, 0.620057F, 0.629638F, - 0.639124F, 0.648514F, 0.657807F, 0.667000F, 0.676093F, 0.685084F, 0.693971F, 0.702755F, - 0.711432F, 0.720003F, 0.728464F, 0.736817F, 0.745058F, 0.753187F, 0.761202F, 0.769103F, - 0.776888F, 0.784557F, 0.792107F, 0.799537F, 0.806848F, 0.814036F, 0.821103F, 0.828045F, - 0.834863F, 0.841555F, 0.848120F, 0.854558F, 0.860867F, 0.867046F, 0.873095F, 0.879012F, - 0.884797F, 0.890449F, 0.895966F, 0.901349F, 0.906596F, 0.911706F, 0.916679F, 0.921514F, - 0.926210F, 0.930767F, 0.935184F, 0.939459F, 0.943593F, 0.947586F, 0.951435F, 0.955141F, - 0.958703F, 0.962121F, 0.965394F, 0.968522F, 0.971504F, 0.974339F, 0.977028F, 0.979570F, - 0.981964F, 0.984210F, 0.986308F, 0.988258F, 0.990058F, 0.991710F, 0.993212F, 0.994565F, - 0.995767F, 0.996820F, 0.997723F, 0.998476F, 0.999078F, 0.999529F, 0.999831F, 0.999981F -} ; - -#ifndef ONLY_SINE_WINDOW - -const float CBlock::m_OnlyShortWindowKBD [128] = -{ - 0.000044F, 0.000119F, 0.000231F, 0.000389F, 0.000606F, 0.000892F, 0.001262F, 0.001730F, - 0.002314F, 0.003031F, 0.003902F, 0.004947F, 0.006189F, 0.007651F, 0.009360F, 0.011340F, - 0.013620F, 0.016227F, 0.019190F, 0.022539F, 0.026303F, 0.030512F, 0.035195F, 0.040381F, - 0.046099F, 0.052375F, 0.059236F, 0.066706F, 0.074808F, 0.083563F, 0.092988F, 0.103099F, - 0.113909F, 0.125427F, 0.137659F, 0.150608F, 0.164272F, 0.178647F, 0.193722F, 0.209486F, - 0.225920F, 0.243003F, 0.260711F, 0.279012F, 0.297874F, 0.317259F, 0.337126F, 0.357432F, - 0.378127F, 0.399163F, 0.420486F, 0.442041F, 0.463771F, 0.485618F, 0.507521F, 0.529420F, - 0.551256F, 0.572968F, 0.594497F, 0.615784F, 0.636772F, 0.657406F, 0.677634F, 0.697406F, - 0.716676F, 0.735399F, 0.753536F, 0.771052F, 0.787915F, 0.804098F, 0.819577F, 0.834336F, - 0.848360F, 0.861640F, 0.874171F, 0.885955F, 0.896995F, 0.907299F, 0.916880F, 0.925754F, - 0.933939F, 0.941459F, 0.948339F, 0.954605F, 0.960288F, 0.965417F, 0.970025F, 0.974146F, - 0.977812F, 0.981056F, 0.983913F, 0.986415F, 0.988594F, 0.990480F, 0.992103F, 0.993491F, - 0.994671F, 0.995667F, 0.996503F, 0.997198F, 0.997773F, 0.998244F, 0.998627F, 0.998937F, - 0.999184F, 0.999380F, 0.999534F, 0.999654F, 0.999746F, 0.999816F, 0.999868F, 0.999907F, - 0.999936F, 0.999956F, 0.999971F, 0.999981F, 0.999988F, 0.999992F, 0.999995F, 0.999997F, - 0.999999F, 0.999999F, 1.000000F, 1.000000F, 1.000000F, 1.000000F, 1.000000F, 1.000000F, -} ; - -#endif diff --git a/Src/vlb/tns.cpp b/Src/vlb/tns.cpp deleted file mode 100644 index 74ce870fc..000000000 --- a/Src/vlb/tns.cpp +++ /dev/null @@ -1,214 +0,0 @@ -/* $Header: /cvs/root/winamp/vlb/tns.cpp,v 1.1 2009/04/28 20:21:11 audiodsp Exp $ */ - -/***************************************************************************\ - * - * Copyright 2000-2002 Dolby Laboratories, Inc. All Rights - * Reserved. Do not copy. Do not distribute. - * Confidential information. - * - * (C) copyright Fraunhofer - IIS (1998) - * All Rights Reserved - * - * filename: tns.cpp - * project : MPEG-2 AAC Decoder - * contents/description: temporal noise shaping - * -\***************************************************************************/ - -#include - -#include "tns.h" -#include "channelinfo.h" -#include "block.h" - -CTns::CTns () - : m_TnsDataPresent (1) -{ -} - -CTns::~CTns () -{ -} - -void CTns::Read (const CChannelInfo &info, CDolbyBitStream &bs) -{ - m_TnsDataPresent.Read (bs) ; - if (!m_TnsDataPresent) return ; - - CVLBBitSequence n_filt (info.IsLongBlock () ? 2 : 1) ; - CVLBBitSequence length (info.IsLongBlock () ? 6 : 4) ; - CVLBBitSequence order (info.IsLongBlock () ? 5 : 3) ; - - CVLBBitSequence direction (1) ; - CVLBBitSequence coef_compress (1) ; - CVLBBitSequence coef_res (1) ; - - for (int window = 0 ; window < info.GetWindowsPerFrame () ; window++) - { - m_NumberOfFilters [window] = n_filt.Read (bs) ; - - if (n_filt) - { - coef_res.Read (bs) ; - - int nextstopband = info.GetScaleFactorBandsTotal () ; - - for (int index = 0 ; index < n_filt ; index++) - { - CFilter &filter = m_Filter [window][index] ; - - length.Read (bs) ; - - filter.m_StartBand = nextstopband - length ; - filter.m_StopBand = nextstopband ; - - nextstopband = filter.m_StartBand ; - - filter.m_Order = order.Read (bs) ; - - if (order) - { - filter.m_Direction = direction.Read (bs) ? -1 : 1 ; - - coef_compress.Read (bs) ; - - filter.m_Resolution = coef_res + 3 ; - - static const int sgn_mask [] = { 0x2, 0x4, 0x8 } ; - static const int neg_mask [] = { ~0x3, ~0x7, ~0xF } ; - - int s_mask = sgn_mask [coef_res + 1 - coef_compress] ; - int n_mask = neg_mask [coef_res + 1 - coef_compress] ; - - for (int i = 0 ; i < order ; i++) - { - CVLBBitSequence coef (filter.m_Resolution - coef_compress) ; - coef.Read (bs) ; - - filter.m_Coeff [i] = ((int) coef & s_mask) ? ((int) coef | n_mask) : (int) coef ; - } - } - } - } - } -} - -void CTns::Apply (const CChannelInfo &info, CBlock &spectrum) -{ - if (!m_TnsDataPresent) return ; - - float CoeffLPC [MaximumOrder + 1] ; - - for (int window = 0 ; window < info.GetWindowsPerFrame () ; window++) - { - for (int index = 0 ; index < m_NumberOfFilters [window] ; index++) - { - CFilter &filter = m_Filter [window][index] ; - - DecodeCoefficients (filter, CoeffLPC) ; - - int start = Minimum (filter.m_StartBand, info.GetMaximumTnsBands (), - info.GetScaleFactorBandsTransmitted ()) ; - - start = info.GetScaleFactorBandOffsets () [start] ; - - int stop = Minimum (filter.m_StopBand, info.GetMaximumTnsBands (), - info.GetScaleFactorBandsTransmitted ()) ; - - stop = info.GetScaleFactorBandOffsets () [stop] ; - - int size = stop - start ; - - if (size <= 0) continue ; - - Filter (&spectrum.AccessSpectralData (window) [start], size, - filter.m_Direction, CoeffLPC, filter.m_Order) ; - } - } -} - -void CTns::DecodeCoefficients (CFilter &filter, float *a) -{ - float tmp [MaximumOrder + 1], b [MaximumOrder + 1] ; - - // Inverse quantization - - const float pi2 = 3.14159265358979323846F / 2.0F ; - - float iqfac = ((1 << (filter.m_Resolution - 1)) - 0.5F) / pi2 ; - float iqfac_m = ((1 << (filter.m_Resolution - 1)) + 0.5F) / pi2 ; - - int i ; - - for (i = 0 ; i < filter.m_Order ; i++) - { - tmp [i + 1] = (float) sin (filter.m_Coeff [i] / ((filter.m_Coeff [i] >= 0) ? iqfac : iqfac_m)) ; - } - - // Conversion to LPC coefficients - Markel and Gray, pg. 95 - - a [0] = 1.0F ; - - for (int m = 1 ; m <= filter.m_Order ; m++) - { - b [0] = a [0] ; - - for (i = 1 ; i < m ; i++) - { - b [i] = a [i] + tmp [m] * a [m - i] ; - } - - b [m] = tmp [m] ; - - for (i = 0 ; i <= m ; i++) - { - a [i] = b [i] ; - } - } -} - -void CTns::Filter (float *spec, int size, int inc, float *lpc, int order) -{ - // - Simple all-pole filter of order "order" defined by - // y(n) = x(n) - a(2)*y(n-1) - ... - a(order+1)*y(n-order) - // - // - The state variables of the filter are initialized to zero every time - // - // - The output data is written over the input data ("in-place operation") - // - // - An input vector of "size" samples is processed and the index increment - // to the next data sample is given by "inc" - - int i, j; - float y, state [MaximumOrder] ; - - for (i = 0 ; i < order ; i++) - { - state [i] = 0.0F ; - } - - if (inc == -1) - { - spec += size - 1 ; - } - - for (i = 0 ; i < size ; i++) - { - y = *spec; - - for (j = 0 ; j < order ; j++) - { - y -= lpc [j + 1] * state [j] ; - } - - for (j = order - 1 ; j > 0 ; j--) - { - state [j] = state [j - 1] ; - } - - state [0] = y ; - *spec = y ; - spec += inc ; - } -} - diff --git a/Src/vlb/tns.h b/Src/vlb/tns.h deleted file mode 100644 index 8cf129e4c..000000000 --- a/Src/vlb/tns.h +++ /dev/null @@ -1,86 +0,0 @@ -/* $Header: /cvs/root/winamp/vlb/tns.h,v 1.1 2009/04/28 20:21:11 audiodsp Exp $ */ - -/***************************************************************************\ - * - * Copyright 2000-2002 Dolby Laboratories, Inc. All Rights - * Reserved. Do not copy. Do not distribute. - * Confidential information. - * - * (C) copyright Fraunhofer - IIS (1998) - * All Rights Reserved - * - * filename: tns.h - * project : MPEG-2 AAC Decoder - * contents/description: temporal noise shaping - * -\***************************************************************************/ - -#ifndef __TNS_H__ -#define __TNS_H__ - -#include "bitsequence.h" - -class CChannelInfo ; -class CBlock ; - -/** Temporal Noise Shaping. - - This class represents the temporal noise shaping tool for decoding and - applying tns filter data to the spectral coefficients of the current block. - - TNS is a profile-dependent tool and the CTns implementation follows the - Read()/Apply() convention used for all tools. -*/ - -class CTns -{ -public : - - CTns () ; - ~CTns () ; - - void Read (const CChannelInfo &info, CDolbyBitStream &bs) ; - void Apply (const CChannelInfo &info, CBlock &spectrum) ; - - enum - { - MaximumWindows = 8, - MaximumBands = 49, - MaximumOrder = 31, - MaximumFilters = 3 - } ; - -protected : - - CVLBBitSequence m_TnsDataPresent ; - - class CFilter - { - public : - - int m_StartBand ; - int m_StopBand ; - - int m_Direction ; - int m_Resolution ; - - int m_Order ; - int m_Coeff [MaximumOrder] ; - - } ; - - int m_NumberOfFilters [MaximumWindows] ; - CFilter m_Filter [MaximumWindows][MaximumFilters] ; - - int Minimum (int a, int b, int c) - { - int t = (a < b ) ? a : b ; - return (t < c) ? t : c ; - } - - void DecodeCoefficients (CFilter &filter, float *a) ; - void Filter (float *spec, int size, int inc, float *lpc, int order) ; - -} ; - -#endif diff --git a/Src/vlb/version.rc2 b/Src/vlb/version.rc2 deleted file mode 100644 index 4dcae9856..000000000 --- a/Src/vlb/version.rc2 +++ /dev/null @@ -1,39 +0,0 @@ - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// -#include "../Winamp/buildType.h" -VS_VERSION_INFO VERSIONINFO - FILEVERSION WINAMP_PRODUCTVER - PRODUCTVERSION WINAMP_PRODUCTVER - FILEFLAGSMASK 0x17L -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "CompanyName", "Winamp SA" - VALUE "FileDescription", "Winamp 5.x System Component" - VALUE "FileVersion", STR_WINAMP_PRODUCTVER - VALUE "InternalName", "vlb.w5s" - VALUE "LegalCopyright", "Copyright © 2005-2023 Winamp SA" - VALUE "LegalTrademarks", "Nullsoft and Winamp are trademarks of Winamp SA" - VALUE "OriginalFilename", "vlb.w5s" - VALUE "ProductName", "Winamp VLB Decoder Service" - VALUE "ProductVersion", STR_WINAMP_PRODUCTVER - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END diff --git a/Src/vlb/vlb.rc b/Src/vlb/vlb.rc deleted file mode 100644 index 6f94f9269..000000000 --- a/Src/vlb/vlb.rc +++ /dev/null @@ -1,76 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource1.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// English (U.K.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource1.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "#include ""version.rc2""\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - -#endif // English (U.K.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// -#include "version.rc2" - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/Src/vlb/vlb.sln b/Src/vlb/vlb.sln deleted file mode 100644 index 5334d7f50..000000000 --- a/Src/vlb/vlb.sln +++ /dev/null @@ -1,30 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29424.173 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vlb", "vlb.vcxproj", "{2E7AB185-8E16-4458-BF5A-853B6619CC3B}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {2E7AB185-8E16-4458-BF5A-853B6619CC3B}.Debug|Win32.ActiveCfg = Debug|Win32 - {2E7AB185-8E16-4458-BF5A-853B6619CC3B}.Debug|Win32.Build.0 = Debug|Win32 - {2E7AB185-8E16-4458-BF5A-853B6619CC3B}.Debug|x64.ActiveCfg = Debug|x64 - {2E7AB185-8E16-4458-BF5A-853B6619CC3B}.Debug|x64.Build.0 = Debug|x64 - {2E7AB185-8E16-4458-BF5A-853B6619CC3B}.Release|Win32.ActiveCfg = Release|Win32 - {2E7AB185-8E16-4458-BF5A-853B6619CC3B}.Release|Win32.Build.0 = Release|Win32 - {2E7AB185-8E16-4458-BF5A-853B6619CC3B}.Release|x64.ActiveCfg = Release|x64 - {2E7AB185-8E16-4458-BF5A-853B6619CC3B}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {74224C5F-B8F5-4611-AA1F-A0CD1F71234B} - EndGlobalSection -EndGlobal diff --git a/Src/vlb/vlb.vcxproj b/Src/vlb/vlb.vcxproj deleted file mode 100644 index eb063a52f..000000000 --- a/Src/vlb/vlb.vcxproj +++ /dev/null @@ -1,324 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {2E7AB185-8E16-4458-BF5A-853B6619CC3B} - vlb - 10.0.19041.0 - - - - DynamicLibrary - v142 - Unicode - - - DynamicLibrary - v142 - Unicode - - - DynamicLibrary - v142 - Unicode - - - DynamicLibrary - v142 - Unicode - - - - - - - - - - - - - - - - - - - false - $(PlatformShortName)_$(Configuration)\ - $(PlatformShortName)_$(Configuration)\ - .w5s - $(IncludePath) - $(LibraryPath) - - - false - $(PlatformShortName)_$(Configuration)\ - $(PlatformShortName)_$(Configuration)\ - .w5s - - - false - $(PlatformShortName)_$(Configuration)\ - $(PlatformShortName)_$(Configuration)\ - .w5s - $(IncludePath) - $(LibraryPath) - - - false - $(PlatformShortName)_$(Configuration)\ - $(PlatformShortName)_$(Configuration)\ - .w5s - - - Debug - x86-windows-static-md - - - x86-windows-static-md - Debug - - - x86-windows-static-md - - - x86-windows-static-md - - - - Disabled - ../Wasabi;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - false - true - EnableFastChecks - MultiThreadedDebugDLL - true - true - Level3 - ProgramDatabase - $(IntDir)$(TargetName).pdb - - - $(OutDir)$(TargetName)$(TargetExt) - false - $(ProjectDir)x86_Debug\$(ProjectName).lib - Windows - MachineX86 - false - %(AdditionalLibraryDirectories) - $(IntDir)$(TargetName).pdb - true - - - xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System\ -xcopy /Y /D $(IntDir)$(TargetName).pdb ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System\ - Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System\' - - - - - Disabled - ../Wasabi;%(AdditionalIncludeDirectories) - WIN64;_DEBUG;_LIB;%(PreprocessorDefinitions) - false - true - EnableFastChecks - MultiThreadedDebugDLL - true - true - Level3 - ProgramDatabase - $(IntDir)$(TargetName).pdb - - - $(OutDir)$(TargetName)$(TargetExt) - false - $(ProjectDir)x64_Debug\$(ProjectName).lib - Windows - false - %(AdditionalLibraryDirectories) - $(IntDir)$(TargetName).pdb - - - xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System\ -xcopy /Y /D $(IntDir)$(TargetName).pdb ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System\ - Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System\' - - - - - MinSpace - AnySuitable - true - Size - true - ../Wasabi;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - MultiThreadedDLL - true - true - true - true - Level3 - None - $(IntDir)$(TargetName).pdb - - - $(OutDir)$(TargetName)$(TargetExt) - true - true - false - $(ProjectDir)x86_Release\$(ProjectName).lib - MachineX86 - Windows - false - false - %(AdditionalLibraryDirectories) - $(IntDir)$(TargetName).pdb - - - xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System\ - Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System\' - - - - - MinSpace - AnySuitable - true - Size - true - ../Wasabi;%(AdditionalIncludeDirectories) - WIN64;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - MultiThreadedDLL - true - true - true - true - Level3 - None - $(IntDir)$(TargetName).pdb - - - $(OutDir)$(TargetName)$(TargetExt) - true - true - false - $(ProjectDir)x64_Release\$(ProjectName).lib - Windows - false - false - %(AdditionalLibraryDirectories) - $(IntDir)$(TargetName).pdb - - - xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System\ - Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System\' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {3e0bfa8a-b86a-42e9-a33f-ec294f823f7f} - - - - - - \ No newline at end of file diff --git a/Src/vlb/vlb.vcxproj.filters b/Src/vlb/vlb.vcxproj.filters deleted file mode 100644 index 507043e85..000000000 --- a/Src/vlb/vlb.vcxproj.filters +++ /dev/null @@ -1,224 +0,0 @@ - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source 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 - - - 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 - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - {2b3efc06-1046-47a4-956e-af652b688c1f} - - - {0398d98a-dea2-4fea-bf3b-abb9658ea82f} - - - {21521068-58d4-46cd-91ed-25876514b0f0} - - - - - Ressource Files - - - \ No newline at end of file diff --git a/Src/vlb/vlbout.h b/Src/vlb/vlbout.h deleted file mode 100644 index fdcd4fa3a..000000000 --- a/Src/vlb/vlbout.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once -#define BUFSIZE 16384 -#define OBUFSIZE 65536 -#include "audio_io.h" -class VLBOut : public AudioIOControl { -public: - VLBOut() { size = pos = 0; } - virtual ~VLBOut() { } - virtual int IO( float **, int ); - virtual int SetFormatInfo( AUDIO_FORMATINFO *info ) { format = *info; return AUDIO_ERROR_NONE; } - AUDIO_FORMATINFO GetFormatInfo() { return format; } - - int BytesAvail() { return size; } - virtual void PullBytes( unsigned char *buf, int nbytes ); - void Empty(){ size = 0; } -private: - unsigned char data[OBUFSIZE]; - int size,pos; - AUDIO_FORMATINFO format; -}; diff --git a/Src/vlb/w5s.cpp b/Src/vlb/w5s.cpp deleted file mode 100644 index 0666dfa09..000000000 --- a/Src/vlb/w5s.cpp +++ /dev/null @@ -1,78 +0,0 @@ -#include "factory_vlbDecoder.h" -#include "factory_nsvVlb.h" -#include "api__vlb.h" -#include - -#include "../Agave/Component/ifc_wa5component.h" - -class VLBComponent : public ifc_wa5component -{ -public: - void RegisterServices(api_service *service); - int RegisterServicesSafeModeOk(); - void DeregisterServices(api_service *service); -protected: - RECVS_DISPATCH; -}; - -template -void ServiceBuild(api_T *&api_t, GUID factoryGUID_t) -{ - if (WASABI_API_SVC) - { - waServiceFactory *factory = WASABI_API_SVC->service_getServiceByGuid(factoryGUID_t); - if (factory) - api_t = reinterpret_cast( factory->getInterface() ); - } -} - -template -void ServiceRelease(api_T *api_t, GUID factoryGUID_t) -{ - if (WASABI_API_SVC && api_t) - { - waServiceFactory *factory = WASABI_API_SVC->service_getServiceByGuid(factoryGUID_t); - if (factory) - factory->releaseInterface(api_t); - } - api_t = NULL; -} - -VLBDecoderFactory vlbDecoderFactory; -NSVVLBFactory nsvDecoderFactory; -VLBComponent vlbComponent; -api_service *WASABI_API_SVC=0; -api_memmgr *WASABI_API_MEMMGR = 0; - -void VLBComponent::RegisterServices(api_service *service) -{ - WASABI_API_SVC = service; - WASABI_API_SVC->service_register(&vlbDecoderFactory); - WASABI_API_SVC->service_register(&nsvDecoderFactory); - ServiceBuild(WASABI_API_MEMMGR, memMgrApiServiceGuid); -} - -int VLBComponent::RegisterServicesSafeModeOk() -{ - return 1; -} - -void VLBComponent::DeregisterServices(api_service *service) -{ - service->service_deregister(&vlbDecoderFactory); - service->service_deregister(&nsvDecoderFactory); - ServiceRelease(WASABI_API_MEMMGR, memMgrApiServiceGuid); -} - -extern "C" DLLEXPORT ifc_wa5component *GetWinamp5SystemComponent() -{ - return &vlbComponent; -} - -#define CBCLASS VLBComponent -START_DISPATCH; -VCB(API_WA5COMPONENT_REGISTERSERVICES, RegisterServices) -CB(15, RegisterServicesSafeModeOk) -VCB(API_WA5COMPONENT_DEREEGISTERSERVICES, DeregisterServices) -END_DISPATCH; -#undef CBCLASS diff --git a/Src/vlb/window_tab.h b/Src/vlb/window_tab.h deleted file mode 100644 index 5446f3553..000000000 --- a/Src/vlb/window_tab.h +++ /dev/null @@ -1,2336 +0,0 @@ -/* $Header: /cvs/root/winamp/vlb/window_tab.h,v 1.1 2009/04/28 20:21:11 audiodsp Exp $ */ - -/***************************************************************************\ - * - * Copyright 2000-2002 Dolby Laboratories, Inc. All Rights - * Reserved. Do not copy. Do not distribute. - * Confidential information. - * - * filename: window_tab.h - * project : MPEG-2 AAC Professional Encoder - * contents/description: Dolby long and short half-window definitions - * -\***************************************************************************/ - -#ifndef __WINDOW_TAB_H -#define __WINDOW_TAB_H - -static double KBD_long[] = { /* GRANULE_LEN = 1024 */ - 0.00029256153896361, - 0.00042998567353047, - 0.00054674074589540, - 0.00065482304299792, - 0.00075870195068747, - 0.00086059331713336, - 0.00096177541439010, - 0.0010630609410878, - 0.0011650036308132, - 0.0012680012194148, - 0.0013723517232956, - 0.0014782864109136, - 0.0015859901976719, - 0.0016956148252373, - 0.0018072876903517, - 0.0019211179405514, - 0.0020372007924215, - 0.0021556206591754, - 0.0022764534599614, - 0.0023997683540995, - 0.0025256290631156, - 0.0026540948920831, - 0.0027852215281403, - 0.0029190616715331, - 0.0030556655443223, - 0.0031950812943391, - 0.0033373553240392, - 0.0034825325586930, - 0.0036306566699199, - 0.0037817702604646, - 0.0039359150179719, - 0.0040931318437260, - 0.0042534609610026, - 0.0044169420066964, - 0.0045836141091341, - 0.0047535159544086, - 0.0049266858431214, - 0.0051031617390698, - 0.0052829813111335, - 0.0054661819693975, - 0.0056528008963682, - 0.0058428750739943, - 0.0060364413070882, - 0.0062335362436492, - 0.0064341963925079, - 0.0066384581386503, - 0.0068463577565218, - 0.0070579314215715, - 0.0072732152202559, - 0.0074922451586909, - 0.0077150571701162, - 0.0079416871213115, - 0.0081721708180857, - 0.0084065440099458, - 0.0086448423940363, - 0.0088871016184291, - 0.0091333572848345, - 0.0093836449507939, - 0.0096380001314086, - 0.0098964583006517, - 0.010159054892306, - 0.010425825300561, - 0.010696804880310, - 0.010972028947167, - 0.011251532777236, - 0.011535351606646, - 0.011823520630897, - 0.012116075003993, - 0.012413049837429, - 0.012714480198999, - 0.013020401111478, - 0.013330847551161, - 0.013645854446288, - 0.013965456675352, - 0.014289689065314, - 0.014618586389712, - 0.014952183366697, - 0.015290514656976, - 0.015633614861688, - 0.015981518520214, - 0.016334260107915, - 0.016691874033817, - 0.017054394638241, - 0.017421856190380, - 0.017794292885832, - 0.018171738844085, - 0.018554228105962, - 0.018941794631032, - 0.019334472294980, - 0.019732294886947, - 0.020135296106839, - 0.020543509562604, - 0.020956968767488, - 0.021375707137257, - 0.021799757987407, - 0.022229154530343, - 0.022663929872540, - 0.023104117011689, - 0.023549748833816, - 0.024000858110398, - 0.024457477495451, - 0.024919639522613, - 0.025387376602207, - 0.025860721018295, - 0.026339704925726, - 0.026824360347160, - 0.027314719170100, - 0.027810813143900, - 0.028312673876775, - 0.028820332832801, - 0.029333821328905, - 0.029853170531859, - 0.030378411455255, - 0.030909574956490, - 0.031446691733739, - 0.031989792322926, - 0.032538907094693, - 0.033094066251369, - 0.033655299823935, - 0.034222637668991, - 0.034796109465717, - 0.035375744712844, - 0.035961572725616, - 0.036553622632758, - 0.037151923373446, - 0.037756503694277, - 0.038367392146243, - 0.038984617081711, - 0.039608206651398, - 0.040238188801359, - 0.040874591269976, - 0.041517441584950, - 0.042166767060301, - 0.042822594793376, - 0.043484951661852, - 0.044153864320760, - 0.044829359199509, - 0.045511462498913, - 0.046200200188234, - 0.046895598002228, - 0.047597681438201, - 0.048306475753074, - 0.049022005960455, - 0.049744296827725, - 0.050473372873129, - 0.051209258362879, - 0.051951977308273, - 0.052701553462813, - 0.053458010319350, - 0.054221371107223, - 0.054991658789428, - 0.055768896059787, - 0.056553105340134, - 0.057344308777513, - 0.058142528241393, - 0.058947785320893, - 0.059760101322019, - 0.060579497264926, - 0.061405993881180, - 0.062239611611049, - 0.063080370600799, - 0.063928290700012, - 0.064783391458919, - 0.065645692125747, - 0.066515211644086, - 0.067391968650269, - 0.068275981470777, - 0.069167268119652, - 0.070065846295935, - 0.070971733381121, - 0.071884946436630, - 0.072805502201299, - 0.073733417088896, - 0.074668707185649, - 0.075611388247794, - 0.076561475699152, - 0.077518984628715, - 0.078483929788261, - 0.079456325589986, - 0.080436186104162, - 0.081423525056808, - 0.082418355827392, - 0.083420691446553, - 0.084430544593841, - 0.085447927595483, - 0.086472852422178, - 0.087505330686900, - 0.088545373642744, - 0.089592992180780, - 0.090648196827937, - 0.091710997744919, - 0.092781404724131, - 0.093859427187640, - 0.094945074185163, - 0.096038354392069, - 0.097139276107423, - 0.098247847252041, - 0.099364075366580, - 0.10048796760965, - 0.10161953075597, - 0.10275877119451, - 0.10390569492671, - 0.10506030756469, - 0.10622261432949, - 0.10739262004941, - 0.10857032915821, - 0.10975574569357, - 0.11094887329534, - 0.11214971520402, - 0.11335827425914, - 0.11457455289772, - 0.11579855315274, - 0.11703027665170, - 0.11826972461510, - 0.11951689785504, - 0.12077179677383, - 0.12203442136263, - 0.12330477120008, - 0.12458284545102, - 0.12586864286523, - 0.12716216177615, - 0.12846340009971, - 0.12977235533312, - 0.13108902455375, - 0.13241340441801, - 0.13374549116025, - 0.13508528059173, - 0.13643276809961, - 0.13778794864595, - 0.13915081676677, - 0.14052136657114, - 0.14189959174027, - 0.14328548552671, - 0.14467904075349, - 0.14608024981336, - 0.14748910466804, - 0.14890559684750, - 0.15032971744929, - 0.15176145713790, - 0.15320080614414, - 0.15464775426459, - 0.15610229086100, - 0.15756440485987, - 0.15903408475193, - 0.16051131859170, - 0.16199609399712, - 0.16348839814917, - 0.16498821779156, - 0.16649553923042, - 0.16801034833404, - 0.16953263053270, - 0.17106237081842, - 0.17259955374484, - 0.17414416342714, - 0.17569618354193, - 0.17725559732720, - 0.17882238758238, - 0.18039653666830, - 0.18197802650733, - 0.18356683858343, - 0.18516295394233, - 0.18676635319174, - 0.18837701650148, - 0.18999492360384, - 0.19162005379380, - 0.19325238592940, - 0.19489189843209, - 0.19653856928714, - 0.19819237604409, - 0.19985329581721, - 0.20152130528605, - 0.20319638069594, - 0.20487849785865, - 0.20656763215298, - 0.20826375852540, - 0.20996685149083, - 0.21167688513330, - 0.21339383310678, - 0.21511766863598, - 0.21684836451719, - 0.21858589311922, - 0.22033022638425, - 0.22208133582887, - 0.22383919254503, - 0.22560376720111, - 0.22737503004300, - 0.22915295089517, - 0.23093749916189, - 0.23272864382838, - 0.23452635346201, - 0.23633059621364, - 0.23814133981883, - 0.23995855159925, - 0.24178219846403, - 0.24361224691114, - 0.24544866302890, - 0.24729141249740, - 0.24914046059007, - 0.25099577217522, - 0.25285731171763, - 0.25472504328019, - 0.25659893052556, - 0.25847893671788, - 0.26036502472451, - 0.26225715701781, - 0.26415529567692, - 0.26605940238966, - 0.26796943845439, - 0.26988536478190, - 0.27180714189742, - 0.27373472994256, - 0.27566808867736, - 0.27760717748238, - 0.27955195536071, - 0.28150238094021, - 0.28345841247557, - 0.28542000785059, - 0.28738712458038, - 0.28935971981364, - 0.29133775033492, - 0.29332117256704, - 0.29530994257338, - 0.29730401606034, - 0.29930334837974, - 0.30130789453132, - 0.30331760916521, - 0.30533244658452, - 0.30735236074785, - 0.30937730527195, - 0.31140723343430, - 0.31344209817583, - 0.31548185210356, - 0.31752644749341, - 0.31957583629288, - 0.32162997012390, - 0.32368880028565, - 0.32575227775738, - 0.32782035320134, - 0.32989297696566, - 0.33197009908736, - 0.33405166929523, - 0.33613763701295, - 0.33822795136203, - 0.34032256116495, - 0.34242141494820, - 0.34452446094547, - 0.34663164710072, - 0.34874292107143, - 0.35085823023181, - 0.35297752167598, - 0.35510074222129, - 0.35722783841160, - 0.35935875652060, - 0.36149344255514, - 0.36363184225864, - 0.36577390111444, - 0.36791956434930, - 0.37006877693676, - 0.37222148360070, - 0.37437762881878, - 0.37653715682603, - 0.37870001161834, - 0.38086613695607, - 0.38303547636766, - 0.38520797315322, - 0.38738357038821, - 0.38956221092708, - 0.39174383740701, - 0.39392839225157, - 0.39611581767449, - 0.39830605568342, - 0.40049904808370, - 0.40269473648218, - 0.40489306229101, - 0.40709396673153, - 0.40929739083810, - 0.41150327546197, - 0.41371156127524, - 0.41592218877472, - 0.41813509828594, - 0.42035022996702, - 0.42256752381274, - 0.42478691965848, - 0.42700835718423, - 0.42923177591866, - 0.43145711524314, - 0.43368431439580, - 0.43591331247564, - 0.43814404844658, - 0.44037646114161, - 0.44261048926688, - 0.44484607140589, - 0.44708314602359, - 0.44932165147057, - 0.45156152598727, - 0.45380270770813, - 0.45604513466581, - 0.45828874479543, - 0.46053347593880, - 0.46277926584861, - 0.46502605219277, - 0.46727377255861, - 0.46952236445718, - 0.47177176532752, - 0.47402191254100, - 0.47627274340557, - 0.47852419517009, - 0.48077620502869, - 0.48302871012505, - 0.48528164755674, - 0.48753495437962, - 0.48978856761212, - 0.49204242423966, - 0.49429646121898, - 0.49655061548250, - 0.49880482394273, - 0.50105902349665, - 0.50331315103004, - 0.50556714342194, - 0.50782093754901, - 0.51007447028990, - 0.51232767852971, - 0.51458049916433, - 0.51683286910489, - 0.51908472528213, - 0.52133600465083, - 0.52358664419420, - 0.52583658092832, - 0.52808575190648, - 0.53033409422367, - 0.53258154502092, - 0.53482804148974, - 0.53707352087652, - 0.53931792048690, - 0.54156117769021, - 0.54380322992385, - 0.54604401469766, - 0.54828346959835, - 0.55052153229384, - 0.55275814053768, - 0.55499323217338, - 0.55722674513883, - 0.55945861747062, - 0.56168878730842, - 0.56391719289930, - 0.56614377260214, - 0.56836846489188, - 0.57059120836390, - 0.57281194173835, - 0.57503060386439, - 0.57724713372458, - 0.57946147043912, - 0.58167355327012, - 0.58388332162591, - 0.58609071506528, - 0.58829567330173, - 0.59049813620770, - 0.59269804381879, - 0.59489533633802, - 0.59708995413996, - 0.59928183777495, - 0.60147092797329, - 0.60365716564937, - 0.60584049190582, - 0.60802084803764, - 0.61019817553632, - 0.61237241609393, - 0.61454351160718, - 0.61671140418155, - 0.61887603613527, - 0.62103735000336, - 0.62319528854167, - 0.62534979473088, - 0.62750081178042, - 0.62964828313250, - 0.63179215246597, - 0.63393236370030, - 0.63606886099946, - 0.63820158877577, - 0.64033049169379, - 0.64245551467413, - 0.64457660289729, - 0.64669370180740, - 0.64880675711607, - 0.65091571480603, - 0.65302052113494, - 0.65512112263906, - 0.65721746613689, - 0.65930949873289, - 0.66139716782102, - 0.66348042108842, - 0.66555920651892, - 0.66763347239664, - 0.66970316730947, - 0.67176824015260, - 0.67382864013196, - 0.67588431676768, - 0.67793521989751, - 0.67998129968017, - 0.68202250659876, - 0.68405879146403, - 0.68609010541774, - 0.68811639993588, - 0.69013762683195, - 0.69215373826012, - 0.69416468671849, - 0.69617042505214, - 0.69817090645634, - 0.70016608447958, - 0.70215591302664, - 0.70414034636163, - 0.70611933911096, - 0.70809284626630, - 0.71006082318751, - 0.71202322560554, - 0.71398000962530, - 0.71593113172842, - 0.71787654877613, - 0.71981621801195, - 0.72175009706445, - 0.72367814394990, - 0.72560031707496, - 0.72751657523927, - 0.72942687763803, - 0.73133118386457, - 0.73322945391280, - 0.73512164817975, - 0.73700772746796, - 0.73888765298787, - 0.74076138636020, - 0.74262888961827, - 0.74449012521027, - 0.74634505600152, - 0.74819364527663, - 0.75003585674175, - 0.75187165452661, - 0.75370100318668, - 0.75552386770515, - 0.75734021349500, - 0.75915000640095, - 0.76095321270137, - 0.76274979911019, - 0.76453973277875, - 0.76632298129757, - 0.76809951269819, - 0.76986929545481, - 0.77163229848604, - 0.77338849115651, - 0.77513784327849, - 0.77688032511340, - 0.77861590737340, - 0.78034456122283, - 0.78206625827961, - 0.78378097061667, - 0.78548867076330, - 0.78718933170643, - 0.78888292689189, - 0.79056943022564, - 0.79224881607494, - 0.79392105926949, - 0.79558613510249, - 0.79724401933170, - 0.79889468818046, - 0.80053811833858, - 0.80217428696334, - 0.80380317168028, - 0.80542475058405, - 0.80703900223920, - 0.80864590568089, - 0.81024544041560, - 0.81183758642175, - 0.81342232415032, - 0.81499963452540, - 0.81656949894467, - 0.81813189927991, - 0.81968681787738, - 0.82123423755821, - 0.82277414161874, - 0.82430651383076, - 0.82583133844180, - 0.82734860017528, - 0.82885828423070, - 0.83036037628369, - 0.83185486248609, - 0.83334172946597, - 0.83482096432759, - 0.83629255465130, - 0.83775648849344, - 0.83921275438615, - 0.84066134133716, - 0.84210223882952, - 0.84353543682130, - 0.84496092574524, - 0.84637869650833, - 0.84778874049138, - 0.84919104954855, - 0.85058561600677, - 0.85197243266520, - 0.85335149279457, - 0.85472279013653, - 0.85608631890295, - 0.85744207377513, - 0.85879004990298, - 0.86013024290422, - 0.86146264886346, - 0.86278726433124, - 0.86410408632306, - 0.86541311231838, - 0.86671434025950, - 0.86800776855046, - 0.86929339605590, - 0.87057122209981, - 0.87184124646433, - 0.87310346938840, - 0.87435789156650, - 0.87560451414719, - 0.87684333873173, - 0.87807436737261, - 0.87929760257204, - 0.88051304728038, - 0.88172070489456, - 0.88292057925645, - 0.88411267465117, - 0.88529699580537, - 0.88647354788545, - 0.88764233649580, - 0.88880336767692, - 0.88995664790351, - 0.89110218408260, - 0.89223998355154, - 0.89337005407600, - 0.89449240384793, - 0.89560704148345, - 0.89671397602074, - 0.89781321691786, - 0.89890477405053, - 0.89998865770993, - 0.90106487860034, - 0.90213344783689, - 0.90319437694315, - 0.90424767784873, - 0.90529336288690, - 0.90633144479201, - 0.90736193669708, - 0.90838485213119, - 0.90940020501694, - 0.91040800966776, - 0.91140828078533, - 0.91240103345685, - 0.91338628315231, - 0.91436404572173, - 0.91533433739238, - 0.91629717476594, - 0.91725257481564, - 0.91820055488334, - 0.91914113267664, - 0.92007432626589, - 0.92100015408120, - 0.92191863490944, - 0.92282978789113, - 0.92373363251740, - 0.92463018862687, - 0.92551947640245, - 0.92640151636824, - 0.92727632938624, - 0.92814393665320, - 0.92900435969727, - 0.92985762037477, - 0.93070374086684, - 0.93154274367610, - 0.93237465162328, - 0.93319948784382, - 0.93401727578443, - 0.93482803919967, - 0.93563180214841, - 0.93642858899043, - 0.93721842438279, - 0.93800133327637, - 0.93877734091223, - 0.93954647281807, - 0.94030875480458, - 0.94106421296182, - 0.94181287365556, - 0.94255476352362, - 0.94328990947213, - 0.94401833867184, - 0.94474007855439, - 0.94545515680855, - 0.94616360137644, - 0.94686544044975, - 0.94756070246592, - 0.94824941610434, - 0.94893161028248, - 0.94960731415209, - 0.95027655709525, - 0.95093936872056, - 0.95159577885924, - 0.95224581756115, - 0.95288951509097, - 0.95352690192417, - 0.95415800874314, - 0.95478286643320, - 0.95540150607863, - 0.95601395895871, - 0.95662025654373, - 0.95722043049100, - 0.95781451264084, - 0.95840253501260, - 0.95898452980058, - 0.95956052937008, - 0.96013056625336, - 0.96069467314557, - 0.96125288290073, - 0.96180522852773, - 0.96235174318622, - 0.96289246018262, - 0.96342741296604, - 0.96395663512424, - 0.96448016037959, - 0.96499802258499, - 0.96551025571985, - 0.96601689388602, - 0.96651797130376, - 0.96701352230768, - 0.96750358134269, - 0.96798818295998, - 0.96846736181297, - 0.96894115265327, - 0.96940959032667, - 0.96987270976912, - 0.97033054600270, - 0.97078313413161, - 0.97123050933818, - 0.97167270687887, - 0.97210976208030, - 0.97254171033525, - 0.97296858709871, - 0.97339042788392, - 0.97380726825843, - 0.97421914384017, - 0.97462609029350, - 0.97502814332534, - 0.97542533868127, - 0.97581771214160, - 0.97620529951759, - 0.97658813664749, - 0.97696625939282, - 0.97733970363445, - 0.97770850526884, - 0.97807270020427, - 0.97843232435704, - 0.97878741364771, - 0.97913800399743, - 0.97948413132414, - 0.97982583153895, - 0.98016314054243, - 0.98049609422096, - 0.98082472844313, - 0.98114907905608, - 0.98146918188197, - 0.98178507271438, - 0.98209678731477, - 0.98240436140902, - 0.98270783068385, - 0.98300723078342, - 0.98330259730589, - 0.98359396579995, - 0.98388137176152, - 0.98416485063031, - 0.98444443778651, - 0.98472016854752, - 0.98499207816463, - 0.98526020181980, - 0.98552457462240, - 0.98578523160609, - 0.98604220772560, - 0.98629553785362, - 0.98654525677772, - 0.98679139919726, - 0.98703399972035, - 0.98727309286089, - 0.98750871303556, - 0.98774089456089, - 0.98796967165036, - 0.98819507841154, - 0.98841714884323, - 0.98863591683269, - 0.98885141615285, - 0.98906368045957, - 0.98927274328896, - 0.98947863805473, - 0.98968139804554, - 0.98988105642241, - 0.99007764621618, - 0.99027120032501, - 0.99046175151186, - 0.99064933240208, - 0.99083397548099, - 0.99101571309153, - 0.99119457743191, - 0.99137060055337, - 0.99154381435784, - 0.99171425059582, - 0.99188194086414, - 0.99204691660388, - 0.99220920909823, - 0.99236884947045, - 0.99252586868186, - 0.99268029752989, - 0.99283216664606, - 0.99298150649419, - 0.99312834736847, - 0.99327271939167, - 0.99341465251338, - 0.99355417650825, - 0.99369132097430, - 0.99382611533130, - 0.99395858881910, - 0.99408877049612, - 0.99421668923778, - 0.99434237373503, - 0.99446585249289, - 0.99458715382906, - 0.99470630587254, - 0.99482333656229, - 0.99493827364600, - 0.99505114467878, - 0.99516197702200, - 0.99527079784214, - 0.99537763410962, - 0.99548251259777, - 0.99558545988178, - 0.99568650233767, - 0.99578566614138, - 0.99588297726783, - 0.99597846149005, - 0.99607214437834, - 0.99616405129947, - 0.99625420741595, - 0.99634263768527, - 0.99642936685928, - 0.99651441948352, - 0.99659781989663, - 0.99667959222978, - 0.99675976040620, - 0.99683834814063, - 0.99691537893895, - 0.99699087609774, - 0.99706486270391, - 0.99713736163442, - 0.99720839555593, - 0.99727798692461, - 0.99734615798589, - 0.99741293077431, - 0.99747832711337, - 0.99754236861541, - 0.99760507668158, - 0.99766647250181, - 0.99772657705478, - 0.99778541110799, - 0.99784299521785, - 0.99789934972976, - 0.99795449477828, - 0.99800845028730, - 0.99806123597027, - 0.99811287133042, - 0.99816337566108, - 0.99821276804596, - 0.99826106735952, - 0.99830829226732, - 0.99835446122649, - 0.99839959248609, - 0.99844370408765, - 0.99848681386566, - 0.99852893944805, - 0.99857009825685, - 0.99861030750869, - 0.99864958421549, - 0.99868794518504, - 0.99872540702178, - 0.99876198612738, - 0.99879769870160, - 0.99883256074295, - 0.99886658804953, - 0.99889979621983, - 0.99893220065356, - 0.99896381655254, - 0.99899465892154, - 0.99902474256924, - 0.99905408210916, - 0.99908269196056, - 0.99911058634952, - 0.99913777930986, - 0.99916428468421, - 0.99919011612505, - 0.99921528709576, - 0.99923981087174, - 0.99926370054150, - 0.99928696900779, - 0.99930962898876, - 0.99933169301910, - 0.99935317345126, - 0.99937408245662, - 0.99939443202674, - 0.99941423397457, - 0.99943349993572, - 0.99945224136972, - 0.99947046956130, - 0.99948819562171, - 0.99950543049000, - 0.99952218493439, - 0.99953846955355, - 0.99955429477803, - 0.99956967087154, - 0.99958460793242, - 0.99959911589494, - 0.99961320453077, - 0.99962688345035, - 0.99964016210433, - 0.99965304978499, - 0.99966555562769, - 0.99967768861231, - 0.99968945756473, - 0.99970087115825, - 0.99971193791510, - 0.99972266620792, - 0.99973306426121, - 0.99974314015288, - 0.99975290181568, - 0.99976235703876, - 0.99977151346914, - 0.99978037861326, - 0.99978895983845, - 0.99979726437448, - 0.99980529931507, - 0.99981307161943, - 0.99982058811377, - 0.99982785549283, - 0.99983488032144, - 0.99984166903600, - 0.99984822794606, - 0.99985456323584, - 0.99986068096572, - 0.99986658707386, - 0.99987228737764, - 0.99987778757524, - 0.99988309324717, - 0.99988820985777, - 0.99989314275675, - 0.99989789718072, - 0.99990247825468, - 0.99990689099357, - 0.99991114030376, - 0.99991523098456, - 0.99991916772971, - 0.99992295512891, - 0.99992659766930, - 0.99993009973692, - 0.99993346561824, - 0.99993669950161, - 0.99993980547870, - 0.99994278754604, - 0.99994564960642, - 0.99994839547033, - 0.99995102885747, - 0.99995355339809, - 0.99995597263451, - 0.99995829002249, - 0.99996050893264, - 0.99996263265183, - 0.99996466438460, - 0.99996660725452, - 0.99996846430558, - 0.99997023850356, - 0.99997193273736, - 0.99997354982037, - 0.99997509249183, - 0.99997656341810, - 0.99997796519400, - 0.99997930034415, - 0.99998057132421, - 0.99998178052220, - 0.99998293025975, - 0.99998402279338, - 0.99998506031574, - 0.99998604495686, - 0.99998697878536, - 0.99998786380966, - 0.99998870197921, - 0.99998949518567, - 0.99999024526408, - 0.99999095399401, - 0.99999162310077, - 0.99999225425649, - 0.99999284908128, - 0.99999340914435, - 0.99999393596510, - 0.99999443101421, - 0.99999489571473, - 0.99999533144314, - 0.99999573953040, - 0.99999612126300, - 0.99999647788395, - 0.99999681059383, - 0.99999712055178, - 0.99999740887647, - 0.99999767664709, - 0.99999792490431, - 0.99999815465123, - 0.99999836685427, - 0.99999856244415, - 0.99999874231676, - 0.99999890733405, - 0.99999905832493, - 0.99999919608613, - 0.99999932138304, - 0.99999943495056, - 0.99999953749392, - 0.99999962968950, - 0.99999971218563, - 0.99999978560337, - 0.99999985053727, - 0.99999990755616, - 0.99999995720387 -}; - -static double KBD_short[] = { /* GRANULE_LEN = 128 */ - 4.3795702929468881e-005, - 0.00011867384265436617, - 0.0002307165763996192, - 0.00038947282760568383, - 0.00060581272288302553, - 0.00089199695169487453, - 0.0012617254423430522, - 0.0017301724373162003, - 0.0023140071937421476, - 0.0030313989666022221, - 0.0039020049735530842, - 0.0049469401815512024, - 0.0061887279335368318, - 0.0076512306364647726, - 0.0093595599562652423, - 0.011339966208377799, - 0.013619706891715299, - 0.016226894586323766, - 0.019190324717288168, - 0.022539283975960878, - 0.026303340480472455, - 0.030512117046644357, - 0.03519504922365594, - 0.040381130021856941, - 0.046098643518702249, - 0.052374889768730587, - 0.059235903660769147, - 0.066706170556282418, - 0.074808341703430481, - 0.083562952548726227, - 0.092988147159339674, - 0.1030994120216919, - 0.11390932249409955, - 0.12542730516149531, - 0.13765941926783826, - 0.15060816028651081, - 0.16427228853114245, - 0.17864668550988483, - 0.19372224048676889, - 0.20948576943658073, - 0.22591996826744942, - 0.24300340184133981, - 0.26071052995068139, - 0.27901177101369551, - 0.29787360383626599, - 0.3172587073594233, - 0.33712613787396362, - 0.35743154274286698, - 0.37812740923363009, - 0.39916334663203618, - 0.42048639939189658, - 0.4420413886774246, - 0.4637712792815169, - 0.4856175685594023, - 0.50752069370766872, - 0.52942045344797806, - 0.55125643994680196, - 0.57296847662071559, - 0.59449705734411495, - 0.61578378249506627, - 0.63677178724712891, - 0.65740615754163356, - 0.67763432925662526, - 0.69740646622548552, - 0.71667581294953808, - 0.73539901809352737, - 0.75353642514900732, - 0.77105232699609816, - 0.78791518148597028, - 0.80409778560147072, - 0.81957740622770781, - 0.83433586607383625, - 0.84835958382689225, - 0.86163956818294229, - 0.87417136598406997, - 0.88595496528524853, - 0.89699465477567619, - 0.90729884157670959, - 0.91687983002436779, - 0.92575356460899649, - 0.93393934077779084, - 0.94145948779657318, - 0.94833902830402828, - 0.95460531956280026, - 0.96028768170574896, - 0.96541701848104766, - 0.97002543610646474, - 0.97414586584250062, - 0.97781169577969584, - 0.98105641710392333, - 0.98391328975491177, - 0.98641503193166202, - 0.98859353733226141, - 0.99047962335771556, - 0.9921028127769449, - 0.99349115056397752, - 0.99467105680259038, - 0.9956672157341897, - 0.99650250022834352, - 0.99719793020823266, - 0.99777266288955657, - 0.99824401211201486, - 0.99862749357391212, - 0.99893689243401962, - 0.99918434952623147, - 0.99938046234161726, - 0.99953439696357238, - 0.99965400728430465, - 0.99974595807027455, - 0.99981584876278362, - 0.99986833527824281, - 0.99990724749057802, - 0.99993570051598468, - 0.99995619835942084, - 0.99997072890647543, - 0.9999808496399144, - 0.99998776381655818, - 0.99999238714961569, - 0.99999540529959718, - 0.99999732268176988, - 0.99999850325054862, - 0.99999920402413744, - 0.9999996021706401, - 0.99999981649545566, - 0.99999992415545547, - 0.99999997338493041, - 0.99999999295825959, - 0.99999999904096815 -}; - - -static double sin_long[] = { /* GRANULE_LEN = 1024 */ - 0.00076699031874270448, - 0.00230096915142580512, - 0.00383494256970622784, - 0.00536890696399634240, - 0.00690285872472975616, - 0.00843679424236979840, - 0.00997070990741803136, - 0.01150460211042271360, - 0.01303846724198733440, - 0.01457230169277906560, - 0.01610610185353728640, - 0.01763986411508205440, - 0.01917358486832262400, - 0.02070726050426589440, - 0.02224088741402496000, - 0.02377446198882755520, - 0.02530798062002456960, - 0.02684143969909853120, - 0.02837483561767209920, - 0.02990816476751655680, - 0.03144142354056030080, - 0.03297460832889733760, - 0.03450771552479575040, - 0.03604074152070622720, - 0.03757368270927049600, - 0.03910653548332988800, - 0.04063929623593373440, - 0.04217196136034794880, - 0.04370452725006342400, - 0.04523699029880458880, - 0.04676934690053786240, - 0.04830159344948014720, - 0.04983372634010727680, - 0.05136574196716259200, - 0.05289763672566532480, - 0.05442940701091912960, - 0.05596104921852056960, - 0.05749255974436756480, - 0.05902393498466792960, - 0.06055517133594778880, - 0.06208626519506008320, - 0.06361721295919310080, - 0.06514801102587883520, - 0.06667865579300156160, - 0.06820914365880632320, - 0.06973947102190730240, - 0.07126963428129639680, - 0.07279962983635166720, - 0.07432945408684576000, - 0.07585910343295444480, - 0.07738857427526504960, - 0.07891786301478494720, - 0.08044696605295001600, - 0.08197587979163306240, - 0.08350460063315243520, - 0.08503312498028028160, - 0.08656144923625117440, - 0.08808956980477050880, - 0.08961748309002296320, - 0.09114518549668101120, - 0.09267267342991330560, - 0.09419994329539320320, - 0.09572699149930716160, - 0.09725381444836327680, - 0.09878040854979962880, - 0.10030677021139286400, - 0.10183289584146652800, - 0.10335878184889961600, - 0.10488442464313496000, - 0.10640982063418768000, - 0.10793496623265364800, - 0.10945985784971798400, - 0.11098449189716339200, - 0.11250886478737868800, - 0.11403297293336720000, - 0.11555681274875526400, - 0.11708038064780059200, - 0.11860367304540072000, - 0.12012668635710150400, - 0.12164941699910553600, - 0.12317186138828048000, - 0.12469401594216764800, - 0.12621587707899035200, - 0.12773744121766230400, - 0.12925870477779612800, - 0.13077966417971171200, - 0.13230031584444465600, - 0.13382065619375472000, - 0.13534068165013420800, - 0.13686038863681638400, - 0.13837977357778388800, - 0.13989883289777721600, - 0.14141756302230302400, - 0.14293596037764267200, - 0.14445402139086048000, - 0.14597174248981219200, - 0.14748912010315356800, - 0.14900615066034844800, - 0.15052283059167740800, - 0.15203915632824604800, - 0.15355512430199344000, - 0.15507073094570051200, - 0.15658597269299843200, - 0.15810084597837699200, - 0.15961534723719305600, - 0.16112947290567881600, - 0.16264321942095030400, - 0.16415658322101580800, - 0.16566956074478412800, - 0.16718214843207292800, - 0.16869434272361734400, - 0.17020614006107808000, - 0.17171753688704995200, - 0.17322852964507033600, - 0.17473911477962720000, - 0.17624928873616787200, - 0.17775904796110716800, - 0.17926838890183574400, - 0.18077730800672857600, - 0.18228580172515328000, - 0.18379386650747846400, - 0.18530149880508188800, - 0.18680869507035926400, - 0.18831545175673212800, - 0.18982176531865641600, - 0.19132763221163091200, - 0.19283304889220524800, - 0.19433801181798860800, - 0.19584251744765785600, - 0.19734656224096592000, - 0.19885014265875008000, - 0.20035325516294044800, - 0.20185589621656806400, - 0.20335806228377331200, - 0.20485974982981443200, - 0.20636095532107552000, - 0.20786167522507507200, - 0.20936190601047417600, - 0.21086164414708486400, - 0.21236088610587840000, - 0.21385962835899376000, - 0.21535786737974553600, - 0.21685559964263260800, - 0.21835282162334633600, - 0.21984952979877868800, - 0.22134572064703081600, - 0.22284139064742112000, - 0.22433653628049360000, - 0.22583115402802617600, - 0.22732524037303884800, - 0.22881879179980220800, - 0.23031180479384544000, - 0.23180427584196476800, - 0.23329620143223158400, - 0.23478757805400096000, - 0.23627840219791958400, - 0.23776867035593417600, - 0.23925837902129996800, - 0.24074752468858841600, - 0.24223610385369600000, - 0.24372411301385216000, - 0.24521154866762755200, - 0.24669840731494240000, - 0.24818468545707478400, - 0.24967037959666857600, - 0.25115548623774192000, - 0.25264000188569552000, - 0.25412392304732060800, - 0.25560724623080739200, - 0.25708996794575312000, - 0.25857208470317033600, - 0.26005359301549520000, - 0.26153448939659552000, - 0.26301477036177900800, - 0.26449443242780163200, - 0.26597347211287558400, - 0.26745188593667763200, - 0.26892967042035724800, - 0.27040682208654483200, - 0.27188333745935971200, - 0.27335921306441868800, - 0.27483444542884393600, - 0.27630903108127107200, - 0.27778296655185769600, - 0.27925624837229116800, - 0.28072887307579718400, - 0.28220083719714755200, - 0.28367213727266844800, - 0.28514276984024867200, - 0.28661273143934777600, - 0.28808201861100412800, - 0.28955062789784300800, - 0.29101855584408512000, - 0.29248579899555385600, - 0.29395235389968467200, - 0.29541821710553203200, - 0.29688338516377824000, - 0.29834785462674137600, - 0.29981162204838336000, - 0.30127468398431795200, - 0.30273703699181913600, - 0.30419867762982912000, - 0.30565960245896614400, - 0.30711980804153312000, - 0.30857929094152505600, - 0.31003804772463788800, - 0.31149607495827590400, - 0.31295336921156019200, - 0.31440992705533664000, - 0.31586574506218393600, - 0.31732081980642176000, - 0.31877514786411846400, - 0.32022872581309984000, - 0.32168155023295660800, - 0.32313361770505235200, - 0.32458492481253216000, - 0.32603546814033024000, - 0.32748524427517798400, - 0.32893424980561222400, - 0.33038248132198278400, - 0.33182993541646112000, - 0.33327660868304793600, - 0.33472249771758124800, - 0.33616759911774451200, - 0.33761190948307462400, - 0.33905542541496966400, - 0.34049814351669715200, - 0.34194006039340217600, - 0.34338117265211507200, - 0.34482147690175929600, - 0.34626096975316000000, - 0.34769964781905139200, - 0.34913750771408499200, - 0.35057454605483750400, - 0.35201075945981907200, - 0.35344614454948083200, - 0.35488069794622278400, - 0.35631441627440243200, - 0.35774729616034188800, - 0.35917933423233651200, - 0.36061052712066227200, - 0.36204087145758419200, - 0.36347036387736377600, - 0.36489900101626732800, - 0.36632677951257356800, - 0.36775369600658195200, - 0.36917974714062003200, - 0.37060492955905164800, - 0.37202923990828499200, - 0.37345267483678028800, - 0.37487523099505753600, - 0.37629690503570476800, - 0.37771769361338566400, - 0.37913759338484729600, - 0.38055660100892851200, - 0.38197471314656723200, - 0.38339192646080864000, - 0.38480823761681286400, - 0.38622364328186297600, - 0.38763814012537273600, - 0.38905172481889440000, - 0.39046439403612659200, - 0.39187614445292236800, - 0.39328697274729638400, - 0.39469687559943353600, - 0.39610584969169625600, - 0.39751389170863232000, - 0.39892099833698291200, - 0.40032716626569011200, - 0.40173239218590502400, - 0.40313667279099532800, - 0.40454000477655302400, - 0.40594238484040249600, - 0.40734380968260800000, - 0.40874427600548134400, - 0.41014378051359020800, - 0.41154231991376524800, - 0.41293989091510809600, - 0.41433649022899910400, - 0.41573211456910534400, - 0.41712676065138790400, - 0.41852042519410969600, - 0.41991310491784358400, - 0.42130479654547961600, - 0.42269549680223296000, - 0.42408520241565158400, - 0.42547391011562380800, - 0.42686161663438643200, - 0.42824831870653196800, - 0.42963401306901638400, - 0.43101869646116704000, - 0.43240236562469011200, - 0.43378501730367852800, - 0.43516664824461926400, - 0.43654725519640121600, - 0.43792683491032288000, - 0.43930538414009996800, - 0.44068289964187289600, - 0.44205937817421472000, - 0.44343481649813849600, - 0.44480921137710489600, - 0.44618255957703008000, - 0.44755485786629299200, - 0.44892610301574323200, - 0.45029629179870860800, - 0.45166542099100249600, - 0.45303348737093158400, - 0.45440048771930355200, - 0.45576641881943462400, - 0.45713127745715699200, - 0.45849506042082630400, - 0.45985776450132953600, - 0.46121938649209235200, - 0.46257992318908678400, - 0.46393937139083852800, - 0.46529772789843462400, - 0.46665498951553094400, - 0.46801115304835980800, - 0.46936621530573753600, - 0.47072017309907161600, - 0.47207302324236864000, - 0.47342476255224153600, - 0.47477538784791712000, - 0.47612489595124358400, - 0.47747328368669804800, - 0.47882054788139385600, - 0.48016668536508838400, - 0.48151169297018988800, - 0.48285556753176569600, - 0.48419830588754905600, - 0.48553990487794694400, - 0.48688036134604736000, - 0.48821967213762681600, - 0.48955783410115744000, - 0.49089484408781510400, - 0.49223069895148601600, - 0.49356539554877478400, - 0.49489893073901126400, - 0.49623130138425824000, - 0.49756250434931916800, - 0.49889253650174457600, - 0.50022139471184070400, - 0.50154907585267539200, - 0.50287557680008697600, - 0.50420089443269036800, - 0.50552502563188537600, - 0.50684796728186323200, - 0.50816971626961459200, - 0.50949026948493638400, - 0.51080962382043904000, - 0.51212777617155468800, - 0.51344472343654348800, - 0.51476046251650118400, - 0.51607499031536665600, - 0.51738830373992908800, - 0.51870039969983494400, - 0.52001127510759603200, - 0.52132092687859564800, - 0.52262935193109664000, - 0.52393654718624857600, - 0.52524250956809472000, - 0.52654723600357945600, - 0.52785072342255526400, - 0.52915296875779059200, - 0.53045396894497632000, - 0.53175372092273331200, - 0.53305222163261945600, - 0.53434946801913753600, - 0.53564545702974112000, - 0.53694018561484294400, - 0.53823365072782169600, - 0.53952584932502886400, - 0.54081677836579667200, - 0.54210643481244390400, - 0.54339481563028480000, - 0.54468191778763456000, - 0.54596773825581760000, - 0.54725227400917408000, - 0.54853552202506739200, - 0.54981747928389088000, - 0.55109814276907545600, - 0.55237750946709606400, - 0.55365557636747929600, - 0.55493234046281036800, - 0.55620779874873990400, - 0.55748194822399155200, - 0.55875478589036832000, - 0.56002630875276038400, - 0.56129651381915148800, - 0.56256539810062656000, - 0.56383295861137817600, - 0.56509919236871398400, - 0.56636409639306387200, - 0.56762766770798624000, - 0.56888990334017587200, - 0.57015080031947027200, - 0.57141035567885721600, - 0.57266856645448115200, - 0.57392542968565075200, - 0.57518094241484505600, - 0.57643510168772185600, - 0.57768790455312281600, - 0.57893934806308172800, - 0.58018942927283174400, - 0.58143814524081011200, - 0.58268549302866841600, - 0.58393146970127616000, - 0.58517607232673036800, - 0.58641929797636044800, - 0.58766114372473664000, - 0.58890160664967577600, - 0.59014068383224883200, - 0.59137837235678758400, - 0.59261466931089113600, - 0.59384957178543360000, - 0.59508307687456998400, - 0.59631518167574374400, - 0.59754588328969318400, - 0.59877517882045875200, - 0.60000306537538892800, - 0.60122954006514854400, - 0.60245460000372377600, - 0.60367824230843033600, - 0.60490046409991987200, - 0.60612126250218611200, - 0.60734063464257292800, - 0.60855857765177945600, - 0.60977508866386841600, - 0.61099016481627161600, - 0.61220380324979788800, - 0.61341600110863859200, - 0.61462675554037504000, - 0.61583606369598515200, - 0.61704392272984972800, - 0.61825032979976025600, - 0.61945528206692403200, - 0.62065877669597209600, - 0.62186081085496537600, - 0.62306138171540121600, - 0.62426048645222067200, - 0.62545812224381440000, - 0.62665428627202931200, - 0.62784897572217651200, - 0.62904218778303603200, - 0.63023391964686438400, - 0.63142416850940185600, - 0.63261293156987737600, - 0.63380020603101721600, - 0.63498598909904947200, - 0.63617027798371212800, - 0.63735306989825907200, - 0.63853436205946675200, - 0.63971415168764044800, - 0.64089243600662144000, - 0.64206921224379251200, - 0.64324447763008588800, - 0.64441822939998835200, - 0.64559046479154867200, - 0.64676118104638387200, - 0.64793037540968537600, - 0.64909804513022592000, - 0.65026418746036582400, - 0.65142879965605977600, - 0.65259187897686246400, - 0.65375342268593600000, - 0.65491342805005606400, - 0.65607189233961766400, - 0.65722881282864256000, - 0.65838418679478502400, - 0.65953801151933862400, - 0.66069028428724224000, - 0.66184100238708684800, - 0.66299016311112140800, - 0.66413776375526003200, - 0.66528380161908723200, - 0.66642827400586521600, - 0.66757117822254028800, - 0.66871251157974796800, - 0.66985227139182105600, - 0.67099045497679424000, - 0.67212705965641177600, - 0.67326208275613299200, - 0.67439552160513907200, - 0.67552737353633856000, - 0.67665763588637491200, - 0.67778630599563148800, - 0.67891338120823846400, - 0.68003885887207897600, - 0.68116273633879539200, - 0.68228501096379558400, - 0.68340568010625868800, - 0.68452474112914227200, - 0.68564219139918745600, - 0.68675802828692595200, - 0.68787224916668556800, - 0.68898485141659699200, - 0.69009583241859993600, - 0.69120518955844851200, - 0.69231292022571827200, - 0.69341902181381171200, - 0.69452349171996556800, - 0.69562632734525491200, - 0.69672752609460121600, - 0.69782708537677734400, - 0.69892500260441420800, - 0.70002127519400627200, - 0.70111590056591872000, - 0.70220887614439180800, - 0.70330019935754867200, - 0.70438986763740044800, - 0.70547787841985216000, - 0.70656422914470950400, - 0.70764891725568435200, - 0.70873194020040064000, - 0.70981329543040089600, - 0.71089298040115161600, - 0.71197099257205004800, - 0.71304732940642918400, - 0.71412198837156467200, - 0.71519496693868006400, - 0.71626626258295308800, - 0.71733587278352179200, - 0.71840379502348966400, - 0.71947002678993305600, - 0.72053456557390528000, - 0.72159740887044364800, - 0.72265855417857561600, - 0.72371799900132339200, - 0.72477574084571123200, - 0.72583177722277043200, - 0.72688610564754496000, - 0.72793872363909862400, - 0.72898962872051929600, - 0.73003881841892620800, - 0.73108629026547417600, - 0.73213204179536128000, - 0.73317607054783270400, - 0.73421837406618816000, - 0.73525894989778675200, - 0.73629779559405312000, - 0.73733490871048281600, - 0.73837028680664857600, - 0.73940392744620569600, - 0.74043582819689804800, - 0.74146598663056332800, - 0.74249440032313920000, - 0.74352106685466918400, - 0.74454598380930726400, - 0.74556914877532544000, - 0.74659055934511731200, - 0.74761021311520512000, - 0.74862810768624537600, - 0.74964424066303347200, - 0.75065860965451059200, - 0.75167121227376844800, - 0.75268204613805516800, - 0.75369110886878118400, - 0.75469839809152435200, - 0.75570391143603584000, - 0.75670764653624563200, - 0.75770960103026803200, - 0.75870977256040742400, - 0.75970815877316339200, - 0.76070475731923686400, - 0.76169956585353523200, - 0.76269258203517785600, - 0.76368380352750182400, - 0.76467322799806720000, - 0.76566085311866240000, - 0.76664667656531033600, - 0.76763069601827328000, - 0.76861290916205824000, - 0.76959331368542297600, - 0.77057190728138073600, - 0.77154868764720627200, - 0.77252365248444134400, - 0.77349679949889907200, - 0.77446812640067084800, - 0.77543763090413043200, - 0.77640531072794035200, - 0.77737116359505625600, - 0.77833518723273305600, - 0.77929737937253030400, - 0.78025773775031654400, - 0.78121626010627609600, - 0.78217294418491289600, - 0.78312778773505728000, - 0.78408078850986995200, - 0.78503194426684812800, - 0.78598125276783014400, - 0.78692871177900172800, - 0.78787431907090009600, - 0.78881807241842022400, - 0.78975996960081907200, - 0.79070000840172160000, - 0.79163818660912576000, - 0.79257450201540761600, - 0.79350895241732672000, - 0.79444153561603059200, - 0.79537224941706124800, - 0.79630109163035916800, - 0.79722806007026867200, - 0.79815315255554380800, - 0.79907636690935232000, - 0.79999770095928192000, - 0.80091715253734425600, - 0.80183471947998131200, - 0.80275039962806912000, - 0.80366419082692403200, - 0.80457609092630694400, - 0.80548609778042918400, - 0.80639420924795622400, - 0.80730042319201446400, - 0.80820473748019468800, - 0.80910714998455808000, - 0.81000765858164108800, - 0.81090626115245964800, - 0.81180295558251532800, - 0.81269773976179942400, - 0.81359061158479846400, - 0.81448156895049856000, - 0.81537060976239129600, - 0.81625773192847744000, - 0.81714293336127296000, - 0.81802621197781350400, - 0.81890756569965900800, - 0.81978699245289894400, - 0.82066449016815744000, - 0.82154005678059763200, - 0.82241369022992640000, - 0.82328538846040012800, - 0.82415514942082854400, - 0.82502297106458022400, - 0.82588885134958681600, - 0.82675278823834854400, - 0.82761477969793843200, - 0.82847482370000716800, - 0.82933291822078822400, - 0.83018906124110233600, - 0.83104325074636236800, - 0.83189548472657753600, - 0.83274576117635942400, - 0.83359407809492518400, - 0.83444043348610316800, - 0.83528482535833740800, - 0.83612725172469209600, - 0.83696771060285696000, - 0.83780620001515097600, - 0.83864271798852736000, - 0.83947726255457856000, - 0.84030983174954073600, - 0.84114042361429811200, - 0.84196903619438771200, - 0.84279566754000409600, - 0.84362031570600409600, - 0.84444297875191065600, - 0.84526365474191820800, - 0.84608234174489689600, - 0.84689903783439731200, - 0.84771374108865420800, - 0.84852644959059264000, - 0.84933716142783065600, - 0.85014587469268518400, - 0.85095258748217574400, - 0.85175729789802905600, - 0.85256000404668403200, - 0.85336070403929548800, - 0.85415939599173875200, - 0.85495607802461478400, - 0.85575074826325388800, - 0.85654340483771993600, - 0.85733404588281561600, - 0.85812266953808601600, - 0.85890927394782387200, - 0.85969385726107264000, - 0.86047641763163212800, - 0.86125695321806208000, - 0.86203546218368716800, - 0.86281194269660032000, - 0.86358639292966796800, - 0.86435881106053401600, - 0.86512919527162368000, - 0.86589754375014886400, - 0.86666385468811097600, - 0.86742812628230694400, - 0.86819035673433126400, - 0.86895054425058240000, - 0.86970868704226560000, - 0.87046478332539763200, - 0.87121883132081088000, - 0.87197082925415769600, - 0.87272077535591424000, - 0.87346866786138483200, - 0.87421450501070630400, - 0.87495828504885158400, - 0.87570000622563456000, - 0.87643966679571366400, - 0.87717726501859596800, - 0.87791279915864179200, - 0.87864626748506816000, - 0.87937766827195315200, - 0.88010699979824038400, - 0.88083426034774208000, - 0.88155944820914380800, - 0.88228256167600857600, - 0.88300359904678067200, - 0.88372255862478963200, - 0.88443943871825369600, - 0.88515423764028505600, - 0.88586695370889280000, - 0.88657758524698700800, - 0.88728613058238310400, - 0.88799258804780556800, - 0.88869695598089164800, - 0.88939923272419558400, - 0.89009941662519219200, - 0.89079750603628147200, - 0.89149349931479142400, - 0.89218739482298252800, - 0.89287919092805171200, - 0.89356888600213606400, - 0.89425647842231603200, - 0.89494196657062080000, - 0.89562534883402995200, - 0.89630662360447961600, - 0.89698578927886400000, - 0.89766284425904076800, - 0.89833778695183424000, - 0.89901061576903910400, - 0.89968132912742387200, - 0.90034992544873561600, - 0.90101640315970227200, - 0.90168076069203776000, - 0.90234299648244416000, - 0.90300310897261708800, - 0.90366109660924800000, - 0.90431695784402828800, - 0.90497069113365324800, - 0.90562229493982515200, - 0.90627176772925760000, - 0.90691910797367808000, - 0.90756431414983257600, - 0.90820738473948864000, - 0.90884831822943910400, - 0.90948711311150540800, - 0.91012376788254156800, - 0.91075828104443750400, - 0.91139065110412236800, - 0.91202087657356825600, - 0.91264895596979392000, - 0.91327488781486771200, - 0.91389867063591168000, - 0.91452030296510438400, - 0.91513978333968524800, - 0.91575711030195673600, - 0.91637228239928908800, - 0.91698529818412288000, - 0.91759615621397299200, - 0.91820485505143091200, - 0.91881139326416998400, - 0.91941576942494694400, - 0.92001798211160652800, - 0.92061802990708390400, - 0.92121591139940876800, - 0.92181162518170816000, - 0.92240516985220992000, - 0.92299654401424627200, - 0.92358574627625651200, - 0.92417277525179123200, - 0.92475762955951385600, - 0.92534030782320614400, - 0.92592080867176998400, - 0.92649913073923046400, - 0.92707527266474009600, - 0.92764923309258112000, - 0.92822101067216947200, - 0.92879060405805696000, - 0.92935801190993548800, - 0.92992323289263961600, - 0.93048626567614976000, - 0.93104710893559513600, - 0.93160576135125785600, - 0.93216222160857433600, - 0.93271648839814028800, - 0.93326856041571200000, - 0.93381843636221094400, - 0.93436611494372595200, - 0.93491159487151603200, - 0.93545487486201459200, - 0.93599595363683136000, - 0.93653482992275545600, - 0.93707150245175923200, - 0.93760596996099993600, - 0.93813823119282432000, - 0.93866828489477017600, - 0.93919612981956992000, - 0.93972176472515328000, - 0.94024518837465088000, - 0.94076639953639603200, - 0.94128539698392870400, - 0.94180217949599769600, - 0.94231674585656371200, - 0.94282909485480268800, - 0.94333922528510771200, - 0.94384713594709273600, - 0.94435282564559475200, - 0.94485629319067724800, - 0.94535753739763225600, - 0.94585655708698393600, - 0.94635335108449062400, - 0.94684791822114803200, - 0.94734025733319193600, - 0.94783036726210099200, - 0.94831824685459904000, - 0.94880389496265843200, - 0.94928731044350195200, - 0.94976849215960665600, - 0.95024743897870528000, - 0.95072414977378956800, - 0.95119862342311321600, - 0.95167085881019392000, - 0.95214085482381580800, - 0.95260861035803328000, - 0.95307412431217216000, - 0.95353739559083328000, - 0.95399842310389452800, - 0.95445720576651353600, - 0.95491374249913049600, - 0.95536803222747020800, - 0.95582007388254540800, - 0.95626986640065817600, - 0.95671740872340300800, - 0.95716269979767014400, - 0.95760573857564620800, - 0.95804652401481856000, - 0.95848505507797606400, - 0.95892133073321305600, - 0.95935534995393075200, - 0.95978711171883993600, - 0.96021661501196339200, - 0.96064385882263846400, - 0.96106884214551936000, - 0.96149156398057894400, - 0.96191202333311206400, - 0.96233021921373734400, - 0.96274615063839936000, - 0.96315981662837132800, - 0.96357121621025715200, - 0.96398034841599411200, - 0.96438721228285427200, - 0.96479180685344793600, - 0.96519413117572467200, - 0.96559418430297689600, - 0.96599196529384051200, - 0.96638747321229875200, - 0.96678070712768332800, - 0.96717166611467660800, - 0.96756034925331430400, - 0.96794675562898777600, - 0.96833088433244531200, - 0.96871273445979481600, - 0.96909230511250611200, - 0.96946959539741299200, - 0.96984460442671488000, - 0.97021733131797913600, - 0.97058777519414361600, - 0.97095593518351795200, - 0.97132181041978611200, - 0.97168540004200857600, - 0.97204670319462348800, - 0.97240571902744972800, - 0.97276244669568857600, - 0.97311688535992512000, - 0.97346903418613094400, - 0.97381889234566604800, - 0.97416645901528025600, - 0.97451173337711577600, - 0.97485471461870848000, - 0.97519540193299033600, - 0.97553379451829132800, - 0.97586989157834099200, - 0.97620369232227059200, - 0.97653519596461452800, - 0.97686440172531264000, - 0.97719130882971225600, - 0.97751591650856934400, - 0.97783822399805043200, - 0.97815823053973504000, - 0.97847593538061683200, - 0.97879133777310566400, - 0.97910443697502924800, - 0.97941523224963481600, - 0.97972372286559116800, - 0.98002990809698995200, - 0.98033378722334796800, - 0.98063535952960806400, - 0.98093462430614169600, - 0.98123158084874969600, - 0.98152622845866470400, - 0.98181856644255244800, - 0.98210859411251366400, - 0.98239631078608473600, - 0.98268171578624089600, - 0.98296480844139648000, - 0.98324558808540710400, - 0.98352405405757120000, - 0.98380020570263155200, - 0.98407404237077644800, - 0.98434556341764185600, - 0.98461476820431257600, - 0.98488165609732364800, - 0.98514622646866227200, - 0.98540847869576844800, - 0.98566841216153753600, - 0.98592602625432115200, - 0.98618132036792832000, - 0.98643429390162700800, - 0.98668494626014668800, - 0.98693327685367769600, - 0.98717928509787430400, - 0.98742297041385536000, - 0.98766433222820569600, - 0.98790336997297779200, - 0.98814008308569254400, - 0.98837447100934131200, - 0.98860653319238643200, - 0.98883626908876352000, - 0.98906367815788160000, - 0.98928875986462515200, - 0.98951151367935513600, - 0.98973193907791052800, - 0.98995003554160896000, - 0.99016580255724838400, - 0.99037923961710822400, - 0.99059034621895014400, - 0.99079912186602035200, - 0.99100556606704934400, - 0.99120967833625408000, - 0.99141145819333849600, - 0.99161090516349542400, - 0.99180801877740646400, - 0.99200279857124454400, - 0.99219524408667392000, - 0.99238535487085171200, - 0.99257313047642880000, - 0.99275857046155110400, - 0.99294167438986048000, - 0.99312244183049561600, - 0.99330087235809331200, - 0.99347696555278924800, - 0.99365072100021913600, - 0.99382213829151961600, - 0.99399121702332940800, - 0.99415795679778969600, - 0.99432235722254579200, - 0.99448441791074764800, - 0.99464413848105075200, - 0.99480151855761715200, - 0.99495655777011635200, - 0.99510925575372608000, - 0.99525961214913344000, - 0.99540762660253491200, - 0.99555329876563852800, - 0.99569662829566348800, - 0.99583761485534156800, - 0.99597625811291776000, - 0.99611255774215116800, - 0.99624651342231552000, - 0.99637812483820019200, - 0.99650739168011084800, - 0.99663431364386995200, - 0.99675889043081804800, - 0.99688112174781388800, - 0.99700100730723532800, - 0.99711854682697996800, - 0.99723374003046617600, - 0.99734658664663321600, - 0.99745708640994188800, - 0.99756523906037580800, - 0.99767104434344102400, - 0.99777450201016780800, - 0.99787561181711014400, - 0.99797437352634700800, - 0.99807078690548236800, - 0.99816485172764620800, - 0.99825656777149516800, - 0.99834593482121241600, - 0.99843295266650841600, - 0.99851762110262220800, - 0.99859993993032038400, - 0.99867990895589913600, - 0.99875752799118336000, - 0.99883279685352793600, - 0.99890571536581824000, - 0.99897628335646976000, - 0.99904450065942924800, - 0.99911036711417484800, - 0.99917388256571635200, - 0.99923504686459584000, - 0.99929385986688780800, - 0.99935032143419942400, - 0.99940443143367129600, - 0.99945618973797734400, - 0.99950559622532531200, - 0.99955265077945702400, - 0.99959735328964838400, - 0.99963970365071014400, - 0.99967970176298790400, - 0.99971734753236224000, - 0.99975264087024883200, - 0.99978558169359923200, - 0.99981616992490035200, - 0.99984440549217523200, - 0.99987028832898291200, - 0.99989381837441843200, - 0.99991499557311347200, - 0.99993381987523596800, - 0.99995029123649049600, - 0.99996440961811827200, - 0.99997617498689766400, - 0.99998558731514316800, - 0.99999264658070720000, - 0.99999735276697817600, - 0.99999970586288217600 -}; - - -static double sin_short[] = { /* GRANULE_LEN = 1024 */ - 0.00613588464915447552, - 0.01840672990580481920, - 0.03067480317663662720, - 0.04293825693494081920, - 0.05519524434968993280, - 0.06744391956366405120, - 0.07968243797143013120, - 0.09190895649713272320, - 0.10412163387205459200, - 0.11631863091190475200, - 0.12849811079379316800, - 0.14065823933284921600, - 0.15279718525844342400, - 0.16491312048996988800, - 0.17700422041214873600, - 0.18906866414980620800, - 0.20110463484209190400, - 0.21311031991609136000, - 0.22508391135979283200, - 0.23702360599436720000, - 0.24892760574572016000, - 0.26079411791527552000, - 0.27262135544994899200, - 0.28440753721127187200, - 0.29615088824362380800, - 0.30784964004153484800, - 0.31950203081601568000, - 0.33110630575987641600, - 0.34266071731199436800, - 0.35416352542049036800, - 0.36561299780477382400, - 0.37700741021641824000, - 0.38834504669882624000, - 0.39962419984564678400, - 0.41084317105790393600, - 0.42200027079979968000, - 0.43309381885315193600, - 0.44412214457042918400, - 0.45508358712634380800, - 0.46597649576796620800, - 0.47679923006332211200, - 0.48755016014843596800, - 0.49822766697278188800, - 0.50883014254310700800, - 0.51935599016558963200, - 0.52980362468629459200, - 0.54017147272989286400, - 0.55045797293660480000, - 0.56066157619733600000, - 0.57078074588696723200, - 0.58081395809576448000, - 0.59075970185887411200, - 0.60061647938386892800, - 0.61038280627630950400, - 0.62005721176328908800, - 0.62963823891492697600, - 0.63912444486377574400, - 0.64851440102211238400, - 0.65780669329707865600, - 0.66699992230363750400, - 0.67609270357531596800, - 0.68508366777270041600, - 0.69397146088965401600, - 0.70275474445722534400, - 0.71143219574521638400, - 0.72000250796138163200, - 0.72846439044822515200, - 0.73681656887736985600, - 0.74505778544146598400, - 0.75318679904361241600, - 0.76120238548426176000, - 0.76910333764557964800, - 0.77688846567323238400, - 0.78455659715557529600, - 0.79210657730021235200, - 0.79953726910790502400, - 0.80684755354379916800, - 0.81403632970594828800, - 0.82110251499110464000, - 0.82804504525775577600, - 0.83486287498638003200, - 0.84155497743689830400, - 0.84812034480329715200, - 0.85455798836540057600, - 0.86086693863776729600, - 0.86704624551569267200, - 0.87309497841829004800, - 0.87901222642863347200, - 0.88479709843093772800, - 0.89044872324475788800, - 0.89596624975618508800, - 0.90134884704602201600, - 0.90659570451491532800, - 0.91170603200542988800, - 0.91667905992104268800, - 0.92151403934204185600, - 0.92621024213831129600, - 0.93076696107898368000, - 0.93518350993894745600, - 0.93945922360218995200, - 0.94359345816196044800, - 0.94758559101774105600, - 0.95143502096900838400, - 0.95514116830577062400, - 0.95870347489587161600, - 0.96212140426904153600, - 0.96539444169768934400, - 0.96852209427441728000, - 0.97150389098625177600, - 0.97433938278557580800, - 0.97702814265775436800, - 0.97956976568544051200, - 0.98196386910955520000, - 0.98421009238692902400, - 0.98630809724459865600, - 0.98825756773074944000, - 0.99005821026229708800, - 0.99170975366909952000, - 0.99321194923479449600, - 0.99456457073425536000, - 0.99576741446765977600, - 0.99682029929116569600, - 0.99772306664419161600, - 0.99847558057329472000, - 0.99907772775264537600, - 0.99952941750109312000, - 0.99983058179582336000, - 0.99998117528260108800 -}; - -#endif