diff --git a/include/lc3.h b/include/lc3.h index 058d0be..c49f0a9 100644 --- a/include/lc3.h +++ b/include/lc3.h @@ -124,25 +124,32 @@ extern "C" { /** * Limitations - * - On the bitrate, in bps, of a stream + * - On the bitrate, in bps (48 KHz, 10ms frame size) * - On the size of the frames in bytes * - On the number of samples by frames */ #define LC3_MIN_BITRATE 16000 #define LC3_MAX_BITRATE 320000 +#define LC3_MAX_HR_BITRATE 500000 #define LC3_MIN_FRAME_BYTES 20 #define LC3_MAX_FRAME_BYTES 400 +#define LC3_MAX_HR_FRAME_BYTES 625 -#define LC3_MIN_FRAME_SAMPLES __LC3_NS( 2500, 8000) -#define LC3_MAX_FRAME_SAMPLES __LC3_NS(10000, 48000) +#define LC3_MIN_FRAME_SAMPLES LC3_NS( 2500, 8000) +#define LC3_MAX_FRAME_SAMPLES LC3_NS(10000, 48000) +#define LC3_MAX_HR_FRAME_SAMPLES LC3_NS(10000, 96000) /** * Parameters check * LC3_CHECK_DT_US(us) True when frame duration in us is suitable * LC3_CHECK_SR_HZ(sr) True when samplerate in Hz is suitable + * + * LC3_CHECK_HR_SR_HZ(hrmode, sr) + * True when samplerate in Hz is suitable, according to the + * selection of the high-resolution mode `hrmode`. */ #define LC3_CHECK_DT_US(us) \ @@ -153,6 +160,9 @@ extern "C" { ( ((sr) == 8000) || ((sr) == 16000) || ((sr) == 24000) || \ ((sr) == 32000) || ((sr) == 48000) ) +#define LC3_CHECK_HR_SR_HZ(hrmode, sr) \ + ( (hrmode) ? ((sr) == 48000) || ((sr) == 96000) : LC3_CHECK_SR_HZ(sr) ) + /** * PCM Sample Format @@ -197,51 +207,71 @@ typedef LC3_DECODER_MEM_T(10000, 48000) lc3_decoder_mem_48k_t; /** * Return the number of PCM samples in a frame + * hrmode Enable High-Resolution mode (48000 and 96000 samplerates) * dt_us Frame duration in us, 2500, 5000, 7500 or 10000 - * sr_hz Samplerate in Hz, 8000, 16000, 24000, 32000 or 48000 + * sr_hz Samplerate in Hz, 8000, 16000, 24000, 32000, 48000 or 96000 * return Number of PCM samples, -1 on bad parameters */ +int lc3_hr_frame_samples(bool hrmode, int dt_us, int sr_hz); + int lc3_frame_samples(int dt_us, int sr_hz); /** * Return the size of frames, from bitrate + * hrmode Enable High-Resolution mode (48000 and 96000 samplerates) * dt_us Frame duration in us, 2500, 5000, 7500 or 10000 - * bitrate Target bitrate in bit per second + * sr_hz Samplerate in Hz, 8000, 16000, 24000, 32000, 48000 or 96000 + * bitrate Target bitrate in bit per second, 0 or `INT_MAX` returns + * respectively the minimum and maximum allowed size. * return The floor size in bytes of the frames, -1 on bad parameters */ +int lc3_hr_frame_bytes(bool hrmode, int dt_us, int sr_hz, int bitrate); + int lc3_frame_bytes(int dt_us, int bitrate); /** * Resolve the bitrate, from the size of frames + * hrmode Enable High-Resolution mode (48000 and 96000 samplerates) * dt_us Frame duration in us, 2500, 5000, 7500 or 10000 - * nbytes Size in bytes of the frames + * sr_hz Samplerate in Hz, 8000, 16000, 24000, 32000, 48000 or 96000 + * nbytes Size in bytes of the frames, 0 or `INT_MAX` returns + * respectively the minimum and maximum allowed bitrate. * return The according bitrate in bps, -1 on bad parameters */ +int lc3_hr_resolve_bitrate(bool hrmode, int dt_us, int sr_hz, int nbytes); + int lc3_resolve_bitrate(int dt_us, int nbytes); /** * Return algorithmic delay, as a number of samples + * hrmode Enable High-Resolution mode (48000 and 96000 samplerates) * dt_us Frame duration in us, 2500, 5000, 7500 or 10000 - * sr_hz Samplerate in Hz, 8000, 16000, 24000, 32000 or 48000 + * sr_hz Samplerate in Hz, 8000, 16000, 24000, 32000, 48000 or 96000 * return Number of algorithmic delay samples, -1 on bad parameters */ +int lc3_hr_delay_samples(bool hrmode, int dt_us, int sr_hz); + int lc3_delay_samples(int dt_us, int sr_hz); /** * Return size needed for an encoder + * hrmode Enable High-Resolution mode (48000 and 96000 samplerates) * dt_us Frame duration in us, 2500, 5000, 7500 or 10000 - * sr_hz Samplerate in Hz, 8000, 16000, 24000, 32000 or 48000 + * sr_hz Samplerate in Hz, 8000, 16000, 24000, 32000, 48000 or 96000 * return Size of then encoder in bytes, 0 on bad parameters * * The `sr_hz` parameter is the samplerate of the PCM input stream, - * and will match `sr_pcm_hz` of `lc3_setup_encoder()`. + * and will match `sr_pcm_hz` of `lc3_hr_setup_encoder()`. */ +unsigned lc3_hr_encoder_size(bool hrmode, int dt_us, int sr_hz); + unsigned lc3_encoder_size(int dt_us, int sr_hz); /** * Setup encoder + * hrmode Enable High-Resolution mode (48000 and 96000 samplerates) * dt_us Frame duration in us, 2500, 5000, 7500 or 10000 - * sr_hz Samplerate in Hz, 8000, 16000, 24000, 32000 or 48000 + * sr_hz Samplerate in Hz, 8000, 16000, 24000, 32000, 48000 or 96000 * sr_pcm_hz Input samplerate, downsampling option of input, or 0 * mem Encoder memory space, aligned to pointer type * return Encoder as an handle, NULL on bad parameters @@ -252,6 +282,9 @@ unsigned lc3_encoder_size(int dt_us, int sr_hz); * samplerate `sr_hz`. The size of the context needed, given by * `lc3_encoder_size()` will be set accordingly to `sr_pcm_hz`. */ +lc3_encoder_t lc3_hr_setup_encoder(bool hrmode, + int dt_us, int sr_hz, int sr_pcm_hz, void *mem); + lc3_encoder_t lc3_setup_encoder( int dt_us, int sr_hz, int sr_pcm_hz, void *mem); @@ -269,19 +302,23 @@ int lc3_encode(lc3_encoder_t encoder, enum lc3_pcm_format fmt, /** * Return size needed for an decoder + * hrmode Enable High-Resolution mode (48000 and 96000 samplerates) * dt_us Frame duration in us, 2500, 5000, 7500 or 10000 - * sr_hz Samplerate in Hz, 8000, 16000, 24000, 32000 or 48000 + * sr_hz Samplerate in Hz, 8000, 16000, 24000, 32000, 48000 or 96000 * return Size of then decoder in bytes, 0 on bad parameters * * The `sr_hz` parameter is the samplerate of the PCM output stream, * and will match `sr_pcm_hz` of `lc3_setup_decoder()`. */ +unsigned lc3_hr_decoder_size(bool hrmode, int dt_us, int sr_hz); + unsigned lc3_decoder_size(int dt_us, int sr_hz); /** * Setup decoder + * hrmode Enable High-Resolution mode (48000 and 96000 samplerates) * dt_us Frame duration in us, 2500, 5000, 7500 or 10000 - * sr_hz Samplerate in Hz, 8000, 16000, 24000, 32000 or 48000 + * sr_hz Samplerate in Hz, 8000, 16000, 24000, 32000, 48000 or 96000 * sr_pcm_hz Output samplerate, upsampling option of output (or 0) * mem Decoder memory space, aligned to pointer type * return Decoder as an handle, NULL on bad parameters @@ -292,6 +329,9 @@ unsigned lc3_decoder_size(int dt_us, int sr_hz); * samplerate `sr_hz`. The size of the context needed, given by * `lc3_decoder_size()` will be set accordingly to `sr_pcm_hz`. */ +lc3_decoder_t lc3_hr_setup_decoder(bool hrmode, + int dt_us, int sr_hz, int sr_pcm_hz, void *mem); + lc3_decoder_t lc3_setup_decoder( int dt_us, int sr_hz, int sr_pcm_hz, void *mem); diff --git a/include/lc3_cpp.h b/include/lc3_cpp.h index acd3d0b..d9f1619 100644 --- a/include/lc3_cpp.h +++ b/include/lc3_cpp.h @@ -50,11 +50,12 @@ enum class PcmFormat { template class Base { protected: - Base(int dt_us, int sr_hz, int sr_pcm_hz, size_t nchannels) + Base(int dt_us, int sr_hz, int sr_pcm_hz, size_t nchannels, bool hrmode) : dt_us_(dt_us), sr_hz_(sr_hz), sr_pcm_hz_(sr_pcm_hz == 0 ? sr_hz : sr_pcm_hz), - nchannels_(nchannels) { + nchannels_(nchannels), + hrmode_(hrmode) { states.reserve(nchannels_); } @@ -63,22 +64,27 @@ class Base { int dt_us_, sr_hz_; int sr_pcm_hz_; size_t nchannels_; + bool hrmode_; using state_ptr = std::unique_ptr; std::vector states; public: // Return the number of PCM samples in a frame - int GetFrameSamples() { return lc3_frame_samples(dt_us_, sr_pcm_hz_); } + int GetFrameSamples() { + return lc3_hr_frame_samples(hrmode_, dt_us_, sr_pcm_hz_); } // Return the size of frames, from bitrate - int GetFrameBytes(int bitrate) { return lc3_frame_bytes(dt_us_, bitrate); } + int GetFrameBytes(int bitrate) { + return lc3_hr_frame_bytes(hrmode_, dt_us_, sr_hz_, bitrate); } // Resolve the bitrate, from the size of frames - int ResolveBitrate(int nbytes) { return lc3_resolve_bitrate(dt_us_, nbytes); } + int ResolveBitrate(int nbytes) { + return lc3_hr_resolve_bitrate(hrmode_, dt_us_, sr_hz_, nbytes); } // Return algorithmic delay, as a number of samples - int GetDelaySamples() { return lc3_delay_samples(dt_us_, sr_pcm_hz_); } + int GetDelaySamples() { + return lc3_hr_delay_samples(hrmode_, dt_us_, sr_pcm_hz_); } }; // class Base @@ -101,21 +107,24 @@ class Encoder : public Base { public: // Encoder construction / destruction // - // The frame duration `dt_us` is 7500 or 10000 us. + // The frame duration `dt_us` is 2500, 5000, 7500 or 10000 us. // The samplerate `sr_hz` is 8000, 16000, 24000, 32000 or 48000 Hz. + // The `hrmode` flag enables the high-resolution mode, in which case + // the sample rate is 48000 or 96000 Hz. // // The `sr_pcm_hz` parameter is a downsampling option of PCM input, // the value 0 fallback to the samplerate of the encoded stream `sr_hz`. // When used, `sr_pcm_hz` is intended to be higher or equal to the encoder // samplerate `sr_hz`. - Encoder(int dt_us, int sr_hz, int sr_pcm_hz = 0, size_t nchannels = 1) - : Base(dt_us, sr_hz, sr_pcm_hz, nchannels) { + Encoder(int dt_us, int sr_hz, int sr_pcm_hz = 0, + size_t nchannels = 1, bool hrmode = false) + : Base(dt_us, sr_hz, sr_pcm_hz, nchannels, hrmode) { for (size_t ich = 0; ich < nchannels_; ich++) { - auto s = state_ptr( - (lc3_encoder_t)malloc(lc3_encoder_size(dt_us_, sr_pcm_hz_)), free); + auto s = state_ptr((lc3_encoder_t) + malloc(lc3_hr_encoder_size(hrmode_, dt_us_, sr_pcm_hz_)), free); - if (lc3_setup_encoder(dt_us_, sr_hz_, sr_pcm_hz_, s.get())) + if (lc3_setup_hr_encoder(hrmode_, dt_us_, sr_hz_, sr_pcm_hz_, s.get())) states.push_back(std::move(s)); } } @@ -126,7 +135,7 @@ class Encoder : public Base { void Reset() { for (auto &s : states) - lc3_setup_encoder(dt_us_, sr_hz_, sr_pcm_hz_, s.get()); + lc3_setup_hr_encoder(hrmode_, dt_us_, sr_hz_, sr_pcm_hz_, s.get()); } // Encode @@ -199,21 +208,24 @@ class Decoder : public Base { public: // Decoder construction / destruction // - // The frame duration `dt_us` is 7500 or 10000 us. + // The frame duration `dt_us` is 2500, 5000, 7500 or 10000 us. // The samplerate `sr_hz` is 8000, 16000, 24000, 32000 or 48000 Hz. + // The `hrmode` flag enables the high-resolution mode, in which case + // the sample rate is 48000 or 96000 Hz. // // The `sr_pcm_hz` parameter is an downsampling option of PCM output, // the value 0 fallback to the samplerate of the decoded stream `sr_hz`. // When used, `sr_pcm_hz` is intended to be higher or equal to the decoder // samplerate `sr_hz`. - Decoder(int dt_us, int sr_hz, int sr_pcm_hz = 0, size_t nchannels = 1) - : Base(dt_us, sr_hz, sr_pcm_hz, nchannels) { + Decoder(int dt_us, int sr_hz, int sr_pcm_hz = 0, + size_t nchannels = 1, bool hrmode = false) + : Base(dt_us, sr_hz, sr_pcm_hz, nchannels, hrmode) { for (size_t i = 0; i < nchannels_; i++) { - auto s = state_ptr( - (lc3_decoder_t)malloc(lc3_decoder_size(dt_us_, sr_pcm_hz_)), free); + auto s = state_ptr((lc3_decoder_t) + malloc(lc3_hr_decoder_size(hrmode_, dt_us_, sr_pcm_hz_)), free); - if (lc3_setup_decoder(dt_us_, sr_hz_, sr_pcm_hz_, s.get())) + if (lc3_setup_hr_decoder(hrmode_, dt_us_, sr_hz_, sr_pcm_hz_, s.get())) states.push_back(std::move(s)); } } @@ -224,7 +236,7 @@ class Decoder : public Base { void Reset() { for (auto &s : states) - lc3_setup_decoder(dt_us_, sr_hz_, sr_pcm_hz_, s.get()); + lc3_setup_hr_decoder(hrmode_, dt_us_, sr_hz_, sr_pcm_hz_, s.get()); } // Decode diff --git a/include/lc3_private.h b/include/lc3_private.h index 537337d..d7e93fd 100644 --- a/include/lc3_private.h +++ b/include/lc3_private.h @@ -24,30 +24,32 @@ /** - * Return number of samples, delayed samples and - * encoded spectrum coefficients within a frame. + * Characteristics * - * - The number of MDCT delayed samples is the sum of half a frame and + * - The number of samples within a frame + * + * - The number of MDCT delayed samples, sum of half a frame and * an ovelap of future by 1.25 ms (2.5ms, 5ms and 10ms frame durations) * or 2 ms (7.5ms frame duration). * + * - For decoding, keep 18 ms of history, aligned on a frame + * * - For encoding, keep 1.25 ms of temporal previous samples - * - For decoding, keep 18 ms of history, aligned on frames, and a frame */ -#define __LC3_NS(dt_us, sr_hz) \ +#define LC3_NS(dt_us, sr_hz) \ ( (dt_us) * (sr_hz) / 1000 / 1000 ) -#define __LC3_ND(dt_us, sr_hz) \ - ( __LC3_NS(dt_us, sr_hz) / 2 + \ - __LC3_NS((dt_us) == 7500 ? 2000 : 1250, sr_hz) ) +#define LC3_ND(dt_us, sr_hz) \ + ( LC3_NS(dt_us, sr_hz) / 2 + \ + LC3_NS((dt_us) == 7500 ? 2000 : 1250, sr_hz) ) -#define __LC3_NT(sr_hz) \ - ( __LC3_NS(1250, sr_hz) ) +#define LC3_NH(dt_us, sr_hz) \ + ( (sr_hz) > 48000 ? 0 : ( LC3_NS(18000, sr_hz) + \ + LC3_NS(dt_us, sr_hz) - (LC3_NS(18000, sr_hz) % LC3_NS(dt_us, sr_hz)) ) ) -#define __LC3_NH(dt_us, sr_hz) \ - ( __LC3_NS(18000, sr_hz) + 2*__LC3_NS(dt_us, sr_hz) - \ - (__LC3_NS(18000, sr_hz) % __LC3_NS(dt_us, sr_hz)) ) +#define LC3_NT(sr_hz) \ + ( LC3_NS(1250, sr_hz) ) /** @@ -65,17 +67,19 @@ enum lc3_dt { /** - * Sampling frequency + * Sampling frequency and high-resolution mode */ enum lc3_srate { - LC3_SRATE_8K = 0, - LC3_SRATE_16K = 1, - LC3_SRATE_24K = 2, - LC3_SRATE_32K = 3, - LC3_SRATE_48K = 4, + LC3_SRATE_8K, + LC3_SRATE_16K, + LC3_SRATE_24K, + LC3_SRATE_32K, + LC3_SRATE_48K, + LC3_SRATE_48K_HR, + LC3_SRATE_96K_HR, - LC3_NUM_SRATE, + LC3_NUM_SRATE }; @@ -121,8 +125,8 @@ struct lc3_encoder { }; #define LC3_ENCODER_BUFFER_COUNT(dt_us, sr_hz) \ - ( ( __LC3_NS(dt_us, sr_hz) + __LC3_NT(sr_hz) ) / 2 + \ - __LC3_NS(dt_us, sr_hz) + __LC3_ND(dt_us, sr_hz) ) + ( ( LC3_NS(dt_us, sr_hz) + LC3_NT(sr_hz) ) / 2 + \ + LC3_NS(dt_us, sr_hz) + LC3_ND(dt_us, sr_hz) ) #define LC3_ENCODER_MEM_T(dt_us, sr_hz) \ struct { \ @@ -159,8 +163,8 @@ struct lc3_decoder { }; #define LC3_DECODER_BUFFER_COUNT(dt_us, sr_hz) \ - ( __LC3_NH(dt_us, sr_hz) + __LC3_ND(dt_us, sr_hz) + \ - __LC3_NS(dt_us, sr_hz) ) + ( LC3_NH(dt_us, sr_hz) + LC3_NS(dt_us, sr_hz) + \ + LC3_ND(dt_us, sr_hz) + LC3_NS(dt_us, sr_hz) ) #define LC3_DECODER_MEM_T(dt_us, sr_hz) \ struct { \ diff --git a/src/attdet.c b/src/attdet.c index 9e6f08b..b498ef9 100644 --- a/src/attdet.c +++ b/src/attdet.c @@ -32,7 +32,7 @@ bool lc3_attdet_run(enum lc3_dt dt, enum lc3_srate sr, [LC3_DT_10M - LC3_DT_7M5] = { { 81, INT_MAX }, { 100, INT_MAX } }, }; - if (dt < LC3_DT_7M5 || sr < LC3_SRATE_32K || + if (dt < LC3_DT_7M5 || sr < LC3_SRATE_32K || lc3_hr(sr) || nbytes < nbytes_ranges[dt - LC3_DT_7M5][sr - LC3_SRATE_32K][0] || nbytes > nbytes_ranges[dt - LC3_DT_7M5][sr - LC3_SRATE_32K][1] ) return 0; diff --git a/src/bwdet.c b/src/bwdet.c index aa815b1..0c48939 100644 --- a/src/bwdet.c +++ b/src/bwdet.c @@ -29,48 +29,46 @@ enum lc3_bandwidth lc3_bwdet_run( struct region { int is : 8; int ie : 8; }; -#if !LC3_NPLUS +#if LC3_PLUS - static const struct region bws_table_2m5[][LC3_NUM_BANDWIDTH-1] = { + static const struct region bws_table_2m5[][LC3_BANDWIDTH_SWB+1] = { { { 24, 34+1 } }, { { 24, 32+1 }, { 35, 39+1 } }, { { 24, 31+1 }, { 33, 38+1 }, { 39, 42+1 } }, { { 22, 29+1 }, { 31, 35+1 }, { 37, 40+1 }, { 41, 43+1 } }, }; - static const struct region bws_table_5m[][LC3_NUM_BANDWIDTH-1] = { + static const struct region bws_table_5m[][LC3_BANDWIDTH_SWB+1] = { { { 39, 49+1 } }, { { 35, 44+1 }, { 47, 51+1 } }, { { 34, 42+1 }, { 44, 49+1 }, { 50, 53+1 } }, { { 32, 40+1 }, { 42, 46+1 }, { 48, 51+1 }, { 52, 54+1 } }, }; -#endif /* !LC3_NPLUS */ +#endif /* LC3_PLUS */ - static const struct region bws_table_7m5[][LC3_NUM_BANDWIDTH-1] = { + static const struct region bws_table_7m5[][LC3_BANDWIDTH_SWB+1] = { { { 51, 63+1 } }, { { 45, 55+1 }, { 58, 63+1 } }, { { 42, 51+1 }, { 53, 58+1 }, { 60, 63+1 } }, { { 40, 48+1 }, { 51, 55+1 }, { 57, 60+1 }, { 61, 63+1 } }, }; - static const struct region bws_table_10m[][LC3_NUM_BANDWIDTH-1] = { + static const struct region bws_table_10m[][LC3_BANDWIDTH_SWB+1] = { { { 53, 63+1 } }, { { 47, 56+1 }, { 59, 63+1 } }, { { 44, 52+1 }, { 54, 59+1 }, { 60, 63+1 } }, { { 41, 49+1 }, { 51, 55+1 }, { 57, 60+1 }, { 61, 63+1 } }, }; - static const struct region (*bws_table[])[LC3_NUM_BANDWIDTH-1] = { -#if !LC3_NPLUS - [LC3_DT_2M5] = bws_table_2m5, - [LC3_DT_5M ] = bws_table_5m, -#endif /* !LC3_NPLUS */ + static const struct region (*bws_table[])[LC3_BANDWIDTH_SWB+1] = { + [LC3_DT_2M5] = LC3_IF_PLUS(bws_table_2m5, NULL), + [LC3_DT_5M ] = LC3_IF_PLUS(bws_table_5m , NULL), [LC3_DT_7M5] = bws_table_7m5, [LC3_DT_10M] = bws_table_10m, }; - static const int l_table[LC3_NUM_DT][LC3_NUM_BANDWIDTH-1] = { + static const int l_table[LC3_NUM_DT][LC3_BANDWIDTH_SWB+1] = { [LC3_DT_2M5] = { 4, 4, 3, 1 }, [LC3_DT_5M ] = { 4, 4, 3, 1 }, [LC3_DT_7M5] = { 4, 4, 3, 2 }, @@ -83,7 +81,7 @@ enum lc3_bandwidth lc3_bwdet_run( enum lc3_bandwidth bw0 = LC3_BANDWIDTH_NB; enum lc3_bandwidth bwn = (enum lc3_bandwidth)sr; - if (bwn <= bw0) + if (bwn <= bw0 || lc3_hr(sr)) return bwn; const struct region *bwr = bws_table[dt][bwn-1]; @@ -126,7 +124,7 @@ enum lc3_bandwidth lc3_bwdet_run( */ int lc3_bwdet_get_nbits(enum lc3_srate sr) { - return (sr > 0) + (sr > 1) + (sr > 3); + return lc3_hr(sr) ? 0 : (sr > 0) + (sr > 1) + (sr > 3); } /** @@ -149,6 +147,8 @@ int lc3_bwdet_get_bw(lc3_bits_t *bits, enum lc3_bandwidth max_bw = (enum lc3_bandwidth)sr; int nbits_bw = lc3_bwdet_get_nbits(sr); - *bw = nbits_bw > 0 ? lc3_get_bits(bits, nbits_bw) : LC3_BANDWIDTH_NB; + *bw = nbits_bw <= 0 ? max_bw : + (enum lc3_bandwidth)lc3_get_bits(bits, nbits_bw); + return *bw > max_bw ? (*bw = max_bw), -1 : 0; } diff --git a/src/common.h b/src/common.h index 60ae1fd..3af29e5 100644 --- a/src/common.h +++ b/src/common.h @@ -31,6 +31,31 @@ #endif +/** + * Acivation flags for LC3-Plus and LC3-Plus HR features + */ + +#ifndef LC3_PLUS +#define LC3_PLUS 1 +#endif + +#ifndef LC3_PLUS_HR +#define LC3_PLUS_HR 1 +#endif + +#if LC3_PLUS +#define LC3_IF_PLUS(a, b) (a) +#else +#define LC3_IF_PLUS(a, b) (b) +#endif + +#if LC3_PLUS_HR +#define LC3_IF_PLUS_HR(a, b) (a) +#else +#define LC3_IF_PLUS_HR(a, b) (b) +#endif + + /** * Hot Function attribute * Selectively disable sanitizer @@ -49,6 +74,7 @@ #endif /* __clang__ */ + /** * Macros * MIN/MAX Minimum and maximum between 2 values @@ -79,51 +105,11 @@ /** - * Convert `dt` in us and `sr` in KHz + * Return `true` when high-resolution mode */ - -#define LC3_DT_US(dt) \ - ( (1 + (dt)) * 2500 ) - -#define LC3_SRATE_KHZ(sr) \ - ( (1 + (sr) + ((sr) == LC3_SRATE_48K)) * 8 ) - - -/** - * Return number of samples, delayed samples and - * encoded spectrum coefficients within a frame - * - * - The number of MDCT delayed samples is the sum of half a frame and - * an ovelap of future by 1.25 ms (2.5ms, 5ms and 10ms frame durations) - * or 2 ms (7.5ms frame duration). - * - * - For encoding, keep 1.25 ms of temporal previous samples - * - For decoding, keep 18 ms of history, aligned on frames, and a frame - */ - -#define LC3_NS(dt, sr) \ - ( 20 * (1 + (dt)) * (1 + (sr) + ((sr) == LC3_SRATE_48K)) ) - -#define LC3_NE(dt, sr) \ - ( 20 * (1 + (dt)) * (1 + (sr)) ) - -#define LC3_MAX_NS \ - LC3_NS(LC3_DT_10M, LC3_SRATE_48K) - -#define LC3_MAX_NE \ - LC3_NE(LC3_DT_10M, LC3_SRATE_48K) - -#define LC3_ND(dt, sr) \ - ( LC3_NS(dt, sr) / 2 + \ - (5 + 3*((dt) == LC3_DT_7M5)) * LC3_SRATE_KHZ(sr) / 4 ) - -#define LC3_NT(sr_hz) \ - ( (5 * LC3_SRATE_KHZ(sr)) / 4 ) - -#define LC3_NH(dt, sr) \ - ( ((dt == LC3_DT_2M5 ? 8 : \ - dt == LC3_DT_5M ? 4 : \ - dt == LC3_DT_7M5 ? 3 : 2) + 1) * LC3_NS(dt, sr) ) +static inline bool lc3_hr(enum lc3_srate sr) { + return LC3_PLUS_HR && (sr >= LC3_SRATE_48K_HR); +} /** @@ -137,6 +123,9 @@ enum lc3_bandwidth { LC3_BANDWIDTH_SWB = LC3_SRATE_32K, LC3_BANDWIDTH_FB = LC3_SRATE_48K, + LC3_BANDWIDTH_FB_HR = LC3_SRATE_48K_HR, + LC3_BANDWIDTH_UB_HR = LC3_SRATE_96K_HR, + LC3_NUM_BANDWIDTH, }; diff --git a/src/energy.c b/src/energy.c index 21d5515..ffa3f78 100644 --- a/src/energy.c +++ b/src/energy.c @@ -26,10 +26,10 @@ bool lc3_energy_compute( enum lc3_dt dt, enum lc3_srate sr, const float *x, float *e) { - /* Mean the square of coefficients within each band */ - int nb = lc3_num_bands[dt][sr]; - const uint16_t *lim = lc3_band_lim[dt][sr]; + const int *lim = lc3_band_lim[dt][sr]; + + /* Mean the square of coefficients within each band */ float e_sum[2] = { 0, 0 }; int iband_h = nb - (const int []){ diff --git a/src/fastmath.h b/src/fastmath.h index 5ff7081..f07f3c1 100644 --- a/src/fastmath.h +++ b/src/fastmath.h @@ -28,7 +28,7 @@ * x Operand, range -8 to 8 * return 2^x approximation (max relative error ~ 7e-6) */ -static inline float fast_exp2f(float x) +static inline float lc3_exp2f(float x) { float y; @@ -59,7 +59,7 @@ static inline float fast_exp2f(float x) * x Operand, greater than 0 * return log2(x) approximation (max absolute error ~ 1e-4) */ -static inline float fast_log2f(float x) +static inline float lc3_log2f(float x) { float y; int e; @@ -87,9 +87,9 @@ static inline float fast_log2f(float x) * x Operand, greater than 0 * return log10(x) approximation (max absolute error ~ 1e-4) */ -static inline float fast_log10f(float x) +static inline float lc3_log10f(float x) { - return log10f(2) * fast_log2f(x); + return log10f(2) * lc3_log2f(x); } /** @@ -100,7 +100,7 @@ static inline float fast_log10f(float x) * - The 0 value is accepted and return the minimum value ~ -191dB * - This function assumed that float 32 bits is coded IEEE 754 */ -static inline int32_t fast_db_q16(float x) +static inline int32_t lc3_db_q16(float x) { /* --- Table in Q15 --- */ diff --git a/src/lc3.c b/src/lc3.c index 090ec30..dc7ebe7 100644 --- a/src/lc3.c +++ b/src/lc3.c @@ -53,92 +53,118 @@ struct side_data { /** * Resolve frame duration in us * us Frame duration in us + * hrmode High-resolution mode indication * return Frame duration identifier, or LC3_NUM_DT */ -static enum lc3_dt resolve_dt(int us) +static enum lc3_dt resolve_dt(int us, bool hrmode) { - return us == 2500 ? LC3_DT_2M5 : - us == 5000 ? LC3_DT_5M : - us == 7500 ? LC3_DT_7M5 : - us == 10000 ? LC3_DT_10M : LC3_NUM_DT; + return LC3_PLUS && us == 2500 ? LC3_DT_2M5 : + LC3_PLUS && us == 5000 ? LC3_DT_5M : + !hrmode && us == 7500 ? LC3_DT_7M5 : + us == 10000 ? LC3_DT_10M : LC3_NUM_DT; } /** * Resolve samplerate in Hz * hz Samplerate in Hz + * hrmode High-resolution mode indication * return Sample rate identifier, or LC3_NUM_SRATE */ -static enum lc3_srate resolve_sr(int hz) +static enum lc3_srate resolve_srate(int hz, bool hrmode) { - return hz == 8000 ? LC3_SRATE_8K : hz == 16000 ? LC3_SRATE_16K : - hz == 24000 ? LC3_SRATE_24K : hz == 32000 ? LC3_SRATE_32K : - hz == 48000 ? LC3_SRATE_48K : LC3_NUM_SRATE; + hrmode = LC3_PLUS_HR && hrmode; + + return !hrmode && hz == 8000 ? LC3_SRATE_8K : + !hrmode && hz == 16000 ? LC3_SRATE_16K : + !hrmode && hz == 24000 ? LC3_SRATE_24K : + !hrmode && hz == 32000 ? LC3_SRATE_32K : + !hrmode && hz == 48000 ? LC3_SRATE_48K : + hrmode && hz == 48000 ? LC3_SRATE_48K_HR : + hrmode && hz == 96000 ? LC3_SRATE_96K_HR : LC3_NUM_SRATE; } /** * Return the number of PCM samples in a frame */ -int lc3_frame_samples(int dt_us, int sr_hz) +int lc3_hr_frame_samples(bool hrmode, int dt_us, int sr_hz) { - enum lc3_dt dt = resolve_dt(dt_us); - enum lc3_srate sr = resolve_sr(sr_hz); + enum lc3_dt dt = resolve_dt(dt_us, hrmode); + enum lc3_srate sr = resolve_srate(sr_hz, hrmode); if (dt >= LC3_NUM_DT || sr >= LC3_NUM_SRATE) return -1; - return LC3_NS(dt, sr); + return lc3_ns(dt, sr); +} + +int lc3_frame_samples(int dt_us, int sr_hz) +{ + return lc3_hr_frame_samples(false, dt_us, sr_hz); } /** * Return the size of frames, from bitrate */ -int lc3_frame_bytes(int dt_us, int bitrate) +int lc3_hr_frame_bytes(bool hrmode, int dt_us, int sr_hz, int bitrate) { - if (resolve_dt(dt_us) >= LC3_NUM_DT) + enum lc3_dt dt = resolve_dt(dt_us, hrmode); + enum lc3_srate sr = resolve_srate(sr_hz, hrmode); + + if (dt >= LC3_NUM_DT || sr >= LC3_NUM_SRATE) return -1; - if (bitrate < LC3_MIN_BITRATE) - return LC3_MIN_FRAME_BYTES; + bitrate = LC3_CLIP(bitrate, + lc3_hr_resolve_bitrate(hrmode, dt_us, sr_hz, 0), + lc3_hr_resolve_bitrate(hrmode, dt_us, sr_hz, INT_MAX)); - if (bitrate > LC3_MAX_BITRATE) - return LC3_MAX_FRAME_BYTES; + return (bitrate * (1 + dt)) / 3200; +} - int nbytes = ((unsigned)bitrate * dt_us) / (1000*1000*8); - - return LC3_CLIP(nbytes, LC3_MIN_FRAME_BYTES, LC3_MAX_FRAME_BYTES); +int lc3_frame_bytes(int dt_us, int bitrate) +{ + return lc3_hr_frame_bytes(false, dt_us, 8000, bitrate); } /** * Resolve the bitrate, from the size of frames */ -int lc3_resolve_bitrate(int dt_us, int nbytes) +int lc3_hr_resolve_bitrate(bool hrmode, int dt_us, int sr_hz, int nbytes) { - if (resolve_dt(dt_us) >= LC3_NUM_DT) + enum lc3_dt dt = resolve_dt(dt_us, hrmode); + enum lc3_srate sr = resolve_srate(sr_hz, hrmode); + + if (dt >= LC3_NUM_DT || sr >= LC3_NUM_SRATE) return -1; - if (nbytes < LC3_MIN_FRAME_BYTES) - return LC3_MIN_BITRATE; + nbytes = LC3_CLIP(nbytes, + lc3_min_frame_bytes(dt, sr), + lc3_max_frame_bytes(dt, sr)); - if (nbytes > LC3_MAX_FRAME_BYTES) - return LC3_MAX_BITRATE; + return (nbytes * 3200) / (1 + dt); +} - int bitrate = ((unsigned)nbytes * (1000*1000*8) + dt_us/2) / dt_us; - - return LC3_CLIP(bitrate, LC3_MIN_BITRATE, LC3_MAX_BITRATE); +int lc3_resolve_bitrate(int dt_us, int nbytes) +{ + return lc3_hr_resolve_bitrate(false, dt_us, 8000, nbytes); } /** * Return algorithmic delay, as a number of samples */ -int lc3_delay_samples(int dt_us, int sr_hz) +int lc3_hr_delay_samples(bool hrmode, int dt_us, int sr_hz) { - enum lc3_dt dt = resolve_dt(dt_us); - enum lc3_srate sr = resolve_sr(sr_hz); + enum lc3_dt dt = resolve_dt(dt_us, hrmode); + enum lc3_srate sr = resolve_srate(sr_hz, hrmode); if (dt >= LC3_NUM_DT || sr >= LC3_NUM_SRATE) return -1; - return (dt == LC3_DT_7M5 ? 8 : 5) * (LC3_SRATE_KHZ(sr) / 2); + return 2 * lc3_nd(dt, sr) - lc3_ns(dt, sr); +} + +int lc3_delay_samples(int dt_us, int sr_hz) +{ + return lc3_hr_delay_samples(false, dt_us, sr_hz); } @@ -161,7 +187,7 @@ static void load_s16( int16_t *xt = (int16_t *)encoder->x + encoder->xt_off; float *xs = encoder->x + encoder->xs_off; - int ns = LC3_NS(dt, sr); + int ns = lc3_ns(dt, sr); for (int i = 0; i < ns; i++, pcm += stride) xt[i] = *pcm, xs[i] = *pcm; @@ -182,7 +208,7 @@ static void load_s24( int16_t *xt = (int16_t *)encoder->x + encoder->xt_off; float *xs = encoder->x + encoder->xs_off; - int ns = LC3_NS(dt, sr); + int ns = lc3_ns(dt, sr); for (int i = 0; i < ns; i++, pcm += stride) { xt[i] = *pcm >> 8; @@ -205,7 +231,7 @@ static void load_s24_3le( int16_t *xt = (int16_t *)encoder->x + encoder->xt_off; float *xs = encoder->x + encoder->xs_off; - int ns = LC3_NS(dt, sr); + int ns = lc3_ns(dt, sr); for (int i = 0; i < ns; i++, pcm += 3*stride) { int32_t in = ((uint32_t)pcm[0] << 8) | @@ -232,7 +258,7 @@ static void load_float( int16_t *xt = (int16_t *)encoder->x + encoder->xt_off; float *xs = encoder->x + encoder->xs_off; - int ns = LC3_NS(dt, sr); + int ns = lc3_ns(dt, sr); for (int i = 0; i < ns; i++, pcm += stride) { xs[i] = ldexpf(*pcm, 15); @@ -244,19 +270,20 @@ static void load_float( * Frame Analysis * encoder Encoder state * nbytes Size in bytes of the frame - * side, xq Return frame data + * side Return frame data */ static void analyze(struct lc3_encoder *encoder, - int nbytes, struct side_data *side, uint16_t *xq) + int nbytes, struct side_data *side) { enum lc3_dt dt = encoder->dt; enum lc3_srate sr = encoder->sr; enum lc3_srate sr_pcm = encoder->sr_pcm; - int ns = LC3_NS(dt, sr_pcm); - int nt = LC3_NT(sr_pcm); int16_t *xt = (int16_t *)encoder->x + encoder->xt_off; float *xs = encoder->x + encoder->xs_off; + int ns = lc3_ns(dt, sr_pcm); + int nt = lc3_nt(sr_pcm); + float *xd = encoder->x + encoder->xd_off; float *xf = xs; @@ -281,29 +308,30 @@ static void analyze(struct lc3_encoder *encoder, side->bw = lc3_bwdet_run(dt, sr, e); - lc3_sns_analyze(dt, sr, e, att, &side->sns, xf, xf); + lc3_sns_analyze(dt, sr, nbytes, e, att, &side->sns, xf, xf); lc3_tns_analyze(dt, side->bw, nn_flag, nbytes, &side->tns, xf); lc3_spec_analyze(dt, sr, nbytes, side->pitch_present, &side->tns, - &encoder->spec, xf, xq, &side->spec); + &encoder->spec, xf, &side->spec); } /** * Encode bitstream * encoder Encoder state - * side, xq The frame data + * side The frame data * nbytes Target size of the frame (20 to 400) * buffer Output bitstream buffer of `nbytes` size */ static void encode(struct lc3_encoder *encoder, - const struct side_data *side, uint16_t *xq, int nbytes, void *buffer) + const struct side_data *side, int nbytes, void *buffer) { enum lc3_dt dt = encoder->dt; enum lc3_srate sr = encoder->sr; - enum lc3_bandwidth bw = side->bw; + float *xf = encoder->x + encoder->xs_off; + enum lc3_bandwidth bw = side->bw; lc3_bits_t bits; @@ -322,8 +350,7 @@ static void encode(struct lc3_encoder *encoder, if (side->pitch_present) lc3_ltpf_put_data(&bits, &side->ltpf); - lc3_spec_encode(&bits, - dt, sr, bw, nbytes, xq, &side->spec, xf); + lc3_spec_encode(&bits, dt, sr, bw, nbytes, &side->spec, xf); lc3_flush_bits(&bits); } @@ -331,35 +358,40 @@ static void encode(struct lc3_encoder *encoder, /** * Return size needed for an encoder */ -unsigned lc3_encoder_size(int dt_us, int sr_hz) +unsigned lc3_hr_encoder_size(bool hrmode, int dt_us, int sr_hz) { - if (resolve_dt(dt_us) >= LC3_NUM_DT || - resolve_sr(sr_hz) >= LC3_NUM_SRATE) + if (resolve_dt(dt_us, hrmode) >= LC3_NUM_DT || + resolve_srate(sr_hz, hrmode) >= LC3_NUM_SRATE) return 0; return sizeof(struct lc3_encoder) + (LC3_ENCODER_BUFFER_COUNT(dt_us, sr_hz)-1) * sizeof(float); } +unsigned lc3_encoder_size(int dt_us, int sr_hz) +{ + return lc3_hr_encoder_size(false, dt_us, sr_hz); +} + /** * Setup encoder */ -struct lc3_encoder *lc3_setup_encoder( +struct lc3_encoder *lc3_hr_setup_encoder(bool hrmode, int dt_us, int sr_hz, int sr_pcm_hz, void *mem) { if (sr_pcm_hz <= 0) sr_pcm_hz = sr_hz; - enum lc3_dt dt = resolve_dt(dt_us); - enum lc3_srate sr = resolve_sr(sr_hz); - enum lc3_srate sr_pcm = resolve_sr(sr_pcm_hz); + enum lc3_dt dt = resolve_dt(dt_us, hrmode); + enum lc3_srate sr = resolve_srate(sr_hz, hrmode); + enum lc3_srate sr_pcm = resolve_srate(sr_pcm_hz, hrmode); if (dt >= LC3_NUM_DT || sr_pcm >= LC3_NUM_SRATE || sr > sr_pcm || !mem) return NULL; struct lc3_encoder *encoder = mem; - int ns = LC3_NS(dt, sr_pcm); - int nt = LC3_NT(sr_pcm); + int ns = lc3_ns(dt, sr_pcm); + int nt = lc3_nt(sr_pcm); *encoder = (struct lc3_encoder){ .dt = dt, .sr = sr, @@ -376,6 +408,12 @@ struct lc3_encoder *lc3_setup_encoder( return encoder; } +struct lc3_encoder *lc3_setup_encoder( + int dt_us, int sr_hz, int sr_pcm_hz, void *mem) +{ + return lc3_hr_setup_encoder(false, dt_us, sr_hz, sr_pcm_hz, mem); +} + /** * Encode a frame */ @@ -391,20 +429,19 @@ int lc3_encode(struct lc3_encoder *encoder, enum lc3_pcm_format fmt, /* --- Check parameters --- */ - if (!encoder || nbytes < LC3_MIN_FRAME_BYTES - || nbytes > LC3_MAX_FRAME_BYTES) + if (!encoder || nbytes < lc3_min_frame_bytes(encoder->dt, encoder->sr) + || nbytes > lc3_max_frame_bytes(encoder->dt, encoder->sr)) return -1; /* --- Processing --- */ struct side_data side; - uint16_t xq[LC3_MAX_NE]; load[fmt](encoder, pcm, stride); - analyze(encoder, nbytes, &side, xq); + analyze(encoder, nbytes, &side); - encode(encoder, &side, xq, nbytes, out); + encode(encoder, &side, nbytes, out); return 0; } @@ -428,7 +465,7 @@ static void store_s16( enum lc3_srate sr = decoder->sr_pcm; float *xs = decoder->x + decoder->xs_off; - int ns = LC3_NS(dt, sr); + int ns = lc3_ns(dt, sr); for ( ; ns > 0; ns--, xs++, pcm += stride) { int32_t s = *xs >= 0 ? (int)(*xs + 0.5f) : (int)(*xs - 0.5f); @@ -450,7 +487,7 @@ static void store_s24( enum lc3_srate sr = decoder->sr_pcm; float *xs = decoder->x + decoder->xs_off; - int ns = LC3_NS(dt, sr); + int ns = lc3_ns(dt, sr); for ( ; ns > 0; ns--, xs++, pcm += stride) { int32_t s = *xs >= 0 ? (int32_t)(ldexpf(*xs, 8) + 0.5f) @@ -473,7 +510,7 @@ static void store_s24_3le( enum lc3_srate sr = decoder->sr_pcm; float *xs = decoder->x + decoder->xs_off; - int ns = LC3_NS(dt, sr); + int ns = lc3_ns(dt, sr); for ( ; ns > 0; ns--, xs++, pcm += 3*stride) { int32_t s = *xs >= 0 ? (int32_t)(ldexpf(*xs, 8) + 0.5f) @@ -500,7 +537,7 @@ static void store_float( enum lc3_srate sr = decoder->sr_pcm; float *xs = decoder->x + decoder->xs_off; - int ns = LC3_NS(dt, sr); + int ns = lc3_ns(dt, sr); for ( ; ns > 0; ns--, xs++, pcm += stride) { float s = ldexpf(*xs, -15); @@ -522,8 +559,8 @@ static int decode(struct lc3_decoder *decoder, enum lc3_srate sr = decoder->sr; float *xf = decoder->x + decoder->xs_off; - int ns = LC3_NS(dt, sr); - int ne = LC3_NE(dt, sr); + int ns = lc3_ns(dt, sr); + int ne = lc3_ne(dt, sr); lc3_bits_t bits; int ret = 0; @@ -545,7 +582,7 @@ static int decode(struct lc3_decoder *decoder, return ret; if (side->pitch_present) - lc3_ltpf_get_data(&bits, &side->ltpf); + lc3_ltpf_get_data(&bits, &side->ltpf); if ((ret = lc3_spec_decode(&bits, dt, sr, side->bw, nbytes, &side->spec, xf)) < 0) @@ -570,8 +607,8 @@ static void synthesize(struct lc3_decoder *decoder, enum lc3_srate sr_pcm = decoder->sr_pcm; float *xf = decoder->x + decoder->xs_off; - int ns = LC3_NS(dt, sr_pcm); - int ne = LC3_NE(dt, sr); + int ns = lc3_ns(dt, sr_pcm); + int ne = lc3_ne(dt, sr); float *xg = decoder->x + decoder->xg_off; float *xs = xf; @@ -598,8 +635,9 @@ static void synthesize(struct lc3_decoder *decoder, lc3_mdct_inverse(dt, sr_pcm, sr, xf, xd, xs); } - lc3_ltpf_synthesize(dt, sr_pcm, nbytes, &decoder->ltpf, - side && side->pitch_present ? &side->ltpf : NULL, xh, xs); + if (!lc3_hr(sr)) + lc3_ltpf_synthesize(dt, sr_pcm, nbytes, &decoder->ltpf, + side && side->pitch_present ? &side->ltpf : NULL, xh, xs); } /** @@ -610,55 +648,60 @@ static void complete(struct lc3_decoder *decoder) { enum lc3_dt dt = decoder->dt; enum lc3_srate sr_pcm = decoder->sr_pcm; - int nh = LC3_NH(dt, sr_pcm); - int ns = LC3_NS(dt, sr_pcm); + int nh = lc3_nh(dt, sr_pcm); + int ns = lc3_ns(dt, sr_pcm); - decoder->xs_off = decoder->xs_off - decoder->xh_off < nh - ns ? + decoder->xs_off = decoder->xs_off - decoder->xh_off < nh ? decoder->xs_off + ns : decoder->xh_off; } /** * Return size needed for a decoder */ -unsigned lc3_decoder_size(int dt_us, int sr_hz) +unsigned lc3_hr_decoder_size(bool hrmode, int dt_us, int sr_hz) { - if (resolve_dt(dt_us) >= LC3_NUM_DT || - resolve_sr(sr_hz) >= LC3_NUM_SRATE) + if (resolve_dt(dt_us, hrmode) >= LC3_NUM_DT || + resolve_srate(sr_hz, hrmode) >= LC3_NUM_SRATE) return 0; return sizeof(struct lc3_decoder) + (LC3_DECODER_BUFFER_COUNT(dt_us, sr_hz)-1) * sizeof(float); } +unsigned lc3_decoder_size(int dt_us, int sr_hz) +{ + return lc3_hr_decoder_size(false, dt_us, sr_hz); +} + /** * Setup decoder */ -struct lc3_decoder *lc3_setup_decoder( +struct lc3_decoder *lc3_hr_setup_decoder(bool hrmode, int dt_us, int sr_hz, int sr_pcm_hz, void *mem) { if (sr_pcm_hz <= 0) sr_pcm_hz = sr_hz; - enum lc3_dt dt = resolve_dt(dt_us); - enum lc3_srate sr = resolve_sr(sr_hz); - enum lc3_srate sr_pcm = resolve_sr(sr_pcm_hz); + enum lc3_dt dt = resolve_dt(dt_us, hrmode); + enum lc3_srate sr = resolve_srate(sr_hz, hrmode); + enum lc3_srate sr_pcm = resolve_srate(sr_pcm_hz, hrmode); if (dt >= LC3_NUM_DT || sr_pcm >= LC3_NUM_SRATE || sr > sr_pcm || !mem) return NULL; struct lc3_decoder *decoder = mem; - int nh = LC3_NH(dt, sr_pcm); - int ns = LC3_NS(dt, sr_pcm); - int nd = LC3_ND(dt, sr_pcm); + int nh = lc3_nh(dt, sr_pcm); + int ns = lc3_ns(dt, sr_pcm); + int nd = lc3_nd(dt, sr_pcm); *decoder = (struct lc3_decoder){ .dt = dt, .sr = sr, .sr_pcm = sr_pcm, .xh_off = 0, - .xs_off = nh - ns, - .xd_off = nh, - .xg_off = nh + nd, + .xs_off = nh, + .xd_off = nh + ns, + .xg_off = nh + ns + nd, }; lc3_plc_reset(&decoder->plc); @@ -669,6 +712,12 @@ struct lc3_decoder *lc3_setup_decoder( return decoder; } +struct lc3_decoder *lc3_setup_decoder( + int dt_us, int sr_hz, int sr_pcm_hz, void *mem) +{ + return lc3_hr_setup_decoder(false, dt_us, sr_hz, sr_pcm_hz, mem); +} + /** * Decode a frame */ @@ -687,8 +736,8 @@ int lc3_decode(struct lc3_decoder *decoder, const void *in, int nbytes, if (!decoder) return -1; - if (in && (nbytes < LC3_MIN_FRAME_BYTES || - nbytes > LC3_MAX_FRAME_BYTES )) + if (in && (nbytes < lc3_min_frame_bytes(decoder->dt, decoder->sr) || + nbytes > lc3_max_frame_bytes(decoder->dt, decoder->sr) )) return -1; /* --- Processing --- */ diff --git a/src/ltpf.c b/src/ltpf.c index 8e538e8..08cbae6 100644 --- a/src/ltpf.c +++ b/src/ltpf.c @@ -144,6 +144,36 @@ static const int16_t h_48k_12k8_q15[4*60] = { }; #endif /* resample_48k_12k8 */ +#ifndef resample_96k_12k8 +static const int16_t h_96k_12k8_q15[2*120] = { + -3, -7, -10, -13, -13, -10, -4, 5, 15, 26, + 33, 36, 31, 19, 0, -23, -47, -66, -76, -73, + -54, -21, 23, 70, 111, 139, 143, 121, 72, 0, + -84, -165, -227, -256, -240, -175, -67, 72, 219, 349, + 433, 448, 379, 225, 0, -268, -536, -755, -874, -848, + -648, -260, 301, 1000, 1780, 2569, 3290, 3869, 4243, 4372, + 4243, 3869, 3290, 2569, 1780, 1000, 301, -260, -648, -848, + -874, -755, -536, -268, 0, 225, 379, 448, 433, 349, + 219, 72, -67, -175, -240, -256, -227, -165, -84, 0, + 72, 121, 143, 139, 111, 70, 23, -21, -54, -73, + -76, -66, -47, -23, 0, 19, 31, 36, 33, 26, + 15, 5, -4, -10, -13, -13, -10, -7, -3, 0, + + -1, -5, -8, -12, -13, -12, -8, 0, 10, 21, + 30, 35, 34, 26, 10, -11, -35, -58, -73, -76, + -65, -39, 0, 46, 92, 127, 144, 136, 100, 38, + -41, -125, -199, -246, -254, -214, -126, 0, 146, 288, + 398, 450, 424, 312, 120, -131, -405, -655, -830, -881, + -771, -477, 0, 636, 1384, 2178, 2943, 3601, 4084, 4340, + 4340, 4084, 3601, 2943, 2178, 1384, 636, 0, -477, -771, + -881, -830, -655, -405, -131, 120, 312, 424, 450, 398, + 288, 146, 0, -126, -214, -254, -246, -199, -125, -41, + 38, 100, 136, 144, 127, 92, 46, 0, -39, -65, + -76, -73, -58, -35, -11, 10, 26, 34, 35, 30, + 21, 10, 0, -8, -12, -13, -12, -8, -5, -1, +}; +#endif /* resample_96k_12k8 */ + /** * High-pass 50Hz filtering, at 12.8 KHz samplerate @@ -223,7 +253,8 @@ LC3_HOT static inline void resample_x64k_12k8(const int p, const int16_t *h, * The number of previous samples `d` accessed on `x` is : * d: { 30, 60 } - 1 for resampling factors 8 and 4. */ -#if !defined(resample_24k_12k8) || !defined(resample_48k_12k8) +#if !defined(resample_24k_12k8) || !defined(resample_48k_12k8) \ + || !defined(resample_96k_12k8) LC3_HOT static inline void resample_x192k_12k8(const int p, const int16_t *h, struct lc3_ltpf_hp50_state *hp50, const int16_t *x, int16_t *y, int n) { @@ -340,6 +371,22 @@ LC3_HOT static void resample_48k_12k8( } #endif /* resample_48k_12k8 */ +/** + * Resample from 96 Khz to 12.8 KHz + * hp50 High-Pass biquad filter state + * x [-120..-1] Previous, [0..ns-1] Current samples, in fixed Q15 + * y, n [0..n-1] Output `n` processed samples, in fixed Q14 + * +* The `x` vector is aligned on 32 bits +*/ +#ifndef resample_96k_12k8 +LC3_HOT static void resample_96k_12k8( + struct lc3_ltpf_hp50_state *hp50, const int16_t *x, int16_t *y, int n) +{ + resample_x192k_12k8(2, h_96k_12k8_q15, hp50, x, y, n); +} +#endif /* resample_96k_12k8 */ + /** * Resample to 6.4 KHz * x [-3..-1] Previous, [0..n-1] Current samples @@ -366,11 +413,13 @@ LC3_HOT static void resample_6k4(const int16_t *x, int16_t *y, int n) static void (* const resample_12k8[]) (struct lc3_ltpf_hp50_state *, const int16_t *, int16_t *, int ) = { - [LC3_SRATE_8K ] = resample_8k_12k8, - [LC3_SRATE_16K] = resample_16k_12k8, - [LC3_SRATE_24K] = resample_24k_12k8, - [LC3_SRATE_32K] = resample_32k_12k8, - [LC3_SRATE_48K] = resample_48k_12k8, + [LC3_SRATE_8K ] = resample_8k_12k8, + [LC3_SRATE_16K ] = resample_16k_12k8, + [LC3_SRATE_24K ] = resample_24k_12k8, + [LC3_SRATE_32K ] = resample_32k_12k8, + [LC3_SRATE_48K ] = resample_48k_12k8, + [LC3_SRATE_48K_HR] = resample_48k_12k8, + [LC3_SRATE_96K_HR] = resample_96k_12k8, }; @@ -670,11 +719,11 @@ bool lc3_ltpf_analyse( LC3_MAX(pitch, ltpf->pitch) - LC3_MIN(pitch, ltpf->pitch); float nc_diff = nc - ltpf->nc[0]; - data->active = pitch_present && + data->active = !lc3_hr(sr) && pitch_present && ((nc > 0.9f) || (nc > 0.84f && pitch_diff < 8 && nc_diff > -0.1f)); } else { - data->active = pitch_present && + data->active = !lc3_hr(sr) && pitch_present && ( (dt == LC3_DT_10M || ltpf->nc[1] > 0.94f) && (ltpf->nc[0] > 0.94f && nc > 0.94f) ); } @@ -696,11 +745,8 @@ bool lc3_ltpf_analyse( * Width of synthesis filter */ -#define FILTER_WIDTH(sr) \ - LC3_MAX(4, LC3_SRATE_KHZ(sr) / 4) - #define MAX_FILTER_WIDTH \ - FILTER_WIDTH(LC3_NUM_SRATE) + (LC3_MAX_SRATE_HZ / 4000) /** @@ -810,8 +856,7 @@ void lc3_ltpf_synthesize(enum lc3_dt dt, enum lc3_srate sr, int nbytes, lc3_ltpf_synthesis_t *ltpf, const lc3_ltpf_data_t *data, const float *xh, float *x) { - int nh = LC3_NH(dt, sr); - int dt_us = LC3_DT_US(dt); + int nh = lc3_ns(dt, sr) + lc3_nh(dt, sr); /* --- Filter parameters --- */ @@ -821,18 +866,18 @@ void lc3_ltpf_synthesize(enum lc3_dt dt, enum lc3_srate sr, int nbytes, p_idx >= 380 ? (((p_idx >> 1) - 63) << 2) + (((p_idx & 1)) << 1) : (((p_idx >> 2) + 32) << 2) + (((p_idx & 3)) << 0) ; - pitch = (pitch * LC3_SRATE_KHZ(sr) * 10 + 64) / 128; + pitch = (pitch * lc3_ns(LC3_DT_10M, sr) + 64) / 128; - int nbits = (nbytes*8 * 10000 + (dt_us/2)) / dt_us; + int nbits = (nbytes*8 * (1 + LC3_DT_10M)) / (1 + dt); if (dt == LC3_DT_2M5) nbits = (6 * nbits + 5) / 10; if (dt == LC3_DT_5M) nbits -= 160; - int g_idx = LC3_MAX(nbits / 80, 3 + (int)sr) - (3 + sr); + int g_idx = LC3_MAX(nbits / 80, (int)(3 + sr)) - (3 + sr); bool active = data && data->active && g_idx < 4; - int w = FILTER_WIDTH(sr); + int w = LC3_MAX(4, lc3_ns_4m[sr] >> 4); float c[2 * MAX_FILTER_WIDTH]; for (int i = 0; i < w; i++) { @@ -843,7 +888,7 @@ void lc3_ltpf_synthesize(enum lc3_dt dt, enum lc3_srate sr, int nbytes, /* --- Transition handling --- */ - int ns = LC3_NS(dt, sr); + int ns = lc3_ns(dt, sr); int nt = ns / (1 + dt); float x0[2][MAX_FILTER_WIDTH]; @@ -911,7 +956,8 @@ void lc3_ltpf_put_data(lc3_bits_t *bits, /** * Get bitstream data */ -void lc3_ltpf_get_data(lc3_bits_t *bits, struct lc3_ltpf_data *data) +void lc3_ltpf_get_data(lc3_bits_t *bits, + struct lc3_ltpf_data *data) { data->active = lc3_get_bit(bits); data->pitch_index = lc3_get_bits(bits, 9); diff --git a/src/mdct.c b/src/mdct.c index 0fd6634..51d9579 100644 --- a/src/mdct.c +++ b/src/mdct.c @@ -160,7 +160,7 @@ LC3_HOT static inline void fft_bf2( /** * Perform FFT * x, y0, y1 Input, and 2 scratch buffers of size `n` - * n Number of points 30, 40, 60, 80, 90, 120, 160, 180, 240 + * n Number of points 30, 40, 60, 80, 90, 120, 160, 180, 240, 480 * return The buffer `y0` or `y1` that hold the result * * Input `x` can be the same as the `y0` second scratch buffer @@ -175,9 +175,9 @@ static struct lc3_complex *fft(const struct lc3_complex *x, int n, * * n = 5^1 * 3^n3 * 2^n2 * - * for n = 10, 20, 40, 80, 160 n3 = 0, n2 = [1..5] - * n = 30, 60, 120, 240 n3 = 1, n2 = [1..4] - * n = 90, 180 n3 = 2, n2 = [1..2] + * for n = 10, 20, 40, 80, 160 n3 = 0, n2 = [1..5] + * n = 30, 60, 120, 240, 480 n3 = 1, n2 = [1..5] + * n = 90, 180 n3 = 2, n2 = [1..2] * * Note that the expression `n & (n-1) == 0` is equivalent * to the check that `n` is a power of 2. */ @@ -200,16 +200,18 @@ static struct lc3_complex *fft(const struct lc3_complex *x, int n, /** * Windowing of samples before MDCT - * dt, sr Duration and samplerate (size of the transform) + * dt, sr Duration and samplerate * x, y Input current and delayed samples * y, d Output windowed samples, and delayed ones */ -LC3_HOT static void mdct_window(enum lc3_dt dt, enum lc3_srate sr, +LC3_HOT static void mdct_window( + enum lc3_dt dt, enum lc3_srate sr, const float *x, float *d, float *y) { - int ns = LC3_NS(dt, sr), nd = LC3_ND(dt, sr); + const float *win = lc3_mdct_win[dt][sr]; + int ns = lc3_ns(dt, sr), nd = lc3_nd(dt, sr); - const float *w0 = lc3_mdct_win[dt][sr], *w1 = w0 + ns; + const float *w0 = win, *w1 = w0 + ns; const float *w2 = w1, *w3 = w2 + nd; const float *x0 = x + ns-nd, *x1 = x0; @@ -362,7 +364,8 @@ LC3_HOT static void imdct_post_fft(const struct lc3_mdct_rot_def *def, * x, d Middle half of IMDCT coefficients and delayed samples * y, d Output samples and delayed ones */ -LC3_HOT static void imdct_window(enum lc3_dt dt, enum lc3_srate sr, +LC3_HOT static void imdct_window( + enum lc3_dt dt, enum lc3_srate sr, const float *x, float *d, float *y) { /* The full MDCT coefficients is given by symmetry : @@ -371,8 +374,9 @@ LC3_HOT static void imdct_window(enum lc3_dt dt, enum lc3_srate sr, * T[ n/2 .. 3n/4-1] = half[n/4 .. n/2-1] * T[3n/4 .. n-1] = half[n/2-1 .. n/4 ] */ - int n4 = LC3_NS(dt, sr) >> 1, nd = LC3_ND(dt, sr); - const float *w2 = lc3_mdct_win[dt][sr], *w0 = w2 + 3*n4, *w1 = w0; + const float *win = lc3_mdct_win[dt][sr]; + int n4 = lc3_ns(dt, sr) >> 1, nd = lc3_nd(dt, sr); + const float *w2 = win, *w0 = w2 + 3*n4, *w1 = w0; const float *x0 = d + nd-n4, *x1 = x0; float *y0 = y + nd-n4, *y1 = y0, *y2 = d + nd, *y3 = d; @@ -423,12 +427,13 @@ LC3_HOT static void rescale(float *x, int n, float f) /** * Forward MDCT transformation */ -void lc3_mdct_forward(enum lc3_dt dt, enum lc3_srate sr, - enum lc3_srate sr_dst, const float *x, float *d, float *y) +void lc3_mdct_forward( + enum lc3_dt dt, enum lc3_srate sr, enum lc3_srate sr_dst, + const float *x, float *d, float *y) { const struct lc3_mdct_rot_def *rot = lc3_mdct_rot[dt][sr]; - int ns_dst = LC3_NS(dt, sr_dst); - int ns = LC3_NS(dt, sr); + int ns_dst = lc3_ns(dt, sr_dst); + int ns = lc3_ns(dt, sr); struct lc3_complex buffer[LC3_MAX_NS / 2]; struct lc3_complex *z = (struct lc3_complex *)y; @@ -447,12 +452,13 @@ void lc3_mdct_forward(enum lc3_dt dt, enum lc3_srate sr, /** * Inverse MDCT transformation */ -void lc3_mdct_inverse(enum lc3_dt dt, enum lc3_srate sr, - enum lc3_srate sr_src, const float *x, float *d, float *y) +void lc3_mdct_inverse( + enum lc3_dt dt, enum lc3_srate sr, enum lc3_srate sr_src, + const float *x, float *d, float *y) { const struct lc3_mdct_rot_def *rot = lc3_mdct_rot[dt][sr]; - int ns_src = LC3_NS(dt, sr_src); - int ns = LC3_NS(dt, sr); + int ns_src = lc3_ns(dt, sr_src); + int ns = lc3_ns(dt, sr); struct lc3_complex buffer[LC3_MAX_NS / 2]; struct lc3_complex *z = (struct lc3_complex *)y; diff --git a/src/mdct.h b/src/mdct.h index 3e23a1f..18d08b9 100644 --- a/src/mdct.h +++ b/src/mdct.h @@ -31,8 +31,9 @@ * * `x` and `y` can be the same buffer */ -void lc3_mdct_forward(enum lc3_dt dt, enum lc3_srate sr, - enum lc3_srate sr_dst, const float *x, float *d, float *y); +void lc3_mdct_forward( + enum lc3_dt dt, enum lc3_srate sr, enum lc3_srate sr_dst, + const float *x, float *d, float *y); /** * Inverse MDCT transformation @@ -43,8 +44,9 @@ void lc3_mdct_forward(enum lc3_dt dt, enum lc3_srate sr, * * `x` and `y` can be the same buffer */ -void lc3_mdct_inverse(enum lc3_dt dt, enum lc3_srate sr, - enum lc3_srate sr_src, const float *x, float *d, float *y); +void lc3_mdct_inverse( + enum lc3_dt dt, enum lc3_srate sr, enum lc3_srate sr_src, + const float *x, float *d, float *y); #endif /* __LC3_MDCT_H */ diff --git a/src/plc.c b/src/plc.c index 03911b4..f225ca6 100644 --- a/src/plc.c +++ b/src/plc.c @@ -17,6 +17,7 @@ ******************************************************************************/ #include "plc.h" +#include "tables.h" /** @@ -45,7 +46,7 @@ void lc3_plc_synthesize(enum lc3_dt dt, enum lc3_srate sr, { uint16_t seed = plc->seed; float alpha = plc->alpha; - int ne = LC3_NE(dt, sr); + int ne = lc3_ne(dt, sr); alpha *= (plc->count < 4 ? 1.0f : plc->count < 8 ? 0.9f : 0.85f); diff --git a/src/sns.c b/src/sns.c index 284f307..8b64c8c 100644 --- a/src/sns.c +++ b/src/sns.c @@ -146,108 +146,139 @@ LC3_HOT static void dct16_inverse(const float *x, float *y) /** * Scale factors * dt, sr Duration and samplerate of the frame + * nbytes Size in bytes of the frame * eb Energy estimation per bands * att 1: Attack detected 0: Otherwise * scf Output 16 scale factors */ LC3_HOT static void compute_scale_factors( - enum lc3_dt dt, enum lc3_srate sr, + enum lc3_dt dt, enum lc3_srate sr, int nbytes, const float *eb, bool att, float *scf) { /* Pre-emphasis gain table : * Ge[b] = 10 ^ (b * g_tilt) / 630 , b = [0..63] */ - static const float ge_table[LC3_NUM_SRATE][LC3_MAX_BANDS] = { + static const float ge_14[LC3_MAX_BANDS] = { /* g_tilt = 14 */ + 1.00000000e+00, 1.05250029e+00, 1.10775685e+00, 1.16591440e+00, + 1.22712524e+00, 1.29154967e+00, 1.35935639e+00, 1.43072299e+00, + 1.50583635e+00, 1.58489319e+00, 1.66810054e+00, 1.75567629e+00, + 1.84784980e+00, 1.94486244e+00, 2.04696827e+00, 2.15443469e+00, + 2.26754313e+00, 2.38658979e+00, 2.51188643e+00, 2.64376119e+00, + 2.78255940e+00, 2.92864456e+00, 3.08239924e+00, 3.24422608e+00, + 3.41454887e+00, 3.59381366e+00, 3.78248991e+00, 3.98107171e+00, + 4.19007911e+00, 4.41005945e+00, 4.64158883e+00, 4.88527357e+00, + 5.14175183e+00, 5.41169527e+00, 5.69581081e+00, 5.99484250e+00, + 6.30957344e+00, 6.64082785e+00, 6.98947321e+00, 7.35642254e+00, + 7.74263683e+00, 8.14912747e+00, 8.57695899e+00, 9.02725178e+00, + 9.50118507e+00, 1.00000000e+01, 1.05250029e+01, 1.10775685e+01, + 1.16591440e+01, 1.22712524e+01, 1.29154967e+01, 1.35935639e+01, + 1.43072299e+01, 1.50583635e+01, 1.58489319e+01, 1.66810054e+01, + 1.75567629e+01, 1.84784980e+01, 1.94486244e+01, 2.04696827e+01, + 2.15443469e+01, 2.26754313e+01, 2.38658979e+01, 2.51188643e+01 }; - [LC3_SRATE_8K] = { /* g_tilt = 14 */ - 1.00000000e+00, 1.05250029e+00, 1.10775685e+00, 1.16591440e+00, - 1.22712524e+00, 1.29154967e+00, 1.35935639e+00, 1.43072299e+00, - 1.50583635e+00, 1.58489319e+00, 1.66810054e+00, 1.75567629e+00, - 1.84784980e+00, 1.94486244e+00, 2.04696827e+00, 2.15443469e+00, - 2.26754313e+00, 2.38658979e+00, 2.51188643e+00, 2.64376119e+00, - 2.78255940e+00, 2.92864456e+00, 3.08239924e+00, 3.24422608e+00, - 3.41454887e+00, 3.59381366e+00, 3.78248991e+00, 3.98107171e+00, - 4.19007911e+00, 4.41005945e+00, 4.64158883e+00, 4.88527357e+00, - 5.14175183e+00, 5.41169527e+00, 5.69581081e+00, 5.99484250e+00, - 6.30957344e+00, 6.64082785e+00, 6.98947321e+00, 7.35642254e+00, - 7.74263683e+00, 8.14912747e+00, 8.57695899e+00, 9.02725178e+00, - 9.50118507e+00, 1.00000000e+01, 1.05250029e+01, 1.10775685e+01, - 1.16591440e+01, 1.22712524e+01, 1.29154967e+01, 1.35935639e+01, - 1.43072299e+01, 1.50583635e+01, 1.58489319e+01, 1.66810054e+01, - 1.75567629e+01, 1.84784980e+01, 1.94486244e+01, 2.04696827e+01, - 2.15443469e+01, 2.26754313e+01, 2.38658979e+01, 2.51188643e+01 }, + static const float ge_18[LC3_MAX_BANDS] = { /* g_tilt = 18 */ + 1.00000000e+00, 1.06800043e+00, 1.14062492e+00, 1.21818791e+00, + 1.30102522e+00, 1.38949549e+00, 1.48398179e+00, 1.58489319e+00, + 1.69266662e+00, 1.80776868e+00, 1.93069773e+00, 2.06198601e+00, + 2.20220195e+00, 2.35195264e+00, 2.51188643e+00, 2.68269580e+00, + 2.86512027e+00, 3.05994969e+00, 3.26802759e+00, 3.49025488e+00, + 3.72759372e+00, 3.98107171e+00, 4.25178630e+00, 4.54090961e+00, + 4.84969343e+00, 5.17947468e+00, 5.53168120e+00, 5.90783791e+00, + 6.30957344e+00, 6.73862717e+00, 7.19685673e+00, 7.68624610e+00, + 8.20891416e+00, 8.76712387e+00, 9.36329209e+00, 1.00000000e+01, + 1.06800043e+01, 1.14062492e+01, 1.21818791e+01, 1.30102522e+01, + 1.38949549e+01, 1.48398179e+01, 1.58489319e+01, 1.69266662e+01, + 1.80776868e+01, 1.93069773e+01, 2.06198601e+01, 2.20220195e+01, + 2.35195264e+01, 2.51188643e+01, 2.68269580e+01, 2.86512027e+01, + 3.05994969e+01, 3.26802759e+01, 3.49025488e+01, 3.72759372e+01, + 3.98107171e+01, 4.25178630e+01, 4.54090961e+01, 4.84969343e+01, + 5.17947468e+01, 5.53168120e+01, 5.90783791e+01, 6.30957344e+01 }; - [LC3_SRATE_16K] = { /* g_tilt = 18 */ - 1.00000000e+00, 1.06800043e+00, 1.14062492e+00, 1.21818791e+00, - 1.30102522e+00, 1.38949549e+00, 1.48398179e+00, 1.58489319e+00, - 1.69266662e+00, 1.80776868e+00, 1.93069773e+00, 2.06198601e+00, - 2.20220195e+00, 2.35195264e+00, 2.51188643e+00, 2.68269580e+00, - 2.86512027e+00, 3.05994969e+00, 3.26802759e+00, 3.49025488e+00, - 3.72759372e+00, 3.98107171e+00, 4.25178630e+00, 4.54090961e+00, - 4.84969343e+00, 5.17947468e+00, 5.53168120e+00, 5.90783791e+00, - 6.30957344e+00, 6.73862717e+00, 7.19685673e+00, 7.68624610e+00, - 8.20891416e+00, 8.76712387e+00, 9.36329209e+00, 1.00000000e+01, - 1.06800043e+01, 1.14062492e+01, 1.21818791e+01, 1.30102522e+01, - 1.38949549e+01, 1.48398179e+01, 1.58489319e+01, 1.69266662e+01, - 1.80776868e+01, 1.93069773e+01, 2.06198601e+01, 2.20220195e+01, - 2.35195264e+01, 2.51188643e+01, 2.68269580e+01, 2.86512027e+01, - 3.05994969e+01, 3.26802759e+01, 3.49025488e+01, 3.72759372e+01, - 3.98107171e+01, 4.25178630e+01, 4.54090961e+01, 4.84969343e+01, - 5.17947468e+01, 5.53168120e+01, 5.90783791e+01, 6.30957344e+01 }, + static const float ge_22[LC3_MAX_BANDS] = { /* g_tilt = 22 */ + 1.00000000e+00, 1.08372885e+00, 1.17446822e+00, 1.27280509e+00, + 1.37937560e+00, 1.49486913e+00, 1.62003281e+00, 1.75567629e+00, + 1.90267705e+00, 2.06198601e+00, 2.23463373e+00, 2.42173704e+00, + 2.62450630e+00, 2.84425319e+00, 3.08239924e+00, 3.34048498e+00, + 3.62017995e+00, 3.92329345e+00, 4.25178630e+00, 4.60778348e+00, + 4.99358789e+00, 5.41169527e+00, 5.86481029e+00, 6.35586411e+00, + 6.88803330e+00, 7.46476041e+00, 8.08977621e+00, 8.76712387e+00, + 9.50118507e+00, 1.02967084e+01, 1.11588399e+01, 1.20931568e+01, + 1.31057029e+01, 1.42030283e+01, 1.53922315e+01, 1.66810054e+01, + 1.80776868e+01, 1.95913107e+01, 2.12316686e+01, 2.30093718e+01, + 2.49359200e+01, 2.70237760e+01, 2.92864456e+01, 3.17385661e+01, + 3.43959997e+01, 3.72759372e+01, 4.03970086e+01, 4.37794036e+01, + 4.74450028e+01, 5.14175183e+01, 5.57226480e+01, 6.03882412e+01, + 6.54444792e+01, 7.09240702e+01, 7.68624610e+01, 8.32980665e+01, + 9.02725178e+01, 9.78309319e+01, 1.06022203e+02, 1.14899320e+02, + 1.24519708e+02, 1.34945600e+02, 1.46244440e+02, 1.58489319e+02 }; - [LC3_SRATE_24K] = { /* g_tilt = 22 */ - 1.00000000e+00, 1.08372885e+00, 1.17446822e+00, 1.27280509e+00, - 1.37937560e+00, 1.49486913e+00, 1.62003281e+00, 1.75567629e+00, - 1.90267705e+00, 2.06198601e+00, 2.23463373e+00, 2.42173704e+00, - 2.62450630e+00, 2.84425319e+00, 3.08239924e+00, 3.34048498e+00, - 3.62017995e+00, 3.92329345e+00, 4.25178630e+00, 4.60778348e+00, - 4.99358789e+00, 5.41169527e+00, 5.86481029e+00, 6.35586411e+00, - 6.88803330e+00, 7.46476041e+00, 8.08977621e+00, 8.76712387e+00, - 9.50118507e+00, 1.02967084e+01, 1.11588399e+01, 1.20931568e+01, - 1.31057029e+01, 1.42030283e+01, 1.53922315e+01, 1.66810054e+01, - 1.80776868e+01, 1.95913107e+01, 2.12316686e+01, 2.30093718e+01, - 2.49359200e+01, 2.70237760e+01, 2.92864456e+01, 3.17385661e+01, - 3.43959997e+01, 3.72759372e+01, 4.03970086e+01, 4.37794036e+01, - 4.74450028e+01, 5.14175183e+01, 5.57226480e+01, 6.03882412e+01, - 6.54444792e+01, 7.09240702e+01, 7.68624610e+01, 8.32980665e+01, - 9.02725178e+01, 9.78309319e+01, 1.06022203e+02, 1.14899320e+02, - 1.24519708e+02, 1.34945600e+02, 1.46244440e+02, 1.58489319e+02 }, + static const float ge_26[LC3_MAX_BANDS] = { /* g_tilt = 26 */ + 1.00000000e+00, 1.09968890e+00, 1.20931568e+00, 1.32987103e+00, + 1.46244440e+00, 1.60823388e+00, 1.76855694e+00, 1.94486244e+00, + 2.13874364e+00, 2.35195264e+00, 2.58641621e+00, 2.84425319e+00, + 3.12779366e+00, 3.43959997e+00, 3.78248991e+00, 4.15956216e+00, + 4.57422434e+00, 5.03022373e+00, 5.53168120e+00, 6.08312841e+00, + 6.68954879e+00, 7.35642254e+00, 8.08977621e+00, 8.89623710e+00, + 9.78309319e+00, 1.07583590e+01, 1.18308480e+01, 1.30102522e+01, + 1.43072299e+01, 1.57335019e+01, 1.73019574e+01, 1.90267705e+01, + 2.09235283e+01, 2.30093718e+01, 2.53031508e+01, 2.78255940e+01, + 3.05994969e+01, 3.36499270e+01, 3.70044512e+01, 4.06933843e+01, + 4.47500630e+01, 4.92111475e+01, 5.41169527e+01, 5.95118121e+01, + 6.54444792e+01, 7.19685673e+01, 7.91430346e+01, 8.70327166e+01, + 9.57089124e+01, 1.05250029e+02, 1.15742288e+02, 1.27280509e+02, + 1.39968963e+02, 1.53922315e+02, 1.69266662e+02, 1.86140669e+02, + 2.04696827e+02, 2.25102829e+02, 2.47543082e+02, 2.72220379e+02, + 2.99357729e+02, 3.29200372e+02, 3.62017995e+02, 3.98107171e+02 }; - [LC3_SRATE_32K] = { /* g_tilt = 26 */ - 1.00000000e+00, 1.09968890e+00, 1.20931568e+00, 1.32987103e+00, - 1.46244440e+00, 1.60823388e+00, 1.76855694e+00, 1.94486244e+00, - 2.13874364e+00, 2.35195264e+00, 2.58641621e+00, 2.84425319e+00, - 3.12779366e+00, 3.43959997e+00, 3.78248991e+00, 4.15956216e+00, - 4.57422434e+00, 5.03022373e+00, 5.53168120e+00, 6.08312841e+00, - 6.68954879e+00, 7.35642254e+00, 8.08977621e+00, 8.89623710e+00, - 9.78309319e+00, 1.07583590e+01, 1.18308480e+01, 1.30102522e+01, - 1.43072299e+01, 1.57335019e+01, 1.73019574e+01, 1.90267705e+01, - 2.09235283e+01, 2.30093718e+01, 2.53031508e+01, 2.78255940e+01, - 3.05994969e+01, 3.36499270e+01, 3.70044512e+01, 4.06933843e+01, - 4.47500630e+01, 4.92111475e+01, 5.41169527e+01, 5.95118121e+01, - 6.54444792e+01, 7.19685673e+01, 7.91430346e+01, 8.70327166e+01, - 9.57089124e+01, 1.05250029e+02, 1.15742288e+02, 1.27280509e+02, - 1.39968963e+02, 1.53922315e+02, 1.69266662e+02, 1.86140669e+02, - 2.04696827e+02, 2.25102829e+02, 2.47543082e+02, 2.72220379e+02, - 2.99357729e+02, 3.29200372e+02, 3.62017995e+02, 3.98107171e+02 }, + static const float ge_30[LC3_MAX_BANDS] = { /* g_tilt = 30 */ + 1.00000000e+00, 1.11588399e+00, 1.24519708e+00, 1.38949549e+00, + 1.55051578e+00, 1.73019574e+00, 1.93069773e+00, 2.15443469e+00, + 2.40409918e+00, 2.68269580e+00, 2.99357729e+00, 3.34048498e+00, + 3.72759372e+00, 4.15956216e+00, 4.64158883e+00, 5.17947468e+00, + 5.77969288e+00, 6.44946677e+00, 7.19685673e+00, 8.03085722e+00, + 8.96150502e+00, 1.00000000e+01, 1.11588399e+01, 1.24519708e+01, + 1.38949549e+01, 1.55051578e+01, 1.73019574e+01, 1.93069773e+01, + 2.15443469e+01, 2.40409918e+01, 2.68269580e+01, 2.99357729e+01, + 3.34048498e+01, 3.72759372e+01, 4.15956216e+01, 4.64158883e+01, + 5.17947468e+01, 5.77969288e+01, 6.44946677e+01, 7.19685673e+01, + 8.03085722e+01, 8.96150502e+01, 1.00000000e+02, 1.11588399e+02, + 1.24519708e+02, 1.38949549e+02, 1.55051578e+02, 1.73019574e+02, + 1.93069773e+02, 2.15443469e+02, 2.40409918e+02, 2.68269580e+02, + 2.99357729e+02, 3.34048498e+02, 3.72759372e+02, 4.15956216e+02, + 4.64158883e+02, 5.17947468e+02, 5.77969288e+02, 6.44946677e+02, + 7.19685673e+02, 8.03085722e+02, 8.96150502e+02, 1.00000000e+03 }; + +#if LC3_PLUS_HR + + static const float ge_34[LC3_MAX_BANDS] = { /* g_tilt = 34 */ + 1.00000000e+00, 1.13231759e+00, 1.28214312e+00, 1.45179321e+00, + 1.64389099e+00, 1.86140669e+00, 2.10770353e+00, 2.38658979e+00, + 2.70237760e+00, 3.05994969e+00, 3.46483486e+00, 3.92329345e+00, + 4.44241419e+00, 5.03022373e+00, 5.69581081e+00, 6.44946677e+00, + 7.30284467e+00, 8.26913948e+00, 9.36329209e+00, 1.06022203e+01, + 1.20050806e+01, 1.35935639e+01, 1.53922315e+01, 1.74288945e+01, + 1.97350438e+01, 2.23463373e+01, 2.53031508e+01, 2.86512027e+01, + 3.24422608e+01, 3.67349426e+01, 4.15956216e+01, 4.70994540e+01, + 5.33315403e+01, 6.03882412e+01, 6.83786677e+01, 7.74263683e+01, + 8.76712387e+01, 9.92716858e+01, 1.12407076e+02, 1.27280509e+02, + 1.44121960e+02, 1.63191830e+02, 1.84784980e+02, 2.09235283e+02, + 2.36920791e+02, 2.68269580e+02, 3.03766364e+02, 3.43959997e+02, + 3.89471955e+02, 4.41005945e+02, 4.99358789e+02, 5.65432741e+02, + 6.40249439e+02, 7.24965701e+02, 8.20891416e+02, 9.29509790e+02, + 1.05250029e+03, 1.19176459e+03, 1.34945600e+03, 1.52801277e+03, + 1.73019574e+03, 1.95913107e+03, 2.21835857e+03, 2.51188643e+03 }; + +#endif /* LC3_PLUS_HR */ + + static const float *ge_table[LC3_NUM_SRATE] = { + [LC3_SRATE_8K ] = ge_14, [LC3_SRATE_16K ] = ge_18, + [LC3_SRATE_24K ] = ge_22, [LC3_SRATE_32K ] = ge_26, + [LC3_SRATE_48K ] = ge_30, + +#if LC3_PLUS_HR + [LC3_SRATE_48K_HR] = ge_30, [LC3_SRATE_96K_HR] = ge_34, +#endif /* LC3_PLUS_HR */ - [LC3_SRATE_48K] = { /* g_tilt = 30 */ - 1.00000000e+00, 1.11588399e+00, 1.24519708e+00, 1.38949549e+00, - 1.55051578e+00, 1.73019574e+00, 1.93069773e+00, 2.15443469e+00, - 2.40409918e+00, 2.68269580e+00, 2.99357729e+00, 3.34048498e+00, - 3.72759372e+00, 4.15956216e+00, 4.64158883e+00, 5.17947468e+00, - 5.77969288e+00, 6.44946677e+00, 7.19685673e+00, 8.03085722e+00, - 8.96150502e+00, 1.00000000e+01, 1.11588399e+01, 1.24519708e+01, - 1.38949549e+01, 1.55051578e+01, 1.73019574e+01, 1.93069773e+01, - 2.15443469e+01, 2.40409918e+01, 2.68269580e+01, 2.99357729e+01, - 3.34048498e+01, 3.72759372e+01, 4.15956216e+01, 4.64158883e+01, - 5.17947468e+01, 5.77969288e+01, 6.44946677e+01, 7.19685673e+01, - 8.03085722e+01, 8.96150502e+01, 1.00000000e+02, 1.11588399e+02, - 1.24519708e+02, 1.38949549e+02, 1.55051578e+02, 1.73019574e+02, - 1.93069773e+02, 2.15443469e+02, 2.40409918e+02, 2.68269580e+02, - 2.99357729e+02, 3.34048498e+02, 3.72759372e+02, 4.15956216e+02, - 4.64158883e+02, 5.17947468e+02, 5.77969288e+02, 6.44946677e+02, - 7.19685673e+02, 8.03085722e+02, 8.96150502e+02, 1.00000000e+03 }, }; float e[LC3_MAX_BANDS]; @@ -291,7 +322,7 @@ LC3_HOT static void compute_scale_factors( float noise_floor = fmaxf(e_sum * (1e-4f / 64), 0x1p-32f); for (int i = 0; i < LC3_MAX_BANDS; i++) - e[i] = fast_log2f(fmaxf(e[i], noise_floor)) * 0.5f; + e[i] = lc3_log2f(fmaxf(e[i], noise_floor)) * 0.5f; /* --- Grouping & scaling --- */ @@ -314,8 +345,13 @@ LC3_HOT static void compute_scale_factors( (e[61] + e[62]) * 3.f/12 ; scf_sum += scf[15]; + float cf = lc3_hr(sr) ? 0.6f : 0.85f; + if (lc3_hr(sr) && 8 * nbytes > + (dt < LC3_DT_10M ? 1150 * (int)(1 + dt) : 4400)) + cf *= dt < LC3_DT_10M ? 0.25f : 0.35f; + for (int i = 0; i < 16; i++) - scf[i] = 0.85f * (scf[i] - scf_sum * 1.f/16); + scf[i] = cf * (scf[i] - scf_sum * 1.f/16); /* --- Attack handling --- */ @@ -714,10 +750,10 @@ LC3_HOT static void spectral_shaping(enum lc3_dt dt, enum lc3_srate sr, /* --- Spectral shaping --- */ - const uint16_t *lim = lc3_band_lim[dt][sr]; + const int *lim = lc3_band_lim[dt][sr]; for (int i = 0, ib = 0; ib < nb; ib++) { - float g_sns = fast_exp2f(-scf[ib]); + float g_sns = lc3_exp2f(-scf[ib]); for ( ; i < lim[ib+1]; i++) y[i] = x[i] * g_sns; @@ -732,7 +768,8 @@ LC3_HOT static void spectral_shaping(enum lc3_dt dt, enum lc3_srate sr, /** * SNS analysis */ -void lc3_sns_analyze(enum lc3_dt dt, enum lc3_srate sr, +void lc3_sns_analyze( + enum lc3_dt dt, enum lc3_srate sr, int nbytes, const float *eb, bool att, struct lc3_sns_data *data, const float *x, float *y) { @@ -746,7 +783,7 @@ void lc3_sns_analyze(enum lc3_dt dt, enum lc3_srate sr, float scf[16], cn[4][16]; int c[4][16]; - compute_scale_factors(dt, sr, eb, att, scf); + compute_scale_factors(dt, sr, nbytes, eb, att, scf); resolve_codebooks(scf, &data->lfcb, &data->hfcb); @@ -765,7 +802,8 @@ void lc3_sns_analyze(enum lc3_dt dt, enum lc3_srate sr, /** * SNS synthesis */ -void lc3_sns_synthesize(enum lc3_dt dt, enum lc3_srate sr, +void lc3_sns_synthesize( + enum lc3_dt dt, enum lc3_srate sr, const lc3_sns_data_t *data, const float *x, float *y) { float scf[16], cn[16]; diff --git a/src/sns.h b/src/sns.h index 8188f4a..ecb80ef 100644 --- a/src/sns.h +++ b/src/sns.h @@ -42,6 +42,7 @@ typedef struct lc3_sns_data { /** * SNS analysis * dt, sr Duration and samplerate of the frame + * nbytes Size in bytes of the frame * eb Energy estimation per bands, and count of bands * att 1: Attack detected 0: Otherwise * data Return bitstream data @@ -50,7 +51,8 @@ typedef struct lc3_sns_data { * * `x` and `y` can be the same buffer */ -void lc3_sns_analyze(enum lc3_dt dt, enum lc3_srate sr, +void lc3_sns_analyze( + enum lc3_dt dt, enum lc3_srate sr, int nbytes, const float *eb, bool att, lc3_sns_data_t *data, const float *x, float *y); diff --git a/src/spec.c b/src/spec.c index ebf49ff..589770c 100644 --- a/src/spec.c +++ b/src/spec.c @@ -32,14 +32,46 @@ */ static int resolve_gain_offset(enum lc3_srate sr, int nbytes) { - int g_off = (nbytes * 8) / (10 * (1 + sr)); - return 105 + 5*(1 + sr) + LC3_MIN(g_off, 115); + int sr_ind = lc3_hr(sr) ? 4 + (sr - LC3_SRATE_48K_HR) : sr; + + int g_off = (nbytes * 8) / (10 * (1 + sr_ind)); + return LC3_MIN(lc3_hr(sr) ? 181 : 255, + 105 + 5*(1 + sr_ind) + LC3_MIN(g_off, 115)); +} + +/** + * Unquantize gain + * g_int Quantization gain value + * return Unquantized gain value + */ +static float unquantize_gain(int g_int) +{ + /* Unquantization gain table : + * G[i] = 10 ^ (i / 28) , i = [0..27] */ + + static const float iq_table[] = { + 1.00000000e+00, 1.08571112e+00, 1.17876863e+00, 1.27980221e+00, + 1.38949549e+00, 1.50859071e+00, 1.63789371e+00, 1.77827941e+00, + 1.93069773e+00, 2.09617999e+00, 2.27584593e+00, 2.47091123e+00, + 2.68269580e+00, 2.91263265e+00, 3.16227766e+00, 3.43332002e+00, + 3.72759372e+00, 4.04708995e+00, 4.39397056e+00, 4.77058270e+00, + 5.17947468e+00, 5.62341325e+00, 6.10540230e+00, 6.62870316e+00, + 7.19685673e+00, 7.81370738e+00, 8.48342898e+00, 9.21055318e+00 + }; + + float g = 1.f; + + for ( ; g_int < 0; g_int += 28, g *= 0.1f); + for ( ; g_int >= 28; g_int -= 28, g *= 10.f); + + return g * iq_table[g_int]; } /** * Global Gain Estimation * dt, sr Duration and samplerate of the frame * x Spectral coefficients + * nbytes Size of the frame * nbits_budget Number of bits available coding the spectrum * nbits_off Offset on the available bits, temporarily smoothed * g_off Gain index offset @@ -49,29 +81,65 @@ static int resolve_gain_offset(enum lc3_srate sr, int nbytes) */ LC3_HOT static int estimate_gain( enum lc3_dt dt, enum lc3_srate sr, const float *x, - int nbits_budget, float nbits_off, int g_off, bool *reset_off, int *g_min) + int nbytes, int nbits_budget, float nbits_off, int g_off, + bool *reset_off, int *g_min) { - int ne = LC3_NE(dt, sr) >> 2; - int e[LC3_MAX_NE]; + int n4 = lc3_ne(dt, sr) / 4; + union { float f; int32_t q16; } e[LC3_MAX_NE / 4]; + + /* --- Signal adaptative noise floor --- */ + + int reg_bits = 0; + float low_bits = 0; + + if (lc3_hr(sr)) { + int reg_c = (const int [LC3_NUM_DT][LC3_NUM_SRATE - LC3_SRATE_48K_HR]){ + [LC3_DT_2M5] = { -6, -6 }, + [LC3_DT_5M ] = { 0, 0 }, + [LC3_DT_10M] = { 2, 5 } + }[dt][sr - LC3_SRATE_48K_HR]; + + reg_bits = (8*nbytes * 4) / (125 * (1 + dt)); + reg_bits = LC3_CLIP(reg_bits + reg_c, 6, 23); + + float m0 = 1e-5f, m1 = 1e-5f, k = 0; + + for (int i = 0; i < n4; i++) { + m0 += fabsf(x[4*i + 0]), m1 += fabsf(x[4*i + 0]) * k++; + m0 += fabsf(x[4*i + 1]), m1 += fabsf(x[4*i + 1]) * k++; + m0 += fabsf(x[4*i + 2]), m1 += fabsf(x[4*i + 2]) * k++; + m0 += fabsf(x[4*i + 3]), m1 += fabsf(x[4*i + 3]) * k++; + } + + int m = roundf((1.6f * m0) / ((1 + dt) * m1)); + low_bits = 8 - LC3_MIN(m, 8); + } /* --- Energy (dB) by 4 MDCT blocks --- */ float x2_max = 0; - for (int i = 0; i < ne; i++, x += 4) { - float x0 = x[0] * x[0]; - float x1 = x[1] * x[1]; - float x2 = x[2] * x[2]; - float x3 = x[3] * x[3]; + for (int i = 0; i < n4; i++) { + float x0 = x[4*i + 0] * x[4*i + 0]; + float x1 = x[4*i + 1] * x[4*i + 1]; + float x2 = x[4*i + 2] * x[4*i + 2]; + float x3 = x[4*i + 3] * x[4*i + 3]; x2_max = fmaxf(x2_max, x0); x2_max = fmaxf(x2_max, x1); x2_max = fmaxf(x2_max, x2); x2_max = fmaxf(x2_max, x3); - e[i] = fast_db_q16(fmaxf(x0 + x1 + x2 + x3, 1e-10f)); + e[i].f = x0 + x1 + x2 + x3; } + float x_max = sqrtf(x2_max); + float nf = lc3_hr(sr) ? + ldexpf(x_max, -reg_bits) * lc3_exp2f(-low_bits) : 0; + + for (int i = 0; i < n4; i++) + e[i].q16 = lc3_db_q16(fmaxf(e[i].f + nf, 1e-10f)); + /* --- Determine gain index --- */ int nbits = nbits_budget + nbits_off + 0.5f; @@ -81,14 +149,14 @@ LC3_HOT static int estimate_gain( const int k_2u7 = 2.7f * 0x1p16f + 0.5f; const int k_1u4 = 1.4f * 0x1p16f + 0.5f; - for (int i = 128, j, j0 = ne-1, j1 ; i > 0; i >>= 1) { + for (int i = 128, j, j0 = n4-1, j1 ; i > 0; i >>= 1) { int gn = (g_int - i) * k_20_28; int v = 0; - for (j = j0; j >= 0 && e[j] < gn; j--); + for (j = j0; j >= 0 && e[j].q16 < gn; j--); for (j1 = j; j >= 0; j--) { - int e_diff = e[j] - gn; + int e_diff = e[j].q16 - gn; v += e_diff < 0 ? k_2u7 : e_diff < 43 << 16 ? e_diff + ( 7 << 16) @@ -103,10 +171,14 @@ LC3_HOT static int estimate_gain( /* --- Limit gain index --- */ - *g_min = x2_max == 0 ? -g_off : - ceilf(28 * log10f(sqrtf(x2_max) / (32768 - 0.375f))); + float x_lim = lc3_hr(sr) ? 0x7fffp8f : 0x7fffp0f; - *reset_off = g_int < *g_min || x2_max == 0; + *g_min = 255 - g_off; + for (int i = 128 ; i > 0; i >>= 1) + if (x_lim * unquantize_gain(*g_min - i) > x_max) + *g_min -= i; + + *reset_off = g_int < *g_min || x_max == 0; if (*reset_off) g_int = *g_min; @@ -115,21 +187,23 @@ LC3_HOT static int estimate_gain( /** * Global Gain Adjustment - * sr Samplerate of the frame + * dt, sr Duration and samplerate of the frame * g_idx The estimated quantized gain index * nbits Computed number of bits coding the spectrum * nbits_budget Number of bits available for coding the spectrum * g_idx_min Minimum gain index value * return Gain adjust value (-1 to 2) */ -LC3_HOT static int adjust_gain(enum lc3_srate sr, int g_idx, - int nbits, int nbits_budget, int g_idx_min) +LC3_HOT static int adjust_gain( + enum lc3_dt dt, enum lc3_srate sr, + int g_idx, int nbits, int nbits_budget, int g_idx_min) { /* --- Compute delta threshold --- */ const int *t = (const int [LC3_NUM_SRATE][3]){ { 80, 500, 850 }, { 230, 1025, 1700 }, { 380, 1550, 2550 }, - { 530, 2075, 3400 }, { 680, 2600, 4250 } + { 530, 2075, 3400 }, { 680, 2600, 4250 }, + { 680, 2600, 4250 }, { 830, 3125, 5100 } }[sr]; int delta, den = 48; @@ -150,84 +224,46 @@ LC3_HOT static int adjust_gain(enum lc3_srate sr, int g_idx, /* --- Adjust gain --- */ - if (nbits < nbits_budget - (delta + 2)) + if (lc3_hr(sr) && nbits > nbits_budget) { + int factor = 1 + (dt <= LC3_DT_5M) + + (dt <= LC3_DT_2M5) * (1 + (nbits >= 520)); + + int g_incr = factor + (factor * (nbits - nbits_budget)) / delta; + return LC3_MIN(g_idx + g_incr, 255) - g_idx; + } + + if (!lc3_hr(sr) && nbits < nbits_budget - (delta + 2)) return -(g_idx > g_idx_min); - if (nbits > nbits_budget) + if (!lc3_hr(sr) && nbits > nbits_budget) return (g_idx < 255) + (g_idx < 254 && nbits >= nbits_budget + delta); return 0; } -/** - * Unquantize gain - * g_int Quantization gain value - * return Unquantized gain value - */ -static float unquantize_gain(int g_int) -{ - /* Unquantization gain table : - * G[i] = 10 ^ (i / 28) , i = [0..64] */ - - static const float iq_table[] = { - 1.00000000e+00, 1.08571112e+00, 1.17876863e+00, 1.27980221e+00, - 1.38949549e+00, 1.50859071e+00, 1.63789371e+00, 1.77827941e+00, - 1.93069773e+00, 2.09617999e+00, 2.27584593e+00, 2.47091123e+00, - 2.68269580e+00, 2.91263265e+00, 3.16227766e+00, 3.43332002e+00, - 3.72759372e+00, 4.04708995e+00, 4.39397056e+00, 4.77058270e+00, - 5.17947468e+00, 5.62341325e+00, 6.10540230e+00, 6.62870316e+00, - 7.19685673e+00, 7.81370738e+00, 8.48342898e+00, 9.21055318e+00, - 1.00000000e+01, 1.08571112e+01, 1.17876863e+01, 1.27980221e+01, - 1.38949549e+01, 1.50859071e+01, 1.63789371e+01, 1.77827941e+01, - 1.93069773e+01, 2.09617999e+01, 2.27584593e+01, 2.47091123e+01, - 2.68269580e+01, 2.91263265e+01, 3.16227766e+01, 3.43332002e+01, - 3.72759372e+01, 4.04708995e+01, 4.39397056e+01, 4.77058270e+01, - 5.17947468e+01, 5.62341325e+01, 6.10540230e+01, 6.62870316e+01, - 7.19685673e+01, 7.81370738e+01, 8.48342898e+01, 9.21055318e+01, - 1.00000000e+02, 1.08571112e+02, 1.17876863e+02, 1.27980221e+02, - 1.38949549e+02, 1.50859071e+02, 1.63789371e+02, 1.77827941e+02, - 1.93069773e+02 - }; - - float g = iq_table[LC3_ABS(g_int) & 0x3f]; - for(int n64 = LC3_ABS(g_int) >> 6; n64--; ) - g *= iq_table[64]; - - return g_int >= 0 ? g : 1 / g; -} - /** * Spectrum quantization * dt, sr Duration and samplerate of the frame * g_int Quantization gain value * x Spectral coefficients, scaled as output - * xq, nq Output spectral quantized coefficients, and count - * - * The spectral coefficients `xq` are stored as : - * b0 0:positive or zero 1:negative - * b15..b1 Absolute value + * n Return count of significants */ -LC3_HOT static void quantize(enum lc3_dt dt, enum lc3_srate sr, - int g_int, float *x, uint16_t *xq, int *nq) +LC3_HOT static void quantize( + enum lc3_dt dt, enum lc3_srate sr, int g_int, float *x, int *n) { - float g_inv = 1 / unquantize_gain(g_int); - int ne = LC3_NE(dt, sr); + float g_inv = unquantize_gain(-g_int); + int ne = lc3_ne(dt, sr); - *nq = ne; + *n = ne; for (int i = 0; i < ne; i += 2) { - uint16_t x0, x1; + float xq_min = lc3_hr(sr) ? 0.5f : 10.f/16; x[i+0] *= g_inv; x[i+1] *= g_inv; - x0 = fminf(fabsf(x[i+0]) + 6.f/16, INT16_MAX); - x1 = fminf(fabsf(x[i+1]) + 6.f/16, INT16_MAX); - - xq[i+0] = (x0 << 1) + ((x0 > 0) & (x[i+0] < 0)); - xq[i+1] = (x1 << 1) + ((x1 > 0) & (x[i+1] < 0)); - - *nq = x0 || x1 ? ne : *nq - 2; + *n = fabsf(x[i+0]) >= xq_min || + fabsf(x[i+1]) >= xq_min ? ne : *n - 2; } } @@ -238,11 +274,12 @@ LC3_HOT static void quantize(enum lc3_dt dt, enum lc3_srate sr, * x, nq Spectral quantized, and count of significants * return Unquantized gain value */ -LC3_HOT static float unquantize(enum lc3_dt dt, enum lc3_srate sr, +LC3_HOT static float unquantize( + enum lc3_dt dt, enum lc3_srate sr, int g_int, float *x, int nq) { float g = unquantize_gain(g_int); - int i, ne = LC3_NE(dt, sr); + int i, ne = lc3_ne(dt, sr); for (i = 0; i < nq; i++) x[i] = x[i] * g; @@ -259,13 +296,19 @@ LC3_HOT static float unquantize(enum lc3_dt dt, enum lc3_srate sr, * -------------------------------------------------------------------------- */ /** - * Resolve High-bitrate mode according size of the frame + * Resolve High-bitrate and LSB modes according size of the frame * sr, nbytes Samplerate and size of the frame + * p_lsb_mode True when LSB mode allowed, when not NULL * return True when High-Rate mode enabled */ -static int resolve_high_rate(enum lc3_srate sr, int nbytes) +static bool resolve_modes(enum lc3_srate sr, int nbytes, bool *p_lsb_mode) { - return nbytes > 20 * (1 + (int)sr); + int sr_ind = lc3_hr(sr) ? 4 + (sr - LC3_SRATE_48K_HR) : sr; + + if (p_lsb_mode) + *p_lsb_mode = (nbytes >= 20 * (3 + sr_ind)) && (sr < LC3_SRATE_96K_HR); + + return (nbytes > 20 * (1 + sr_ind)) && (sr < LC3_SRATE_96K_HR); } /** @@ -276,21 +319,13 @@ static int resolve_high_rate(enum lc3_srate sr, int nbytes) * nbits_budget Truncate to stay in budget, when not zero * p_lsb_mode Return True when LSB's are not AC coded, or NULL * return The number of bits coding the spectrum - * - * The spectral coefficients `x` storage is : - * b0 0:positive or zero 1:negative - * b15..b1 Absolute value */ LC3_HOT static int compute_nbits( enum lc3_dt dt, enum lc3_srate sr, int nbytes, - const uint16_t *x, int *n, int nbits_budget, bool *p_lsb_mode) + const float *x, int *n, int nbits_budget, bool *p_lsb_mode) { - int ne = LC3_NE(dt, sr); - - /* --- Mode and rate --- */ - - bool lsb_mode = nbytes >= 20 * (3 + (int)sr); - bool high_rate = resolve_high_rate(sr, nbytes); + bool lsb_mode, high_rate = resolve_modes(sr, nbytes, &lsb_mode); + int ne = lc3_ne(dt, sr); /* --- Loop on quantized coefficients --- */ @@ -308,12 +343,15 @@ LC3_HOT static int compute_nbits( for ( ; i < LC3_MIN(*n, (ne + 2) >> (1 - h)) && nbits <= nbits_budget; i += 2) { + float xq_off = lc3_hr(sr) ? 0.5f : 6.f/16; + uint32_t a = fabsf(x[i+0]) + xq_off; + uint32_t b = fabsf(x[i+1]) + xq_off; + const uint8_t *lut = lut_coeff[state]; - uint16_t a = x[i] >> 1, b = x[i+1] >> 1; /* --- Sign values --- */ - int s = (a > 0) + (b > 0); + int s = (a != 0) + (b != 0); nbits += s * 2048; /* --- LSB values Reduce to 2*2 bits MSB values --- @@ -322,8 +360,8 @@ LC3_HOT static int compute_nbits( * The LSB mode does not arthmetic code the first LSB, * add the sign of the LSB when one of pair was at value 1 */ - int k = 0; - int m = (a | b) >> 2; + uint32_t m = (a | b) >> 2; + unsigned k = 0; if (m) { @@ -375,19 +413,15 @@ LC3_HOT static int compute_nbits( * Put quantized spectrum * bits Bitstream context * dt, sr, nbytes Duration, samplerate and size of the frame - * x Spectral quantized + * x Spectral quantized coefficients * nq, lsb_mode Count of significants, and LSB discard indication - * - * The spectral coefficients `x` storage is : - * b0 0:positive or zero 1:negative - * b15..b1 Absolute value */ LC3_HOT static void put_quantized(lc3_bits_t *bits, enum lc3_dt dt, enum lc3_srate sr, int nbytes, - const uint16_t *x, int nq, bool lsb_mode) + const float *x, int nq, bool lsb_mode) { - int ne = LC3_NE(dt, sr); - bool high_rate = resolve_high_rate(sr, nbytes); + bool high_rate = resolve_modes(sr, nbytes, NULL); + int ne = lc3_ne(dt, sr); /* --- Loop on quantized coefficients --- */ @@ -398,16 +432,19 @@ LC3_HOT static void put_quantized(lc3_bits_t *bits, for ( ; i < LC3_MIN(nq, (ne + 2) >> (1 - h)); i += 2) { + float xq_off = lc3_hr(sr) ? 0.5f : 6.f/16; + uint32_t a = fabsf(x[i+0]) + xq_off; + uint32_t b = fabsf(x[i+1]) + xq_off; + const uint8_t *lut = lut_coeff[state]; - uint16_t a = x[i] >> 1, b = x[i+1] >> 1; /* --- LSB values Reduce to 2*2 bits MSB values --- * Reduce to 2x2 bits MSB values. The LSB's pair are arithmetic * coded with an escape code and 1 bits for each values. * The LSB mode discard the first LSB (at this step) */ - int m = (a | b) >> 2; - int k = 0, shr = 0; + uint32_t m = (a | b) >> 2; + unsigned k = 0, shr = 0; if (m) { @@ -431,8 +468,8 @@ LC3_HOT static void put_quantized(lc3_bits_t *bits, /* --- Sign values --- */ - if (a) lc3_put_bit(bits, x[i+0] & 1); - if (b) lc3_put_bit(bits, x[i+1] & 1); + if (a) lc3_put_bit(bits, x[i+0] < 0); + if (b) lc3_put_bit(bits, x[i+1] < 0); /* --- MSB values --- */ @@ -453,18 +490,18 @@ LC3_HOT static void put_quantized(lc3_bits_t *bits, * bits Bitstream context * dt, sr, nbytes Duration, samplerate and size of the frame * nq, lsb_mode Count of significants, and LSB discard indication - * xq Return `nq` spectral quantized coefficients + * x Return `nq` spectral quantized coefficients * nf_seed Return the noise factor seed associated * return 0: Ok -1: Invalid bitstream data */ LC3_HOT static int get_quantized(lc3_bits_t *bits, enum lc3_dt dt, enum lc3_srate sr, int nbytes, - int nq, bool lsb_mode, float *xq, uint16_t *nf_seed) + int nq, bool lsb_mode, float *x, uint16_t *nf_seed) { - int ne = LC3_NE(dt, sr); - bool high_rate = resolve_high_rate(sr, nbytes); + bool high_rate = resolve_modes(sr, nbytes, NULL); + int ne = lc3_ne(dt, sr); - *nf_seed = 0; + *nf_seed = 0; /* --- Loop on quantized coefficients --- */ @@ -476,6 +513,7 @@ LC3_HOT static int get_quantized(lc3_bits_t *bits, for ( ; i < LC3_MIN(nq, (ne + 2) >> (1 - h)); i += 2) { const uint8_t *lut = lut_coeff[state]; + int max_shl = lc3_hr(sr) ? 22 : 14; /* --- LSB values --- * Until the symbol read indicates the escape value 16, @@ -492,7 +530,7 @@ LC3_HOT static int get_quantized(lc3_bits_t *bits, shl++; } - for ( ; s >= 16 && shl < 14; shl++) { + for ( ; s >= 16 && shl < max_shl; shl++) { u |= lc3_get_bit(bits) << shl; v |= lc3_get_bit(bits) << shl; @@ -511,10 +549,11 @@ LC3_HOT static int get_quantized(lc3_bits_t *bits, u |= a << shl; v |= b << shl; - xq[i ] = u && lc3_get_bit(bits) ? -u : u; - xq[i+1] = v && lc3_get_bit(bits) ? -v : v; + x[i+0] = u && lc3_get_bit(bits) ? -u : u; + x[i+1] = v && lc3_get_bit(bits) ? -v : v; - *nf_seed = (*nf_seed + u * i + v * (i+1)) & 0xffff; + *nf_seed = (*nf_seed + (u & 0x7fff) * (i ) + + (v & 0x7fff) * (i+1)) & 0xffff; /* --- Update state --- */ @@ -529,25 +568,30 @@ LC3_HOT static int get_quantized(lc3_bits_t *bits, * Put residual bits of quantization * bits Bitstream context * nbits Maximum number of bits to output + * hrmode High-Resolution mode * x, n Spectral quantized, and count of significants - * xf Scaled spectral coefficients - * - * The spectral coefficients `x` storage is : - * b0 0:positive or zero 1:negative - * b15..b1 Absolute value */ -LC3_HOT static void put_residual( - lc3_bits_t *bits, int nbits, const uint16_t *x, int n, const float *xf) +LC3_HOT static void put_residual(lc3_bits_t *bits, + int nbits, bool hrmode, float *x, int n) { - for (int i = 0; i < n && nbits > 0; i++) { + float xq_lim = hrmode ? 0.5f : 10.f/16; + float xq_off = xq_lim / 2; - if (x[i] == 0) - continue; + for (int iter = 0; iter < (hrmode ? 20 : 1) && nbits > 0; iter++) { + for (int i = 0; i < n && nbits > 0; i++) { - float xq = x[i] & 1 ? -(x[i] >> 1) : (x[i] >> 1); + float xr = fabsf(x[i]); + if (xr < xq_lim) + continue; - lc3_put_bit(bits, xf[i] >= xq); - nbits--; + bool b = (xr - truncf(xr) < xq_lim) ^ (x[i] < 0); + lc3_put_bit(bits, b); + nbits--; + + x[i] += b ? -xq_off : xq_off; + } + + xq_off *= xq_lim; } } @@ -555,22 +599,31 @@ LC3_HOT static void put_residual( * Get residual bits of quantization * bits Bitstream context * nbits Maximum number of bits to output + * hrmode High-Resolution mode * x, nq Spectral quantized, and count of significants */ -LC3_HOT static void get_residual( - lc3_bits_t *bits, int nbits, float *x, int nq) +LC3_HOT static void get_residual(lc3_bits_t *bits, + int nbits, bool hrmode, float *x, int n) { - for (int i = 0; i < nq && nbits > 0; i++) { + float xq_off_1 = hrmode ? 0.25f : 5.f/16; + float xq_off_2 = hrmode ? 0.25f : 3.f/16; - if (x[i] == 0) - continue; + for (int iter = 0; iter < (hrmode ? 20 : 1) && nbits > 0; iter++) { + for (int i = 0; i < n && nbits > 0; i++) { - if (lc3_get_bit(bits) == 0) - x[i] -= x[i] < 0 ? 5.f/16 : 3.f/16; - else - x[i] += x[i] > 0 ? 5.f/16 : 3.f/16; + if (x[i] == 0) + continue; - nbits--; + if (lc3_get_bit(bits) == 0) + x[i] -= x[i] < 0 ? xq_off_1 : xq_off_2; + else + x[i] += x[i] > 0 ? xq_off_1 : xq_off_2; + + nbits--; + } + + xq_off_1 *= 0.5f; + xq_off_2 *= 0.5f; } } @@ -578,18 +631,17 @@ LC3_HOT static void get_residual( * Put LSB values of quantized spectrum values * bits Bitstream context * nbits Maximum number of bits to output + * hrmode High-Resolution mode * x, n Spectral quantized, and count of significants - * - * The spectral coefficients `x` storage is : - * b0 0:positive or zero 1:negative - * b15..b1 Absolute value */ -LC3_HOT static void put_lsb( - lc3_bits_t *bits, int nbits, const uint16_t *x, int n) +LC3_HOT static void put_lsb(lc3_bits_t *bits, + int nbits, bool hrmode, const float *x, int n) { for (int i = 0; i < n && nbits > 0; i += 2) { - uint16_t a = x[i] >> 1, b = x[i+1] >> 1; - int a_neg = x[i] & 1, b_neg = x[i+1] & 1; + + float xq_off = hrmode ? 0.5f : 6.f/16; + uint32_t a = fabsf(x[i+0]) + xq_off; + uint32_t b = fabsf(x[i+1]) + xq_off; if ((a | b) >> 2 == 0) continue; @@ -598,13 +650,13 @@ LC3_HOT static void put_lsb( lc3_put_bit(bits, a & 1); if (a == 1 && nbits-- > 0) - lc3_put_bit(bits, a_neg); + lc3_put_bit(bits, x[i+0] < 0); if (nbits-- > 0) lc3_put_bit(bits, b & 1); if (b == 1 && nbits-- > 0) - lc3_put_bit(bits, b_neg); + lc3_put_bit(bits, x[i+1] < 0); } } @@ -655,34 +707,31 @@ LC3_HOT static void get_lsb(lc3_bits_t *bits, /** * Estimate noise level * dt, bw Duration and bandwidth of the frame - * xq, nq Quantized spectral coefficients - * x Quantization scaled spectrum coefficients + * hrmode High-Resolution mode + * x, n Spectral quantized, and count of significants * return Noise factor (0 to 7) - * - * The spectral coefficients `x` storage is : - * b0 0:positive or zero 1:negative - * b15..b1 Absolute value */ -LC3_HOT static int estimate_noise(enum lc3_dt dt, enum lc3_bandwidth bw, - const uint16_t *xq, int nq, const float *x) +LC3_HOT static int estimate_noise( + enum lc3_dt dt, enum lc3_bandwidth bw, bool hrmode, const float *x, int n) { - int bw_stop = 20 * (1 + dt) * (1 + bw); + int bw_stop = lc3_ne(dt, (enum lc3_srate)LC3_MIN(bw, LC3_BANDWIDTH_FB)); int w = 1 + (dt >= LC3_DT_7M5) + (dt>= LC3_DT_10M); + float xq_lim = hrmode ? 0.5f : 10.f/16; float sum = 0; - int i, n = 0, z = 0; + int i, ns = 0, z = 0; - for (i = 6 * (1 + dt) - w; i < LC3_MIN(nq, bw_stop); i++) { - z = xq[i] ? 0 : z + 1; + for (i = 6 * (1 + dt) - w; i < LC3_MIN(n, bw_stop); i++) { + z = fabsf(x[i]) < xq_lim ? z + 1 : 0; if (z > 2*w) - sum += fabsf(x[i - w]), n++; + sum += fabsf(x[i - w]), ns++; } for ( ; i < bw_stop + w; i++) if (++z > 2*w) - sum += fabsf(x[i - w]), n++; + sum += fabsf(x[i - w]), ns++; - int nf = n ? 8 - (int)((16 * sum) / n + 0.5f) : 8; + int nf = ns ? 8 - (int)((16 * sum) / ns + 0.5f) : 8; return LC3_CLIP(nf, 0, 7); } @@ -697,7 +746,7 @@ LC3_HOT static int estimate_noise(enum lc3_dt dt, enum lc3_bandwidth bw, LC3_HOT static void fill_noise(enum lc3_dt dt, enum lc3_bandwidth bw, int nf, uint16_t nf_seed, float g, float *x, int nq) { - int bw_stop = 20 * (1 + dt) * (1 + bw); + int bw_stop = lc3_ne(dt, (enum lc3_srate)LC3_MIN(bw, LC3_BANDWIDTH_FB)); int w = 1 + (dt >= LC3_DT_7M5) + (dt>= LC3_DT_10M); float s = g * (float)(8 - nf) / 16; @@ -745,13 +794,13 @@ static int get_noise_factor(lc3_bits_t *bits) /** * Bit consumption of the number of coded coefficients - * dt, sr Duration, samplerate of the frame + * dt, sr, nbytes Duration, samplerate and size of the frame * return Bit consumpution of the number of coded coefficients */ static int get_nbits_nq(enum lc3_dt dt, enum lc3_srate sr) { - int ne = LC3_NE(dt, sr); - return 4 + (ne > 32) + (ne > 64) + (ne > 128) + (ne > 256); + int ne = lc3_ne(dt, sr); + return 4 + (ne > 32) + (ne > 64) + (ne > 128) + (ne > 256) + (ne > 512); } /** @@ -761,16 +810,18 @@ static int get_nbits_nq(enum lc3_dt dt, enum lc3_srate sr) */ static int get_nbits_ac(enum lc3_dt dt, enum lc3_srate sr, int nbytes) { - return get_nbits_nq(dt, sr) + 3 + LC3_MIN((nbytes-1) / 160, 2); + return get_nbits_nq(dt, sr) + + 3 + lc3_hr(sr) + LC3_MIN((nbytes-1) / 160, 2); } /** * Spectrum analysis */ -void lc3_spec_analyze(enum lc3_dt dt, enum lc3_srate sr, - int nbytes, bool pitch, const lc3_tns_data_t *tns, - struct lc3_spec_analysis *spec, float *x, - uint16_t *xq, struct lc3_spec_side *side) +void lc3_spec_analyze( + enum lc3_dt dt, enum lc3_srate sr, int nbytes, + bool pitch, const lc3_tns_data_t *tns, + struct lc3_spec_analysis *spec, + float *x, struct lc3_spec_side *side) { bool reset_off; @@ -792,35 +843,36 @@ void lc3_spec_analyze(enum lc3_dt dt, enum lc3_srate sr, int g_off = resolve_gain_offset(sr, nbytes); int g_min, g_int = estimate_gain(dt, sr, - x, nbits_budget, nbits_off, g_off, &reset_off, &g_min); + x, nbytes, nbits_budget, nbits_off, g_off, &reset_off, &g_min); /* --- Quantization --- */ - quantize(dt, sr, g_int, x, xq, &side->nq); + quantize(dt, sr, g_int, x, &side->nq); - int nbits = compute_nbits(dt, sr, nbytes, xq, &side->nq, 0, NULL); + int nbits = compute_nbits(dt, sr, nbytes, x, &side->nq, 0, NULL); spec->nbits_off = reset_off ? 0 : nbits_off; spec->nbits_spare = reset_off ? 0 : nbits_budget - nbits; /* --- Adjust gain and requantize --- */ - int g_adj = adjust_gain(sr, g_off + g_int, - nbits, nbits_budget, g_off + g_min); + int g_adj = adjust_gain(dt, sr, + g_off + g_int, nbits, nbits_budget, g_off + g_min); if (g_adj) - quantize(dt, sr, g_adj, x, xq, &side->nq); + quantize(dt, sr, g_adj, x, &side->nq); side->g_idx = g_int + g_adj + g_off; nbits = compute_nbits(dt, sr, nbytes, - xq, &side->nq, nbits_budget, &side->lsb_mode); + x, &side->nq, nbits_budget, &side->lsb_mode); } /** * Put spectral quantization side data */ void lc3_spec_put_side(lc3_bits_t *bits, - enum lc3_dt dt, enum lc3_srate sr, const struct lc3_spec_side *side) + enum lc3_dt dt, enum lc3_srate sr, + const struct lc3_spec_side *side) { int nbits_nq = get_nbits_nq(dt, sr); @@ -833,22 +885,22 @@ void lc3_spec_put_side(lc3_bits_t *bits, * Encode spectral coefficients */ void lc3_spec_encode(lc3_bits_t *bits, - enum lc3_dt dt, enum lc3_srate sr, enum lc3_bandwidth bw, int nbytes, - const uint16_t *xq, const lc3_spec_side_t *side, const float *x) + enum lc3_dt dt, enum lc3_srate sr, enum lc3_bandwidth bw, + int nbytes, const lc3_spec_side_t *side, float *x) { bool lsb_mode = side->lsb_mode; int nq = side->nq; - put_noise_factor(bits, estimate_noise(dt, bw, xq, nq, x)); + put_noise_factor(bits, estimate_noise(dt, bw, lc3_hr(sr), x, nq)); - put_quantized(bits, dt, sr, nbytes, xq, nq, lsb_mode); + put_quantized(bits, dt, sr, nbytes, x, nq, lsb_mode); int nbits_left = lc3_get_bits_left(bits); if (lsb_mode) - put_lsb(bits, nbits_left, xq, nq); + put_lsb(bits, nbits_left, lc3_hr(sr), x, nq); else - put_residual(bits, nbits_left, xq, nq, x); + put_residual(bits, nbits_left, lc3_hr(sr), x, nq); } @@ -863,7 +915,7 @@ int lc3_spec_get_side(lc3_bits_t *bits, enum lc3_dt dt, enum lc3_srate sr, struct lc3_spec_side *side) { int nbits_nq = get_nbits_nq(dt, sr); - int ne = LC3_NE(dt, sr); + int ne = lc3_ne(dt, sr); side->nq = (lc3_get_bits(bits, nbits_nq) + 1) << 1; side->lsb_mode = lc3_get_bit(bits); @@ -895,7 +947,7 @@ int lc3_spec_decode(lc3_bits_t *bits, if (lsb_mode) get_lsb(bits, nbits_left, x, nq, &nf_seed); else - get_residual(bits, nbits_left, x, nq); + get_residual(bits, nbits_left, lc3_hr(sr), x, nq); int g_int = side->g_idx - resolve_gain_offset(sr, nbytes); float g = unquantize(dt, sr, g_int, x, nq); diff --git a/src/spec.h b/src/spec.h index 95c00d1..9284363 100644 --- a/src/spec.h +++ b/src/spec.h @@ -46,15 +46,12 @@ typedef struct lc3_spec_side { * pitch, tns Pitch present indication and TNS bistream data * spec Context of analysis * x Spectral coefficients, scaled as output - * xq, side Return quantization data - * - * The spectral coefficients `xq` storage is : - * b0 0:positive or zero 1:negative - * b15..b1 Absolute value + * side Return quantization data */ -void lc3_spec_analyze(enum lc3_dt dt, enum lc3_srate sr, - int nbytes, bool pitch, const lc3_tns_data_t *tns, - lc3_spec_analysis_t *spec, float *x, uint16_t *xq, lc3_spec_side_t *side); +void lc3_spec_analyze( + enum lc3_dt dt, enum lc3_srate sr, int nbytes, + bool pitch, const lc3_tns_data_t *tns, lc3_spec_analysis_t *spec, + float *x, lc3_spec_side_t *side); /** * Put spectral quantization side data @@ -70,16 +67,11 @@ void lc3_spec_put_side(lc3_bits_t *bits, * bits Bitstream context * dt, sr, bw Duration, samplerate, bandwidth * nbytes and size of the frame - * xq, side Quantization data - * x Scaled spectral coefficients - * - * The spectral coefficients `xq` storage is : - * b0 0:positive or zero 1:negative - * b15..b1 Absolute value + * side, x Quantization data, and scaled coefficients */ void lc3_spec_encode(lc3_bits_t *bits, - enum lc3_dt dt, enum lc3_srate sr, enum lc3_bandwidth bw, int nbytes, - const uint16_t *xq, const lc3_spec_side_t *side, const float *x); + enum lc3_dt dt, enum lc3_srate sr, enum lc3_bandwidth bw, + int nbytes, const lc3_spec_side_t *side, float *x); /* ---------------------------------------------------------------------------- @@ -105,8 +97,9 @@ int lc3_spec_get_side(lc3_bits_t *bits, * x Spectral coefficients * return 0: Ok -1: Invalid bitstream data */ -int lc3_spec_decode(lc3_bits_t *bits, enum lc3_dt dt, enum lc3_srate sr, - enum lc3_bandwidth bw, int nbytes, const lc3_spec_side_t *side, float *x); +int lc3_spec_decode(lc3_bits_t *bits, + enum lc3_dt dt, enum lc3_srate sr, enum lc3_bandwidth bw, + int nbytes, const lc3_spec_side_t *side, float *x); #endif /* __LC3_SPEC_H */ diff --git a/src/tables.c b/src/tables.c index 3e82d33..85568a1 100644 --- a/src/tables.c +++ b/src/tables.c @@ -19,6 +19,60 @@ #include "tables.h" +/** + * Characteristics + */ + +const int lc3_ns_2m5[LC3_NUM_SRATE] = { + [LC3_SRATE_8K ] = LC3_NS(2500, 8000), + [LC3_SRATE_16K ] = LC3_NS(2500, 16000), + [LC3_SRATE_24K ] = LC3_NS(2500, 24000), + [LC3_SRATE_32K ] = LC3_NS(2500, 32000), + [LC3_SRATE_48K ] = LC3_NS(2500, 48000), + [LC3_SRATE_48K_HR] = LC3_NS(2500, 48000), + [LC3_SRATE_96K_HR] = LC3_NS(2500, 96000), +}; + +const int lc3_ne_2m5[LC3_NUM_SRATE] = { + [LC3_SRATE_8K ] = LC3_NS(2500, 8000), + [LC3_SRATE_16K ] = LC3_NS(2500, 16000), + [LC3_SRATE_24K ] = LC3_NS(2500, 24000), + [LC3_SRATE_32K ] = LC3_NS(2500, 32000), + [LC3_SRATE_48K ] = LC3_NS(2500, 40000), + [LC3_SRATE_48K_HR] = LC3_NS(2500, 48000), + [LC3_SRATE_96K_HR] = LC3_NS(2500, 96000), +}; + +const int lc3_ns_4m[LC3_NUM_SRATE] = { + [LC3_SRATE_8K ] = LC3_NS(4000, 8000), + [LC3_SRATE_16K ] = LC3_NS(4000, 16000), + [LC3_SRATE_24K ] = LC3_NS(4000, 24000), + [LC3_SRATE_32K ] = LC3_NS(4000, 32000), + [LC3_SRATE_48K ] = LC3_NS(4000, 48000), + [LC3_SRATE_48K_HR] = LC3_NS(4000, 48000), + [LC3_SRATE_96K_HR] = LC3_NS(4000, 96000), +}; + + +/** + * Limits on size of frame + */ + +const int lc3_frame_bytes_hr_lim + [LC3_NUM_DT][LC3_NUM_SRATE - LC3_SRATE_48K_HR][2] = { + + [LC3_DT_2M5][LC3_SRATE_48K_HR - LC3_SRATE_48K_HR] = { 54, 210 }, + [LC3_DT_2M5][LC3_SRATE_96K_HR - LC3_SRATE_48K_HR] = { 62, 210 }, + + [LC3_DT_5M ][LC3_SRATE_48K_HR - LC3_SRATE_48K_HR] = { 93, 375 }, + [LC3_DT_5M ][LC3_SRATE_96K_HR - LC3_SRATE_48K_HR] = { 109, 375 }, + + [LC3_DT_10M][LC3_SRATE_48K_HR - LC3_SRATE_48K_HR] = { 156, 625 }, + [LC3_DT_10M][LC3_SRATE_96K_HR - LC3_SRATE_48K_HR] = { 187, 625 }, + +}; + + /** * Twiddles FFT 3 points * @@ -422,12 +476,141 @@ static const struct lc3_fft_bf2_twiddles fft_twiddles_240 = { } }; +#if LC3_PLUS_HR + +static const struct lc3_fft_bf2_twiddles fft_twiddles_480 = { + .n2 = 480/2, .t = (const struct lc3_complex []){ + { 1.0000000e+00, -0.0000000e+00 }, { 9.9991433e-01, -1.3089596e-02 }, + { 9.9965732e-01, -2.6176948e-02 }, { 9.9922904e-01, -3.9259816e-02 }, + { 9.9862953e-01, -5.2335956e-02 }, { 9.9785892e-01, -6.5403129e-02 }, + { 9.9691733e-01, -7.8459096e-02 }, { 9.9580493e-01, -9.1501619e-02 }, + { 9.9452190e-01, -1.0452846e-01 }, { 9.9306846e-01, -1.1753740e-01 }, + { 9.9144486e-01, -1.3052619e-01 }, { 9.8965139e-01, -1.4349262e-01 }, + { 9.8768834e-01, -1.5643447e-01 }, { 9.8555606e-01, -1.6934950e-01 }, + { 9.8325491e-01, -1.8223553e-01 }, { 9.8078528e-01, -1.9509032e-01 }, + { 9.7814760e-01, -2.0791169e-01 }, { 9.7534232e-01, -2.2069744e-01 }, + { 9.7236992e-01, -2.3344536e-01 }, { 9.6923091e-01, -2.4615329e-01 }, + { 9.6592583e-01, -2.5881905e-01 }, { 9.6245524e-01, -2.7144045e-01 }, + { 9.5881973e-01, -2.8401534e-01 }, { 9.5501994e-01, -2.9654157e-01 }, + { 9.5105652e-01, -3.0901699e-01 }, { 9.4693013e-01, -3.2143947e-01 }, + { 9.4264149e-01, -3.3380686e-01 }, { 9.3819134e-01, -3.4611706e-01 }, + { 9.3358043e-01, -3.5836795e-01 }, { 9.2880955e-01, -3.7055744e-01 }, + { 9.2387953e-01, -3.8268343e-01 }, { 9.1879121e-01, -3.9474386e-01 }, + { 9.1354546e-01, -4.0673664e-01 }, { 9.0814317e-01, -4.1865974e-01 }, + { 9.0258528e-01, -4.3051110e-01 }, { 8.9687274e-01, -4.4228869e-01 }, + { 8.9100652e-01, -4.5399050e-01 }, { 8.8498764e-01, -4.6561452e-01 }, + { 8.7881711e-01, -4.7715876e-01 }, { 8.7249601e-01, -4.8862124e-01 }, + { 8.6602540e-01, -5.0000000e-01 }, { 8.5940641e-01, -5.1129309e-01 }, + { 8.5264016e-01, -5.2249856e-01 }, { 8.4572782e-01, -5.3361452e-01 }, + { 8.3867057e-01, -5.4463904e-01 }, { 8.3146961e-01, -5.5557023e-01 }, + { 8.2412619e-01, -5.6640624e-01 }, { 8.1664156e-01, -5.7714519e-01 }, + { 8.0901699e-01, -5.8778525e-01 }, { 8.0125381e-01, -5.9832460e-01 }, + { 7.9335334e-01, -6.0876143e-01 }, { 7.8531693e-01, -6.1909395e-01 }, + { 7.7714596e-01, -6.2932039e-01 }, { 7.6884183e-01, -6.3943900e-01 }, + { 7.6040597e-01, -6.4944805e-01 }, { 7.5183981e-01, -6.5934582e-01 }, + { 7.4314483e-01, -6.6913061e-01 }, { 7.3432251e-01, -6.7880075e-01 }, + { 7.2537437e-01, -6.8835458e-01 }, { 7.1630194e-01, -6.9779046e-01 }, + { 7.0710678e-01, -7.0710678e-01 }, { 6.9779046e-01, -7.1630194e-01 }, + { 6.8835458e-01, -7.2537437e-01 }, { 6.7880075e-01, -7.3432251e-01 }, + { 6.6913061e-01, -7.4314483e-01 }, { 6.5934582e-01, -7.5183981e-01 }, + { 6.4944805e-01, -7.6040597e-01 }, { 6.3943900e-01, -7.6884183e-01 }, + { 6.2932039e-01, -7.7714596e-01 }, { 6.1909395e-01, -7.8531693e-01 }, + { 6.0876143e-01, -7.9335334e-01 }, { 5.9832460e-01, -8.0125381e-01 }, + { 5.8778525e-01, -8.0901699e-01 }, { 5.7714519e-01, -8.1664156e-01 }, + { 5.6640624e-01, -8.2412619e-01 }, { 5.5557023e-01, -8.3146961e-01 }, + { 5.4463904e-01, -8.3867057e-01 }, { 5.3361452e-01, -8.4572782e-01 }, + { 5.2249856e-01, -8.5264016e-01 }, { 5.1129309e-01, -8.5940641e-01 }, + { 5.0000000e-01, -8.6602540e-01 }, { 4.8862124e-01, -8.7249601e-01 }, + { 4.7715876e-01, -8.7881711e-01 }, { 4.6561452e-01, -8.8498764e-01 }, + { 4.5399050e-01, -8.9100652e-01 }, { 4.4228869e-01, -8.9687274e-01 }, + { 4.3051110e-01, -9.0258528e-01 }, { 4.1865974e-01, -9.0814317e-01 }, + { 4.0673664e-01, -9.1354546e-01 }, { 3.9474386e-01, -9.1879121e-01 }, + { 3.8268343e-01, -9.2387953e-01 }, { 3.7055744e-01, -9.2880955e-01 }, + { 3.5836795e-01, -9.3358043e-01 }, { 3.4611706e-01, -9.3819134e-01 }, + { 3.3380686e-01, -9.4264149e-01 }, { 3.2143947e-01, -9.4693013e-01 }, + { 3.0901699e-01, -9.5105652e-01 }, { 2.9654157e-01, -9.5501994e-01 }, + { 2.8401534e-01, -9.5881973e-01 }, { 2.7144045e-01, -9.6245524e-01 }, + { 2.5881905e-01, -9.6592583e-01 }, { 2.4615329e-01, -9.6923091e-01 }, + { 2.3344536e-01, -9.7236992e-01 }, { 2.2069744e-01, -9.7534232e-01 }, + { 2.0791169e-01, -9.7814760e-01 }, { 1.9509032e-01, -9.8078528e-01 }, + { 1.8223553e-01, -9.8325491e-01 }, { 1.6934950e-01, -9.8555606e-01 }, + { 1.5643447e-01, -9.8768834e-01 }, { 1.4349262e-01, -9.8965139e-01 }, + { 1.3052619e-01, -9.9144486e-01 }, { 1.1753740e-01, -9.9306846e-01 }, + { 1.0452846e-01, -9.9452190e-01 }, { 9.1501619e-02, -9.9580493e-01 }, + { 7.8459096e-02, -9.9691733e-01 }, { 6.5403129e-02, -9.9785892e-01 }, + { 5.2335956e-02, -9.9862953e-01 }, { 3.9259816e-02, -9.9922904e-01 }, + { 2.6176948e-02, -9.9965732e-01 }, { 1.3089596e-02, -9.9991433e-01 }, + { 2.8327694e-16, -1.0000000e+00 }, { -1.3089596e-02, -9.9991433e-01 }, + { -2.6176948e-02, -9.9965732e-01 }, { -3.9259816e-02, -9.9922904e-01 }, + { -5.2335956e-02, -9.9862953e-01 }, { -6.5403129e-02, -9.9785892e-01 }, + { -7.8459096e-02, -9.9691733e-01 }, { -9.1501619e-02, -9.9580493e-01 }, + { -1.0452846e-01, -9.9452190e-01 }, { -1.1753740e-01, -9.9306846e-01 }, + { -1.3052619e-01, -9.9144486e-01 }, { -1.4349262e-01, -9.8965139e-01 }, + { -1.5643447e-01, -9.8768834e-01 }, { -1.6934950e-01, -9.8555606e-01 }, + { -1.8223553e-01, -9.8325491e-01 }, { -1.9509032e-01, -9.8078528e-01 }, + { -2.0791169e-01, -9.7814760e-01 }, { -2.2069744e-01, -9.7534232e-01 }, + { -2.3344536e-01, -9.7236992e-01 }, { -2.4615329e-01, -9.6923091e-01 }, + { -2.5881905e-01, -9.6592583e-01 }, { -2.7144045e-01, -9.6245524e-01 }, + { -2.8401534e-01, -9.5881973e-01 }, { -2.9654157e-01, -9.5501994e-01 }, + { -3.0901699e-01, -9.5105652e-01 }, { -3.2143947e-01, -9.4693013e-01 }, + { -3.3380686e-01, -9.4264149e-01 }, { -3.4611706e-01, -9.3819134e-01 }, + { -3.5836795e-01, -9.3358043e-01 }, { -3.7055744e-01, -9.2880955e-01 }, + { -3.8268343e-01, -9.2387953e-01 }, { -3.9474386e-01, -9.1879121e-01 }, + { -4.0673664e-01, -9.1354546e-01 }, { -4.1865974e-01, -9.0814317e-01 }, + { -4.3051110e-01, -9.0258528e-01 }, { -4.4228869e-01, -8.9687274e-01 }, + { -4.5399050e-01, -8.9100652e-01 }, { -4.6561452e-01, -8.8498764e-01 }, + { -4.7715876e-01, -8.7881711e-01 }, { -4.8862124e-01, -8.7249601e-01 }, + { -5.0000000e-01, -8.6602540e-01 }, { -5.1129309e-01, -8.5940641e-01 }, + { -5.2249856e-01, -8.5264016e-01 }, { -5.3361452e-01, -8.4572782e-01 }, + { -5.4463904e-01, -8.3867057e-01 }, { -5.5557023e-01, -8.3146961e-01 }, + { -5.6640624e-01, -8.2412619e-01 }, { -5.7714519e-01, -8.1664156e-01 }, + { -5.8778525e-01, -8.0901699e-01 }, { -5.9832460e-01, -8.0125381e-01 }, + { -6.0876143e-01, -7.9335334e-01 }, { -6.1909395e-01, -7.8531693e-01 }, + { -6.2932039e-01, -7.7714596e-01 }, { -6.3943900e-01, -7.6884183e-01 }, + { -6.4944805e-01, -7.6040597e-01 }, { -6.5934582e-01, -7.5183981e-01 }, + { -6.6913061e-01, -7.4314483e-01 }, { -6.7880075e-01, -7.3432251e-01 }, + { -6.8835458e-01, -7.2537437e-01 }, { -6.9779046e-01, -7.1630194e-01 }, + { -7.0710678e-01, -7.0710678e-01 }, { -7.1630194e-01, -6.9779046e-01 }, + { -7.2537437e-01, -6.8835458e-01 }, { -7.3432251e-01, -6.7880075e-01 }, + { -7.4314483e-01, -6.6913061e-01 }, { -7.5183981e-01, -6.5934582e-01 }, + { -7.6040597e-01, -6.4944805e-01 }, { -7.6884183e-01, -6.3943900e-01 }, + { -7.7714596e-01, -6.2932039e-01 }, { -7.8531693e-01, -6.1909395e-01 }, + { -7.9335334e-01, -6.0876143e-01 }, { -8.0125381e-01, -5.9832460e-01 }, + { -8.0901699e-01, -5.8778525e-01 }, { -8.1664156e-01, -5.7714519e-01 }, + { -8.2412619e-01, -5.6640624e-01 }, { -8.3146961e-01, -5.5557023e-01 }, + { -8.3867057e-01, -5.4463904e-01 }, { -8.4572782e-01, -5.3361452e-01 }, + { -8.5264016e-01, -5.2249856e-01 }, { -8.5940641e-01, -5.1129309e-01 }, + { -8.6602540e-01, -5.0000000e-01 }, { -8.7249601e-01, -4.8862124e-01 }, + { -8.7881711e-01, -4.7715876e-01 }, { -8.8498764e-01, -4.6561452e-01 }, + { -8.9100652e-01, -4.5399050e-01 }, { -8.9687274e-01, -4.4228869e-01 }, + { -9.0258528e-01, -4.3051110e-01 }, { -9.0814317e-01, -4.1865974e-01 }, + { -9.1354546e-01, -4.0673664e-01 }, { -9.1879121e-01, -3.9474386e-01 }, + { -9.2387953e-01, -3.8268343e-01 }, { -9.2880955e-01, -3.7055744e-01 }, + { -9.3358043e-01, -3.5836795e-01 }, { -9.3819134e-01, -3.4611706e-01 }, + { -9.4264149e-01, -3.3380686e-01 }, { -9.4693013e-01, -3.2143947e-01 }, + { -9.5105652e-01, -3.0901699e-01 }, { -9.5501994e-01, -2.9654157e-01 }, + { -9.5881973e-01, -2.8401534e-01 }, { -9.6245524e-01, -2.7144045e-01 }, + { -9.6592583e-01, -2.5881905e-01 }, { -9.6923091e-01, -2.4615329e-01 }, + { -9.7236992e-01, -2.3344536e-01 }, { -9.7534232e-01, -2.2069744e-01 }, + { -9.7814760e-01, -2.0791169e-01 }, { -9.8078528e-01, -1.9509032e-01 }, + { -9.8325491e-01, -1.8223553e-01 }, { -9.8555606e-01, -1.6934950e-01 }, + { -9.8768834e-01, -1.5643447e-01 }, { -9.8965139e-01, -1.4349262e-01 }, + { -9.9144486e-01, -1.3052619e-01 }, { -9.9306846e-01, -1.1753740e-01 }, + { -9.9452190e-01, -1.0452846e-01 }, { -9.9580493e-01, -9.1501619e-02 }, + { -9.9691733e-01, -7.8459096e-02 }, { -9.9785892e-01, -6.5403129e-02 }, + { -9.9862953e-01, -5.2335956e-02 }, { -9.9922904e-01, -3.9259816e-02 }, + { -9.9965732e-01, -2.6176948e-02 }, { -9.9991433e-01, -1.3089596e-02 }, + } +}; + +#endif /* LC3_PLUS_HR */ + const struct lc3_fft_bf2_twiddles *lc3_fft_twiddles_bf2[][3] = { { &fft_twiddles_10 , &fft_twiddles_30 , &fft_twiddles_90 }, { &fft_twiddles_20 , &fft_twiddles_60 , &fft_twiddles_180 }, { &fft_twiddles_40 , &fft_twiddles_120 }, { &fft_twiddles_80 , &fft_twiddles_240 }, - { &fft_twiddles_160 } + { &fft_twiddles_160, LC3_IF_PLUS_HR(&fft_twiddles_480, NULL) } }; @@ -438,7 +621,7 @@ const struct lc3_fft_bf2_twiddles *lc3_fft_twiddles_bf2[][3] = { * W[n] = e * sqrt( sqrt( 4/N ) ), n = [0..N/4-1] */ -#if !LC3_NPLUS +#if LC3_PLUS static const struct lc3_mdct_rot_def mdct_rot_40 = { .n4 = 40/4, .w = (const struct lc3_complex []){ @@ -465,7 +648,7 @@ static const struct lc3_mdct_rot_def mdct_rot_80 = { } }; -#endif /* !LC3_NPLUS */ +#endif /* LC3_PLUS */ static const struct lc3_mdct_rot_def mdct_rot_120 = { .n4 = 120/4, .w = (const struct lc3_complex []){ @@ -1012,23 +1195,275 @@ static const struct lc3_mdct_rot_def mdct_rot_960 = { } }; +#if LC3_PLUS_HR + +static const struct lc3_mdct_rot_def mdct_rot_1920 = { + .n4 = 1920/4, .w = (const struct lc3_complex []){ + { 2.1364349e-01, 8.7393339e-05 }, { 2.1364206e-01, 7.8653829e-04 }, + { 2.1363834e-01, 1.4856748e-03 }, { 2.1363233e-01, 2.1847954e-03 }, + { 2.1362404e-01, 2.8838927e-03 }, { 2.1361346e-01, 3.5829590e-03 }, + { 2.1360059e-01, 4.2819870e-03 }, { 2.1358543e-01, 4.9809691e-03 }, + { 2.1356799e-01, 5.6798979e-03 }, { 2.1354826e-01, 6.3787658e-03 }, + { 2.1352624e-01, 7.0775654e-03 }, { 2.1350193e-01, 7.7762893e-03 }, + { 2.1347534e-01, 8.4749298e-03 }, { 2.1344647e-01, 9.1734796e-03 }, + { 2.1341530e-01, 9.8719312e-03 }, { 2.1338185e-01, 1.0570277e-02 }, + { 2.1334612e-01, 1.1268510e-02 }, { 2.1330810e-01, 1.1966622e-02 }, + { 2.1326780e-01, 1.2664605e-02 }, { 2.1322521e-01, 1.3362454e-02 }, + { 2.1318034e-01, 1.4060159e-02 }, { 2.1313319e-01, 1.4757713e-02 }, + { 2.1308375e-01, 1.5455110e-02 }, { 2.1303204e-01, 1.6152341e-02 }, + { 2.1297804e-01, 1.6849399e-02 }, { 2.1292176e-01, 1.7546276e-02 }, + { 2.1286320e-01, 1.8242966e-02 }, { 2.1280236e-01, 1.8939460e-02 }, + { 2.1273924e-01, 1.9635751e-02 }, { 2.1267384e-01, 2.0331833e-02 }, + { 2.1260617e-01, 2.1027696e-02 }, { 2.1253622e-01, 2.1723334e-02 }, + { 2.1246399e-01, 2.2418740e-02 }, { 2.1238949e-01, 2.3113905e-02 }, + { 2.1231271e-01, 2.3808823e-02 }, { 2.1223366e-01, 2.4503486e-02 }, + { 2.1215233e-01, 2.5197887e-02 }, { 2.1206874e-01, 2.5892018e-02 }, + { 2.1198287e-01, 2.6585871e-02 }, { 2.1189473e-01, 2.7279440e-02 }, + { 2.1180433e-01, 2.7972716e-02 }, { 2.1171165e-01, 2.8665693e-02 }, + { 2.1161671e-01, 2.9358363e-02 }, { 2.1151950e-01, 3.0050719e-02 }, + { 2.1142003e-01, 3.0742753e-02 }, { 2.1131829e-01, 3.1434457e-02 }, + { 2.1121429e-01, 3.2125825e-02 }, { 2.1110803e-01, 3.2816849e-02 }, + { 2.1099951e-01, 3.3507522e-02 }, { 2.1088873e-01, 3.4197835e-02 }, + { 2.1077568e-01, 3.4887783e-02 }, { 2.1066039e-01, 3.5577357e-02 }, + { 2.1054283e-01, 3.6266549e-02 }, { 2.1042302e-01, 3.6955354e-02 }, + { 2.1030096e-01, 3.7643762e-02 }, { 2.1017664e-01, 3.8331768e-02 }, + { 2.1005008e-01, 3.9019363e-02 }, { 2.0992126e-01, 3.9706540e-02 }, + { 2.0979020e-01, 4.0393292e-02 }, { 2.0965689e-01, 4.1079611e-02 }, + { 2.0952134e-01, 4.1765490e-02 }, { 2.0938354e-01, 4.2450923e-02 }, + { 2.0924350e-01, 4.3135900e-02 }, { 2.0910121e-01, 4.3820416e-02 }, + { 2.0895669e-01, 4.4504462e-02 }, { 2.0880993e-01, 4.5188032e-02 }, + { 2.0866094e-01, 4.5871117e-02 }, { 2.0850971e-01, 4.6553712e-02 }, + { 2.0835625e-01, 4.7235808e-02 }, { 2.0820055e-01, 4.7917398e-02 }, + { 2.0804263e-01, 4.8598475e-02 }, { 2.0788248e-01, 4.9279031e-02 }, + { 2.0772010e-01, 4.9959060e-02 }, { 2.0755549e-01, 5.0638554e-02 }, + { 2.0738867e-01, 5.1317505e-02 }, { 2.0721962e-01, 5.1995907e-02 }, + { 2.0704836e-01, 5.2673752e-02 }, { 2.0687487e-01, 5.3351033e-02 }, + { 2.0669918e-01, 5.4027742e-02 }, { 2.0652126e-01, 5.4703873e-02 }, + { 2.0634114e-01, 5.5379418e-02 }, { 2.0615881e-01, 5.6054370e-02 }, + { 2.0597427e-01, 5.6728722e-02 }, { 2.0578752e-01, 5.7402466e-02 }, + { 2.0559857e-01, 5.8075596e-02 }, { 2.0540742e-01, 5.8748104e-02 }, + { 2.0521406e-01, 5.9419982e-02 }, { 2.0501851e-01, 6.0091224e-02 }, + { 2.0482077e-01, 6.0761823e-02 }, { 2.0462083e-01, 6.1431770e-02 }, + { 2.0441870e-01, 6.2101060e-02 }, { 2.0421438e-01, 6.2769685e-02 }, + { 2.0400787e-01, 6.3437638e-02 }, { 2.0379918e-01, 6.4104911e-02 }, + { 2.0358831e-01, 6.4771498e-02 }, { 2.0337525e-01, 6.5437391e-02 }, + { 2.0316002e-01, 6.6102584e-02 }, { 2.0294262e-01, 6.6767068e-02 }, + { 2.0272303e-01, 6.7430838e-02 }, { 2.0250128e-01, 6.8093885e-02 }, + { 2.0227736e-01, 6.8756203e-02 }, { 2.0205127e-01, 6.9417785e-02 }, + { 2.0182302e-01, 7.0078623e-02 }, { 2.0159261e-01, 7.0738711e-02 }, + { 2.0136004e-01, 7.1398041e-02 }, { 2.0112531e-01, 7.2056607e-02 }, + { 2.0088843e-01, 7.2714401e-02 }, { 2.0064940e-01, 7.3371416e-02 }, + { 2.0040822e-01, 7.4027646e-02 }, { 2.0016489e-01, 7.4683083e-02 }, + { 1.9991942e-01, 7.5337720e-02 }, { 1.9967181e-01, 7.5991550e-02 }, + { 1.9942206e-01, 7.6644566e-02 }, { 1.9917017e-01, 7.7296762e-02 }, + { 1.9891615e-01, 7.7948130e-02 }, { 1.9866000e-01, 7.8598663e-02 }, + { 1.9840173e-01, 7.9248354e-02 }, { 1.9814132e-01, 7.9897197e-02 }, + { 1.9787880e-01, 8.0545184e-02 }, { 1.9761416e-01, 8.1192308e-02 }, + { 1.9734740e-01, 8.1838563e-02 }, { 1.9707853e-01, 8.2483942e-02 }, + { 1.9680754e-01, 8.3128437e-02 }, { 1.9653445e-01, 8.3772042e-02 }, + { 1.9625926e-01, 8.4414750e-02 }, { 1.9598196e-01, 8.5056553e-02 }, + { 1.9570257e-01, 8.5697446e-02 }, { 1.9542107e-01, 8.6337421e-02 }, + { 1.9513749e-01, 8.6976472e-02 }, { 1.9485182e-01, 8.7614591e-02 }, + { 1.9456405e-01, 8.8251772e-02 }, { 1.9427421e-01, 8.8888007e-02 }, + { 1.9398228e-01, 8.9523291e-02 }, { 1.9368828e-01, 9.0157616e-02 }, + { 1.9339221e-01, 9.0790976e-02 }, { 1.9309406e-01, 9.1423363e-02 }, + { 1.9279384e-01, 9.2054771e-02 }, { 1.9249156e-01, 9.2685193e-02 }, + { 1.9218722e-01, 9.3314623e-02 }, { 1.9188082e-01, 9.3943054e-02 }, + { 1.9157237e-01, 9.4570478e-02 }, { 1.9126186e-01, 9.5196890e-02 }, + { 1.9094930e-01, 9.5822282e-02 }, { 1.9063470e-01, 9.6446648e-02 }, + { 1.9031806e-01, 9.7069981e-02 }, { 1.8999938e-01, 9.7692274e-02 }, + { 1.8967867e-01, 9.8313522e-02 }, { 1.8935592e-01, 9.8933716e-02 }, + { 1.8903115e-01, 9.9552851e-02 }, { 1.8870435e-01, 1.0017092e-01 }, + { 1.8837554e-01, 1.0078792e-01 }, { 1.8804470e-01, 1.0140383e-01 }, + { 1.8771185e-01, 1.0201866e-01 }, { 1.8737699e-01, 1.0263240e-01 }, + { 1.8704012e-01, 1.0324504e-01 }, { 1.8670125e-01, 1.0385657e-01 }, + { 1.8636039e-01, 1.0446700e-01 }, { 1.8601752e-01, 1.0507630e-01 }, + { 1.8567266e-01, 1.0568448e-01 }, { 1.8532582e-01, 1.0629152e-01 }, + { 1.8497699e-01, 1.0689743e-01 }, { 1.8462618e-01, 1.0750219e-01 }, + { 1.8427339e-01, 1.0810580e-01 }, { 1.8391863e-01, 1.0870825e-01 }, + { 1.8356190e-01, 1.0930954e-01 }, { 1.8320320e-01, 1.0990966e-01 }, + { 1.8284254e-01, 1.1050860e-01 }, { 1.8247992e-01, 1.1110636e-01 }, + { 1.8211535e-01, 1.1170293e-01 }, { 1.8174883e-01, 1.1229830e-01 }, + { 1.8138036e-01, 1.1289247e-01 }, { 1.8100995e-01, 1.1348543e-01 }, + { 1.8063761e-01, 1.1407718e-01 }, { 1.8026332e-01, 1.1466770e-01 }, + { 1.7988711e-01, 1.1525699e-01 }, { 1.7950897e-01, 1.1584506e-01 }, + { 1.7912891e-01, 1.1643188e-01 }, { 1.7874692e-01, 1.1701745e-01 }, + { 1.7836303e-01, 1.1760177e-01 }, { 1.7797722e-01, 1.1818483e-01 }, + { 1.7758951e-01, 1.1876663e-01 }, { 1.7719990e-01, 1.1934715e-01 }, + { 1.7680839e-01, 1.1992639e-01 }, { 1.7641498e-01, 1.2050436e-01 }, + { 1.7601969e-01, 1.2108103e-01 }, { 1.7562251e-01, 1.2165640e-01 }, + { 1.7522345e-01, 1.2223047e-01 }, { 1.7482252e-01, 1.2280323e-01 }, + { 1.7441971e-01, 1.2337468e-01 }, { 1.7401503e-01, 1.2394480e-01 }, + { 1.7360849e-01, 1.2451360e-01 }, { 1.7320010e-01, 1.2508107e-01 }, + { 1.7278984e-01, 1.2564719e-01 }, { 1.7237774e-01, 1.2621197e-01 }, + { 1.7196379e-01, 1.2677540e-01 }, { 1.7154800e-01, 1.2733747e-01 }, + { 1.7113037e-01, 1.2789818e-01 }, { 1.7071091e-01, 1.2845751e-01 }, + { 1.7028962e-01, 1.2901548e-01 }, { 1.6986650e-01, 1.2957206e-01 }, + { 1.6944157e-01, 1.3012725e-01 }, { 1.6901482e-01, 1.3068105e-01 }, + { 1.6858627e-01, 1.3123344e-01 }, { 1.6815590e-01, 1.3178444e-01 }, + { 1.6772374e-01, 1.3233402e-01 }, { 1.6728978e-01, 1.3288219e-01 }, + { 1.6685403e-01, 1.3342893e-01 }, { 1.6641649e-01, 1.3397424e-01 }, + { 1.6597717e-01, 1.3451812e-01 }, { 1.6553608e-01, 1.3506056e-01 }, + { 1.6509321e-01, 1.3560155e-01 }, { 1.6464857e-01, 1.3614109e-01 }, + { 1.6420217e-01, 1.3667917e-01 }, { 1.6375401e-01, 1.3721579e-01 }, + { 1.6330409e-01, 1.3775093e-01 }, { 1.6285243e-01, 1.3828461e-01 }, + { 1.6239902e-01, 1.3881680e-01 }, { 1.6194388e-01, 1.3934750e-01 }, + { 1.6148700e-01, 1.3987672e-01 }, { 1.6102839e-01, 1.4040443e-01 }, + { 1.6056805e-01, 1.4093064e-01 }, { 1.6010600e-01, 1.4145535e-01 }, + { 1.5964223e-01, 1.4197853e-01 }, { 1.5917676e-01, 1.4250020e-01 }, + { 1.5870957e-01, 1.4302034e-01 }, { 1.5824069e-01, 1.4353895e-01 }, + { 1.5777011e-01, 1.4405602e-01 }, { 1.5729785e-01, 1.4457155e-01 }, + { 1.5682390e-01, 1.4508553e-01 }, { 1.5634827e-01, 1.4559796e-01 }, + { 1.5587096e-01, 1.4610883e-01 }, { 1.5539199e-01, 1.4661813e-01 }, + { 1.5491135e-01, 1.4712586e-01 }, { 1.5442905e-01, 1.4763202e-01 }, + { 1.5394510e-01, 1.4813660e-01 }, { 1.5345950e-01, 1.4863959e-01 }, + { 1.5297226e-01, 1.4914099e-01 }, { 1.5248338e-01, 1.4964079e-01 }, + { 1.5199287e-01, 1.5013899e-01 }, { 1.5150072e-01, 1.5063558e-01 }, + { 1.5100696e-01, 1.5113055e-01 }, { 1.5051158e-01, 1.5162391e-01 }, + { 1.5001459e-01, 1.5211565e-01 }, { 1.4951599e-01, 1.5260575e-01 }, + { 1.4901579e-01, 1.5309423e-01 }, { 1.4851399e-01, 1.5358106e-01 }, + { 1.4801060e-01, 1.5406625e-01 }, { 1.4750563e-01, 1.5454978e-01 }, + { 1.4699908e-01, 1.5503167e-01 }, { 1.4649095e-01, 1.5551189e-01 }, + { 1.4598126e-01, 1.5599045e-01 }, { 1.4547000e-01, 1.5646733e-01 }, + { 1.4495718e-01, 1.5694254e-01 }, { 1.4444281e-01, 1.5741607e-01 }, + { 1.4392690e-01, 1.5788792e-01 }, { 1.4340944e-01, 1.5835807e-01 }, + { 1.4289045e-01, 1.5882653e-01 }, { 1.4236993e-01, 1.5929328e-01 }, + { 1.4184788e-01, 1.5975834e-01 }, { 1.4132431e-01, 1.6022168e-01 }, + { 1.4079923e-01, 1.6068330e-01 }, { 1.4027264e-01, 1.6114320e-01 }, + { 1.3974455e-01, 1.6160138e-01 }, { 1.3921497e-01, 1.6205783e-01 }, + { 1.3868389e-01, 1.6251254e-01 }, { 1.3815133e-01, 1.6296551e-01 }, + { 1.3761729e-01, 1.6341673e-01 }, { 1.3708177e-01, 1.6386621e-01 }, + { 1.3654479e-01, 1.6431393e-01 }, { 1.3600634e-01, 1.6475989e-01 }, + { 1.3546644e-01, 1.6520409e-01 }, { 1.3492508e-01, 1.6564652e-01 }, + { 1.3438228e-01, 1.6608717e-01 }, { 1.3383805e-01, 1.6652605e-01 }, + { 1.3329238e-01, 1.6696314e-01 }, { 1.3274528e-01, 1.6739844e-01 }, + { 1.3219676e-01, 1.6783195e-01 }, { 1.3164682e-01, 1.6826366e-01 }, + { 1.3109548e-01, 1.6869358e-01 }, { 1.3054273e-01, 1.6912168e-01 }, + { 1.2998858e-01, 1.6954797e-01 }, { 1.2943304e-01, 1.6997245e-01 }, + { 1.2887611e-01, 1.7039511e-01 }, { 1.2831781e-01, 1.7081594e-01 }, + { 1.2775813e-01, 1.7123495e-01 }, { 1.2719708e-01, 1.7165212e-01 }, + { 1.2663467e-01, 1.7206745e-01 }, { 1.2607090e-01, 1.7248094e-01 }, + { 1.2550579e-01, 1.7289258e-01 }, { 1.2493933e-01, 1.7330237e-01 }, + { 1.2437153e-01, 1.7371030e-01 }, { 1.2380240e-01, 1.7411638e-01 }, + { 1.2323194e-01, 1.7452059e-01 }, { 1.2266016e-01, 1.7492293e-01 }, + { 1.2208708e-01, 1.7532339e-01 }, { 1.2151268e-01, 1.7572198e-01 }, + { 1.2093698e-01, 1.7611869e-01 }, { 1.2035999e-01, 1.7651351e-01 }, + { 1.1978170e-01, 1.7690644e-01 }, { 1.1920214e-01, 1.7729748e-01 }, + { 1.1862130e-01, 1.7768662e-01 }, { 1.1803918e-01, 1.7807385e-01 }, + { 1.1745581e-01, 1.7845918e-01 }, { 1.1687117e-01, 1.7884260e-01 }, + { 1.1628529e-01, 1.7922410e-01 }, { 1.1569816e-01, 1.7960368e-01 }, + { 1.1510979e-01, 1.7998134e-01 }, { 1.1452018e-01, 1.8035707e-01 }, + { 1.1392935e-01, 1.8073087e-01 }, { 1.1333730e-01, 1.8110274e-01 }, + { 1.1274404e-01, 1.8147266e-01 }, { 1.1214957e-01, 1.8184065e-01 }, + { 1.1155390e-01, 1.8220668e-01 }, { 1.1095703e-01, 1.8257076e-01 }, + { 1.1035898e-01, 1.8293289e-01 }, { 1.0975974e-01, 1.8329306e-01 }, + { 1.0915933e-01, 1.8365126e-01 }, { 1.0855775e-01, 1.8400750e-01 }, + { 1.0795501e-01, 1.8436177e-01 }, { 1.0735111e-01, 1.8471407e-01 }, + { 1.0674606e-01, 1.8506438e-01 }, { 1.0613987e-01, 1.8541272e-01 }, + { 1.0553254e-01, 1.8575906e-01 }, { 1.0492408e-01, 1.8610342e-01 }, + { 1.0431449e-01, 1.8644579e-01 }, { 1.0370379e-01, 1.8678616e-01 }, + { 1.0309198e-01, 1.8712453e-01 }, { 1.0247907e-01, 1.8746089e-01 }, + { 1.0186506e-01, 1.8779525e-01 }, { 1.0124995e-01, 1.8812760e-01 }, + { 1.0063377e-01, 1.8845793e-01 }, { 1.0001650e-01, 1.8878624e-01 }, + { 9.9398167e-02, 1.8911253e-01 }, { 9.8778766e-02, 1.8943680e-01 }, + { 9.8158308e-02, 1.8975904e-01 }, { 9.7536799e-02, 1.9007924e-01 }, + { 9.6914245e-02, 1.9039742e-01 }, { 9.6290653e-02, 1.9071355e-01 }, + { 9.5666030e-02, 1.9102763e-01 }, { 9.5040382e-02, 1.9133968e-01 }, + { 9.4413717e-02, 1.9164967e-01 }, { 9.3786040e-02, 1.9195761e-01 }, + { 9.3157359e-02, 1.9226350e-01 }, { 9.2527681e-02, 1.9256733e-01 }, + { 9.1897011e-02, 1.9286909e-01 }, { 9.1265358e-02, 1.9316879e-01 }, + { 9.0632727e-02, 1.9346642e-01 }, { 8.9999125e-02, 1.9376198e-01 }, + { 8.9364560e-02, 1.9405546e-01 }, { 8.8729037e-02, 1.9434687e-01 }, + { 8.8092565e-02, 1.9463619e-01 }, { 8.7455149e-02, 1.9492343e-01 }, + { 8.6816796e-02, 1.9520858e-01 }, { 8.6177514e-02, 1.9549164e-01 }, + { 8.5537309e-02, 1.9577261e-01 }, { 8.4896187e-02, 1.9605148e-01 }, + { 8.4254157e-02, 1.9632825e-01 }, { 8.3611224e-02, 1.9660292e-01 }, + { 8.2967396e-02, 1.9687549e-01 }, { 8.2322680e-02, 1.9714594e-01 }, + { 8.1677081e-02, 1.9741429e-01 }, { 8.1030608e-02, 1.9768052e-01 }, + { 8.0383268e-02, 1.9794463e-01 }, { 7.9735066e-02, 1.9820662e-01 }, + { 7.9086011e-02, 1.9846649e-01 }, { 7.8436108e-02, 1.9872424e-01 }, + { 7.7785366e-02, 1.9897986e-01 }, { 7.7133791e-02, 1.9923334e-01 }, + { 7.6481389e-02, 1.9948470e-01 }, { 7.5828169e-02, 1.9973391e-01 }, + { 7.5174136e-02, 1.9998099e-01 }, { 7.4519298e-02, 2.0022592e-01 }, + { 7.3863663e-02, 2.0046872e-01 }, { 7.3207236e-02, 2.0070936e-01 }, + { 7.2550025e-02, 2.0094785e-01 }, { 7.1892038e-02, 2.0118420e-01 }, + { 7.1233280e-02, 2.0141839e-01 }, { 7.0573760e-02, 2.0165042e-01 }, + { 6.9913484e-02, 2.0188029e-01 }, { 6.9252459e-02, 2.0210800e-01 }, + { 6.8590692e-02, 2.0233354e-01 }, { 6.7928191e-02, 2.0255692e-01 }, + { 6.7264963e-02, 2.0277813e-01 }, { 6.6601014e-02, 2.0299717e-01 }, + { 6.5936352e-02, 2.0321403e-01 }, { 6.5270983e-02, 2.0342872e-01 }, + { 6.4604916e-02, 2.0364123e-01 }, { 6.3938157e-02, 2.0385156e-01 }, + { 6.3270713e-02, 2.0405971e-01 }, { 6.2602592e-02, 2.0426567e-01 }, + { 6.1933800e-02, 2.0446944e-01 }, { 6.1264345e-02, 2.0467102e-01 }, + { 6.0594234e-02, 2.0487041e-01 }, { 5.9923474e-02, 2.0506761e-01 }, + { 5.9252072e-02, 2.0526261e-01 }, { 5.8580035e-02, 2.0545541e-01 }, + { 5.7907372e-02, 2.0564601e-01 }, { 5.7234088e-02, 2.0583441e-01 }, + { 5.6560191e-02, 2.0602061e-01 }, { 5.5885688e-02, 2.0620460e-01 }, + { 5.5210587e-02, 2.0638638e-01 }, { 5.4534895e-02, 2.0656595e-01 }, + { 5.3858619e-02, 2.0674331e-01 }, { 5.3181766e-02, 2.0691845e-01 }, + { 5.2504343e-02, 2.0709138e-01 }, { 5.1826358e-02, 2.0726209e-01 }, + { 5.1147818e-02, 2.0743058e-01 }, { 5.0468731e-02, 2.0759685e-01 }, + { 4.9789103e-02, 2.0776090e-01 }, { 4.9108941e-02, 2.0792272e-01 }, + { 4.8428254e-02, 2.0808232e-01 }, { 4.7747048e-02, 2.0823968e-01 }, + { 4.7065331e-02, 2.0839482e-01 }, { 4.6383110e-02, 2.0854773e-01 }, + { 4.5700392e-02, 2.0869840e-01 }, { 4.5017184e-02, 2.0884683e-01 }, + { 4.4333495e-02, 2.0899303e-01 }, { 4.3649330e-02, 2.0913699e-01 }, + { 4.2964699e-02, 2.0927872e-01 }, { 4.2279607e-02, 2.0941820e-01 }, + { 4.1594062e-02, 2.0955544e-01 }, { 4.0908072e-02, 2.0969043e-01 }, + { 4.0221644e-02, 2.0982318e-01 }, { 3.9534785e-02, 2.0995368e-01 }, + { 3.8847503e-02, 2.1008193e-01 }, { 3.8159805e-02, 2.1020793e-01 }, + { 3.7471698e-02, 2.1033169e-01 }, { 3.6783189e-02, 2.1045319e-01 }, + { 3.6094287e-02, 2.1057243e-01 }, { 3.5404998e-02, 2.1068942e-01 }, + { 3.4715331e-02, 2.1080416e-01 }, { 3.4025291e-02, 2.1091663e-01 }, + { 3.3334887e-02, 2.1102685e-01 }, { 3.2644126e-02, 2.1113481e-01 }, + { 3.1953015e-02, 2.1124051e-01 }, { 3.1261563e-02, 2.1134394e-01 }, + { 3.0569775e-02, 2.1144511e-01 }, { 2.9877660e-02, 2.1154402e-01 }, + { 2.9185225e-02, 2.1164066e-01 }, { 2.8492478e-02, 2.1173504e-01 }, + { 2.7799425e-02, 2.1182714e-01 }, { 2.7106075e-02, 2.1191698e-01 }, + { 2.6412434e-02, 2.1200455e-01 }, { 2.5718511e-02, 2.1208985e-01 }, + { 2.5024312e-02, 2.1217288e-01 }, { 2.4329845e-02, 2.1225363e-01 }, + { 2.3635117e-02, 2.1233212e-01 }, { 2.2940137e-02, 2.1240833e-01 }, + { 2.2244911e-02, 2.1248226e-01 }, { 2.1549446e-02, 2.1255392e-01 }, + { 2.0853751e-02, 2.1262330e-01 }, { 2.0157832e-02, 2.1269040e-01 }, + { 1.9461698e-02, 2.1275523e-01 }, { 1.8765355e-02, 2.1281778e-01 }, + { 1.8068811e-02, 2.1287805e-01 }, { 1.7372074e-02, 2.1293604e-01 }, + { 1.6675151e-02, 2.1299175e-01 }, { 1.5978049e-02, 2.1304518e-01 }, + { 1.5280776e-02, 2.1309633e-01 }, { 1.4583339e-02, 2.1314519e-01 }, + { 1.3885746e-02, 2.1319177e-01 }, { 1.3188005e-02, 2.1323607e-01 }, + { 1.2490122e-02, 2.1327809e-01 }, { 1.1792105e-02, 2.1331782e-01 }, + { 1.1093963e-02, 2.1335527e-01 }, { 1.0395701e-02, 2.1339043e-01 }, + { 9.6973279e-03, 2.1342331e-01 }, { 8.9988511e-03, 2.1345390e-01 }, + { 8.3002779e-03, 2.1348220e-01 }, { 7.6016158e-03, 2.1350822e-01 }, + { 6.9028723e-03, 2.1353196e-01 }, { 6.2040549e-03, 2.1355340e-01 }, + { 5.5051711e-03, 2.1357256e-01 }, { 4.8062283e-03, 2.1358943e-01 }, + { 4.1072340e-03, 2.1360402e-01 }, { 3.4081957e-03, 2.1361632e-01 }, + { 2.7091210e-03, 2.1362633e-01 }, { 2.0100172e-03, 2.1363405e-01 }, + { 1.3108919e-03, 2.1363948e-01 }, { 6.1175255e-04, 2.1364263e-01 }, + } +}; + +#endif /* LC3_PLUS_HR */ + const struct lc3_mdct_rot_def * lc3_mdct_rot[LC3_NUM_DT][LC3_NUM_SRATE] = { -#if !LC3_NPLUS + [LC3_DT_2M5] = { + LC3_IF_PLUS(&mdct_rot_40, NULL), + LC3_IF_PLUS(&mdct_rot_80, NULL), &mdct_rot_120, + &mdct_rot_160, &mdct_rot_240, &mdct_rot_240, &mdct_rot_480 }, - [LC3_DT_2M5] = { &mdct_rot_40 , &mdct_rot_80 , &mdct_rot_120, - &mdct_rot_160, &mdct_rot_240 }, + [LC3_DT_5M ] = { + LC3_IF_PLUS(&mdct_rot_80, NULL), &mdct_rot_160, &mdct_rot_240, + &mdct_rot_320, &mdct_rot_480, &mdct_rot_480, &mdct_rot_960 }, - [LC3_DT_5M ] = { &mdct_rot_80 , &mdct_rot_160, &mdct_rot_240, - &mdct_rot_320, &mdct_rot_480 }, + [LC3_DT_7M5] = { + &mdct_rot_120, &mdct_rot_240, &mdct_rot_360, + &mdct_rot_480, &mdct_rot_720 }, -#endif /* !LC3_NPLUS */ + [LC3_DT_10M] = { + &mdct_rot_160, &mdct_rot_320, &mdct_rot_480, + &mdct_rot_640, &mdct_rot_960, &mdct_rot_960, + LC3_IF_PLUS_HR(&mdct_rot_1920, NULL) }, - [LC3_DT_7M5] = { &mdct_rot_120, &mdct_rot_240, &mdct_rot_360, - &mdct_rot_480, &mdct_rot_720 }, - - [LC3_DT_10M] = { &mdct_rot_160, &mdct_rot_320, &mdct_rot_480, - &mdct_rot_640, &mdct_rot_960 } }; @@ -1036,13 +1471,12 @@ const struct lc3_mdct_rot_def * lc3_mdct_rot[LC3_NUM_DT][LC3_NUM_SRATE] = { * Low delay MDCT windows */ -#define __LC3_MDCT_WIN_LEN(_dt, _sr) \ - ( LC3_NS(LC3_DT_ ## _dt, LC3_SRATE_ ## _sr) + \ - LC3_ND(LC3_DT_ ## _dt, LC3_SRATE_ ## _sr) ) +#define __LC3_MDCT_WIN_LEN(_dt_us, _sr_hz) \ + ( LC3_NS(_dt_us, _sr_hz) + LC3_ND(_dt_us, _sr_hz) ) -#if !LC3_NPLUS +#if LC3_PLUS -static const float mdct_win_2m5_8k[__LC3_MDCT_WIN_LEN(2M5, 8K)] = { +static const float mdct_win_2m5_8k[__LC3_MDCT_WIN_LEN(2500, 8000)] = { 6.73791440e-03, 2.73228958e-02, 6.16356097e-02, 1.11912504e-01, 1.78705350e-01, 2.60752499e-01, 3.54977638e-01, 4.56769675e-01, 5.60523927e-01, 6.60366535e-01, 7.50943422e-01, 8.28138232e-01, @@ -1055,7 +1489,7 @@ static const float mdct_win_2m5_8k[__LC3_MDCT_WIN_LEN(2M5, 8K)] = { 1.11912504e-01, 6.16356097e-02, 2.73228958e-02, 6.73791440e-03, }; -static const float mdct_win_2m5_16k[__LC3_MDCT_WIN_LEN(2M5, 16K)] = { +static const float mdct_win_2m5_16k[__LC3_MDCT_WIN_LEN(2500, 16000)] = { 4.76441615e-03, 1.20463628e-02, 2.22639654e-02, 3.58022311e-02, 5.29905465e-02, 7.40851840e-02, 9.92538592e-02, 1.28563118e-01, 1.61969244e-01, 1.99313241e-01, 2.40320282e-01, 2.84603818e-01, @@ -1078,7 +1512,7 @@ static const float mdct_win_2m5_16k[__LC3_MDCT_WIN_LEN(2M5, 16K)] = { 3.58022311e-02, 2.22639654e-02, 1.20463628e-02, 4.76441615e-03, }; -static const float mdct_win_2m5_24k[__LC3_MDCT_WIN_LEN(2M5, 24K)] = { +static const float mdct_win_2m5_24k[__LC3_MDCT_WIN_LEN(2500, 24000)] = { 3.89013421e-03, 8.20259508e-03, 1.37023556e-02, 2.05296853e-02, 2.88030773e-02, 3.86278514e-02, 5.00956972e-02, 6.32829654e-02, 7.82488109e-02, 9.50334651e-02, 1.13656749e-01, 1.34116888e-01, @@ -1111,7 +1545,7 @@ static const float mdct_win_2m5_24k[__LC3_MDCT_WIN_LEN(2M5, 24K)] = { 2.05296853e-02, 1.37023556e-02, 8.20259508e-03, 3.89013421e-03, }; -static const float mdct_win_2m5_32k[__LC3_MDCT_WIN_LEN(2M5, 32K)] = { +static const float mdct_win_2m5_32k[__LC3_MDCT_WIN_LEN(2500, 32000)] = { 3.36895835e-03, 6.45555741e-03, 1.01430808e-02, 1.45212685e-02, 1.96507673e-02, 2.55835280e-02, 3.23662853e-02, 4.00411787e-02, 4.86456418e-02, 5.82120708e-02, 6.87674290e-02, 8.03328498e-02, @@ -1154,7 +1588,7 @@ static const float mdct_win_2m5_32k[__LC3_MDCT_WIN_LEN(2M5, 32K)] = { 1.45212685e-02, 1.01430808e-02, 6.45555741e-03, 3.36895835e-03, }; -static const float mdct_win_2m5_48k[__LC3_MDCT_WIN_LEN(2M5, 48K)] = { +static const float mdct_win_2m5_48k[__LC3_MDCT_WIN_LEN(2500, 48000)] = { 2.75074638e-03, 4.77524515e-03, 6.99126548e-03, 9.47011816e-03, 1.22441576e-02, 1.53355947e-02, 1.87626677e-02, 2.25415434e-02, 2.66870142e-02, 3.12127707e-02, 3.61315008e-02, 4.14549100e-02, @@ -1217,7 +1651,197 @@ static const float mdct_win_2m5_48k[__LC3_MDCT_WIN_LEN(2M5, 48K)] = { 9.47011816e-03, 6.99126548e-03, 4.77524515e-03, 2.75074638e-03, }; -static const float mdct_win_5m_8k[__LC3_MDCT_WIN_LEN(5M, 8K)] = { +#if LC3_PLUS_HR + +static const float mdct_win_2m5_48k_hr[__LC3_MDCT_WIN_LEN(2500, 48000)] = { + 1.92887526e-07, 1.26862312e-06, 3.73694297e-06, 8.64938647e-06, + 1.75249988e-05, 3.25100409e-05, 5.65499504e-05, 9.35865319e-05, + 1.48780979e-04, 2.28761899e-04, 3.41896375e-04, 4.98580979e-04, + 7.11548259e-04, 9.96182440e-04, 1.37083745e-03, 1.85714674e-03, + 2.48031598e-03, 3.26938415e-03, 4.25744150e-03, 5.48178842e-03, + 6.98402245e-03, 8.81003775e-03, 1.10099232e-02, 1.36377569e-02, + 1.67512707e-02, 2.04114113e-02, 2.46817525e-02, 2.96278261e-02, + 3.53163108e-02, 4.18141559e-02, 4.91876006e-02, 5.75011559e-02, + 6.68165460e-02, 7.71916136e-02, 8.86792317e-02, 1.01326235e-01, + 1.15172401e-01, 1.30249396e-01, 1.46579877e-01, 1.64176553e-01, + 1.83041364e-01, 2.03164726e-01, 2.24524856e-01, 2.47087196e-01, + 2.70803988e-01, 2.95613915e-01, 3.21442008e-01, 3.48199695e-01, + 3.75785023e-01, 4.04083431e-01, 4.32968378e-01, 4.62302625e-01, + 4.91939783e-01, 5.21726012e-01, 5.51502347e-01, 5.81106782e-01, + 6.10377192e-01, 6.39154077e-01, 6.67283058e-01, 6.94617987e-01, + 7.21023440e-01, 7.46377110e-01, 7.70571768e-01, 7.93517113e-01, + 8.15140784e-01, 8.35389018e-01, 8.54227006e-01, 8.71638596e-01, + 8.87625158e-01, 9.02204990e-01, 9.15411413e-01, 9.27291155e-01, + 9.37902570e-01, 9.47313428e-01, 9.55598950e-01, 9.62839723e-01, + 9.69119847e-01, 9.74524975e-01, 9.79140759e-01, 9.83051181e-01, + 9.86337543e-01, 9.89076972e-01, 9.91342008e-01, 9.93199587e-01, + 9.94710743e-01, 9.95930433e-01, 9.96907234e-01, 9.97683644e-01, + 9.98296261e-01, 9.98776138e-01, 9.99149203e-01, 9.99436796e-01, + 9.99656200e-01, 9.99821365e-01, 9.99943137e-01, 1.00003016e+00, + 1.00008917e+00, 1.00012529e+00, 1.00014281e+00, 1.00014508e+00, + 1.00013494e+00, 1.00011492e+00, 1.00008726e+00, 1.00005412e+00, + 1.00001764e+00, 9.99979734e-01, 9.99942362e-01, 9.99907196e-01, + 9.99876022e-01, 9.99850094e-01, 9.99830663e-01, 9.99818563e-01, + 9.99814391e-01, 9.99818325e-01, 9.99830186e-01, 9.99849498e-01, + 9.99875486e-01, 9.99906898e-01, 9.99942422e-01, 9.99980509e-01, + 1.00001943e+00, 1.00005758e+00, 1.00009310e+00, 1.00012457e+00, + 1.00015044e+00, 1.00016987e+00, 1.00018167e+00, 1.00018561e+00, + 1.00018144e+00, 1.00016928e+00, 1.00014985e+00, 1.00012374e+00, + 1.00009227e+00, 1.00005662e+00, 1.00001836e+00, 9.99978960e-01, + 9.99939740e-01, 9.99902129e-01, 9.99867082e-01, 9.99835134e-01, + 9.99806285e-01, 9.99779761e-01, 9.99753773e-01, 9.99725282e-01, + 9.99689877e-01, 9.99641180e-01, 9.99570787e-01, 9.99467850e-01, + 9.99318600e-01, 9.99105930e-01, 9.98809040e-01, 9.98403072e-01, + 9.97858584e-01, 9.97141182e-01, 9.96211350e-01, 9.95023966e-01, + 9.93528485e-01, 9.91668522e-01, 9.89382327e-01, 9.86602664e-01, + 9.83257711e-01, 9.79271173e-01, 9.74563420e-01, 9.69052374e-01, + 9.62654769e-01, 9.55287457e-01, 9.46869195e-01, 9.37322080e-01, + 9.26573634e-01, 9.14558887e-01, 9.01221931e-01, 8.86518419e-01, + 8.70416999e-01, 8.52901220e-01, 8.33971083e-01, 8.13643873e-01, + 7.91955233e-01, 7.68959403e-01, 7.44728804e-01, 7.19353676e-01, + 6.92940772e-01, 6.65611804e-01, 6.37501359e-01, 6.08754635e-01, + 5.79524696e-01, 5.49970031e-01, 5.20251453e-01, 4.90529478e-01, + 4.60961968e-01, 4.31701392e-01, 4.02893007e-01, 3.74672860e-01, + 3.47166419e-01, 3.20487350e-01, 2.94736743e-01, 2.70002425e-01, + 2.46358722e-01, 2.23866433e-01, 2.02572897e-01, 1.82512373e-01, + 1.63706377e-01, 1.46164373e-01, 1.29884347e-01, 1.14853561e-01, + 1.01049446e-01, 8.84404257e-02, 7.69868940e-02, 6.66421950e-02, + 5.73536530e-02, 4.90636751e-02, 4.17107828e-02, 3.52307148e-02, + 2.95574907e-02, 2.46244166e-02, 2.03650557e-02, 1.67141166e-02, + 1.36082442e-02, 1.09867034e-02, 8.79194960e-03, 6.97008055e-03, + 5.47116203e-03, 4.24943818e-03, 3.26343346e-03, 2.47595203e-03, + 1.85399409e-03, 1.36859657e-03, 9.94618051e-04, 7.10477470e-04, + 4.97864152e-04, 3.41428356e-04, 2.28464938e-04, 1.48598730e-04, + 9.34789787e-05, 5.64894217e-05, 3.24779357e-05, 1.75092246e-05, + 8.64240701e-06, 3.73430225e-06, 1.26786131e-06, 1.92776696e-07, +}; + +static const float mdct_win_2m5_96k_hr[__LC3_MDCT_WIN_LEN(2500, 96000)] = { + 1.36335345e-07, 4.57767612e-07, 9.97567554e-07, 1.84077624e-06, + 3.09224833e-06, 4.88094383e-06, 7.36381799e-06, 1.07300075e-05, + 1.52053863e-05, 2.10575054e-05, 2.86009363e-05, 3.82030121e-05, + 5.02899893e-05, 6.53535899e-05, 8.39579952e-05, 1.06747175e-04, + 1.34452668e-04, 1.67901671e-04, 2.08025551e-04, 2.55868625e-04, + 3.12597229e-04, 3.79509147e-04, 4.58043127e-04, 5.49788703e-04, + 6.56496093e-04, 7.80086033e-04, 9.22659819e-04, 1.08650920e-03, + 1.27412600e-03, 1.48821168e-03, 1.73168664e-03, 2.00769864e-03, + 2.31963093e-03, 2.67111068e-03, 3.06601473e-03, 3.50847607e-03, + 4.00288915e-03, 4.55391267e-03, 5.16647473e-03, 5.84577024e-03, + 6.59726607e-03, 7.42669497e-03, 8.34005512e-03, 9.34360363e-03, + 1.04438523e-02, 1.16475578e-02, 1.29617099e-02, 1.43935224e-02, + 1.59504171e-02, 1.76400058e-02, 1.94700807e-02, 2.14485861e-02, + 2.35835947e-02, 2.58832965e-02, 2.83559617e-02, 3.10099237e-02, + 3.38535421e-02, 3.68951820e-02, 4.01431806e-02, 4.36058082e-02, + 4.72912528e-02, 5.12075722e-02, 5.53626679e-02, 5.97642474e-02, + 6.44197986e-02, 6.93365484e-02, 7.45214298e-02, 7.99810365e-02, + 8.57216269e-02, 9.17490497e-02, 9.80687290e-02, 1.04685634e-01, + 1.11604236e-01, 1.18828513e-01, 1.26361862e-01, 1.34207115e-01, + 1.42366499e-01, 1.50841609e-01, 1.59633383e-01, 1.68742076e-01, + 1.78167209e-01, 1.87907621e-01, 1.97961360e-01, 2.08325714e-01, + 2.18997195e-01, 2.29971498e-01, 2.41243511e-01, 2.52807260e-01, + 2.64655977e-01, 2.76782036e-01, 2.89176911e-01, 3.01831275e-01, + 3.14734906e-01, 3.27876776e-01, 3.41245025e-01, 3.54826927e-01, + 3.68608981e-01, 3.82576853e-01, 3.96715522e-01, 4.11009163e-01, + 4.25441355e-01, 4.39994961e-01, 4.54652220e-01, 4.69394863e-01, + 4.84204173e-01, 4.99060899e-01, 5.13945460e-01, 5.28838038e-01, + 5.43718576e-01, 5.58566749e-01, 5.73362410e-01, 5.88085234e-01, + 6.02715075e-01, 6.17232025e-01, 6.31616414e-01, 6.45848989e-01, + 6.59910858e-01, 6.73783839e-01, 6.87450290e-01, 7.00893283e-01, + 7.14096606e-01, 7.27045000e-01, 7.39724100e-01, 7.52120554e-01, + 7.64221907e-01, 7.76016891e-01, 7.87495315e-01, 7.98648119e-01, + 8.09467375e-01, 8.19946468e-01, 8.30079675e-01, 8.39862764e-01, + 8.49292517e-01, 8.58366787e-01, 8.67084682e-01, 8.75446379e-01, + 8.83453131e-01, 8.91107082e-01, 8.98411512e-01, 9.05370474e-01, + 9.11989033e-01, 9.18272913e-01, 9.24228728e-01, 9.29863691e-01, + 9.35185611e-01, 9.40202892e-01, 9.44924474e-01, 9.49359715e-01, + 9.53518271e-01, 9.57410157e-01, 9.61045623e-01, 9.64435160e-01, + 9.67589259e-01, 9.70518589e-01, 9.73233819e-01, 9.75745618e-01, + 9.78064537e-01, 9.80201006e-01, 9.82165277e-01, 9.83967602e-01, + 9.85617757e-01, 9.87125397e-01, 9.88499880e-01, 9.89750206e-01, + 9.90885139e-01, 9.91913080e-01, 9.92841959e-01, 9.93679583e-01, + 9.94433045e-01, 9.95109439e-01, 9.95715141e-01, 9.96256351e-01, + 9.96738791e-01, 9.97167945e-01, 9.97548699e-01, 9.97885823e-01, + 9.98183608e-01, 9.98446047e-01, 9.98676717e-01, 9.98879075e-01, + 9.99056041e-01, 9.99210536e-01, 9.99344945e-01, 9.99461591e-01, + 9.99562562e-01, 9.99649644e-01, 9.99724448e-01, 9.99788404e-01, + 9.99842882e-01, 9.99888957e-01, 9.99927700e-01, 9.99959946e-01, + 9.99986470e-01, 1.00000799e+00, 1.00002515e+00, 1.00003839e+00, + 1.00004816e+00, 1.00005496e+00, 1.00005913e+00, 1.00006092e+00, + 1.00006080e+00, 1.00005877e+00, 1.00005519e+00, 1.00005031e+00, + 1.00004435e+00, 1.00003731e+00, 1.00002968e+00, 1.00002134e+00, + 1.00001252e+00, 1.00000334e+00, 9.99994040e-01, 9.99984682e-01, + 9.99975443e-01, 9.99966383e-01, 9.99957621e-01, 9.99949336e-01, + 9.99941528e-01, 9.99934316e-01, 9.99927878e-01, 9.99922156e-01, + 9.99917269e-01, 9.99913335e-01, 9.99910295e-01, 9.99908268e-01, + 9.99907196e-01, 9.99907196e-01, 9.99908149e-01, 9.99910176e-01, + 9.99913156e-01, 9.99917090e-01, 9.99921918e-01, 9.99927640e-01, + 9.99934137e-01, 9.99941349e-01, 9.99949217e-01, 9.99957681e-01, + 9.99966562e-01, 9.99975860e-01, 9.99985397e-01, 9.99995112e-01, + 1.00000489e+00, 1.00001454e+00, 1.00002408e+00, 1.00003338e+00, + 1.00004232e+00, 1.00005078e+00, 1.00005865e+00, 1.00006592e+00, + 1.00007236e+00, 1.00007808e+00, 1.00008297e+00, 1.00008690e+00, + 1.00008988e+00, 1.00009179e+00, 1.00009286e+00, 1.00009274e+00, + 1.00009179e+00, 1.00008965e+00, 1.00008667e+00, 1.00008261e+00, + 1.00007772e+00, 1.00007200e+00, 1.00006545e+00, 1.00005817e+00, + 1.00005031e+00, 1.00004172e+00, 1.00003278e+00, 1.00002337e+00, + 1.00001371e+00, 1.00000370e+00, 9.99993682e-01, 9.99983490e-01, + 9.99973357e-01, 9.99963224e-01, 9.99953210e-01, 9.99943376e-01, + 9.99933660e-01, 9.99924064e-01, 9.99914587e-01, 9.99905109e-01, + 9.99895573e-01, 9.99885738e-01, 9.99875546e-01, 9.99864578e-01, + 9.99852657e-01, 9.99839306e-01, 9.99824166e-01, 9.99806523e-01, + 9.99785900e-01, 9.99761462e-01, 9.99732316e-01, 9.99697566e-01, + 9.99655962e-01, 9.99606311e-01, 9.99547124e-01, 9.99476731e-01, + 9.99393344e-01, 9.99294996e-01, 9.99179363e-01, 9.99043941e-01, + 9.98886049e-01, 9.98702645e-01, 9.98490512e-01, 9.98246014e-01, + 9.97965276e-01, 9.97644246e-01, 9.97278214e-01, 9.96862471e-01, + 9.96391773e-01, 9.95860577e-01, 9.95262980e-01, 9.94592726e-01, + 9.93843138e-01, 9.93007302e-01, 9.92077827e-01, 9.91046965e-01, + 9.89906728e-01, 9.88648713e-01, 9.87264156e-01, 9.85744119e-01, + 9.84079301e-01, 9.82260108e-01, 9.80276704e-01, 9.78119195e-01, + 9.75777209e-01, 9.73240614e-01, 9.70498860e-01, 9.67541456e-01, + 9.64357972e-01, 9.60937798e-01, 9.57270682e-01, 9.53346252e-01, + 9.49154437e-01, 9.44685459e-01, 9.39929724e-01, 9.34878111e-01, + 9.29521918e-01, 9.23852861e-01, 9.17863250e-01, 9.11546052e-01, + 9.04894829e-01, 8.97903919e-01, 8.90568554e-01, 8.82884681e-01, + 8.74849200e-01, 8.66460025e-01, 8.57716084e-01, 8.48617196e-01, + 8.39164436e-01, 8.29359889e-01, 8.19206893e-01, 8.08709860e-01, + 7.97874272e-01, 7.86707044e-01, 7.75215983e-01, 7.63410211e-01, + 7.51299858e-01, 7.38896310e-01, 7.26211846e-01, 7.13259816e-01, + 7.00054646e-01, 6.86611593e-01, 6.72946632e-01, 6.59076810e-01, + 6.45019531e-01, 6.30793154e-01, 6.16416335e-01, 6.01908267e-01, + 5.87288618e-01, 5.72577178e-01, 5.57793975e-01, 5.42959273e-01, + 5.28093219e-01, 5.13215959e-01, 4.98347521e-01, 4.83507633e-01, + 4.68715757e-01, 4.53991085e-01, 4.39352304e-01, 4.24817562e-01, + 4.10404533e-01, 3.96130294e-01, 3.82011205e-01, 3.68063033e-01, + 3.54300767e-01, 3.40738595e-01, 3.27390045e-01, 3.14267725e-01, + 3.01383466e-01, 2.88748264e-01, 2.76372313e-01, 2.64264882e-01, + 2.52434462e-01, 2.40888610e-01, 2.29634136e-01, 2.18676925e-01, + 2.08022103e-01, 1.97673932e-01, 1.87635899e-01, 1.77910715e-01, + 1.68500274e-01, 1.59405768e-01, 1.50627658e-01, 1.42165691e-01, + 1.34018898e-01, 1.26185730e-01, 1.18663922e-01, 1.11450672e-01, + 1.04542568e-01, 9.79356542e-02, 9.16254595e-02, 8.56070295e-02, + 7.98749477e-02, 7.44233727e-02, 6.92460760e-02, 6.43364564e-02, + 5.96875995e-02, 5.52923009e-02, 5.11430874e-02, 4.72322591e-02, + 4.35519405e-02, 4.00940813e-02, 3.68505120e-02, 3.38129811e-02, + 3.09731625e-02, 2.83227116e-02, 2.58532818e-02, 2.35565584e-02, + 2.14242823e-02, 1.94482822e-02, 1.76204946e-02, 1.59329921e-02, + 1.43779973e-02, 1.29479105e-02, 1.16353221e-02, 1.04330294e-02, + 9.33405478e-03, 8.33165180e-03, 7.41932075e-03, 6.59081247e-03, + 5.84013900e-03, 5.16157458e-03, 4.54966258e-03, 3.99921415e-03, + 3.50530911e-03, 3.06329457e-03, 2.66878284e-03, 2.31764605e-03, + 2.00601248e-03, 1.73026032e-03, 1.48701016e-03, 1.27311819e-03, + 1.08566787e-03, 9.21960978e-04, 7.79508497e-04, 6.56021410e-04, + 5.49400807e-04, 4.57728049e-04, 3.79254925e-04, 3.12393560e-04, + 2.55706662e-04, 2.07897814e-04, 1.67801816e-04, 1.34375354e-04, + 1.06687941e-04, 8.39131390e-05, 6.53200550e-05, 5.02652765e-05, + 3.81850987e-05, 2.85881870e-05, 2.10486251e-05, 1.51993554e-05, + 1.07260339e-05, 7.36129550e-06, 4.87941543e-06, 3.09137795e-06, + 1.84032115e-06, 9.97358256e-07, 4.57689993e-07, 1.36315705e-07, +}; + +#endif /* LC3_PLUS_HR */ + +static const float mdct_win_5m_8k[__LC3_MDCT_WIN_LEN(5000, 8000)] = { 9.95908659e-04, 3.81905679e-03, 9.54083261e-03, 1.92165980e-02, 3.38271908e-02, 5.42483167e-02, 8.12077767e-02, 1.15217189e-01, 1.56494233e-01, 2.04936342e-01, 2.60116658e-01, 3.21281416e-01, @@ -1238,7 +1862,7 @@ static const float mdct_win_5m_8k[__LC3_MDCT_WIN_LEN(5M, 8K)] = { 2.87183192e-02, 9.68388493e-03, }; -static const float mdct_win_5m_16k[__LC3_MDCT_WIN_LEN(5M, 16K)] = { +static const float mdct_win_5m_16k[__LC3_MDCT_WIN_LEN(5000, 16000)] = { 6.14338818e-04, 1.48958283e-03, 2.88410496e-03, 4.93429883e-03, 7.77913046e-03, 1.15491061e-02, 1.63715562e-02, 2.23711616e-02, 2.96615969e-02, 3.83566333e-02, 4.85561099e-02, 6.03505574e-02, @@ -1276,7 +1900,7 @@ static const float mdct_win_5m_16k[__LC3_MDCT_WIN_LEN(5M, 16K)] = { 3.53343019e-02, 2.28668041e-02, 1.33800502e-02, 6.64050653e-03, }; -static const float mdct_win_5m_24k[__LC3_MDCT_WIN_LEN(5M, 24K)] = { +static const float mdct_win_5m_24k[__LC3_MDCT_WIN_LEN(5000, 24000)] = { 5.08722763e-04, 9.95908659e-04, 1.68220801e-03, 2.60969726e-03, 3.81905679e-03, 5.34931959e-03, 7.24390638e-03, 9.54083261e-03, 1.22763764e-02, 1.54895024e-02, 1.92165980e-02, 2.34936962e-02, @@ -1332,7 +1956,7 @@ static const float mdct_win_5m_24k[__LC3_MDCT_WIN_LEN(5M, 24K)] = { 9.68388493e-03, 5.64216879e-03, }; -static const float mdct_win_5m_32k[__LC3_MDCT_WIN_LEN(5M, 32K)] = { +static const float mdct_win_5m_32k[__LC3_MDCT_WIN_LEN(5000, 32000)] = { 4.59588635e-04, 7.91932361e-04, 1.22792717e-03, 1.78365327e-03, 2.47954941e-03, 3.32979945e-03, 4.35353548e-03, 5.56496516e-03, 6.98610836e-03, 8.62988232e-03, 1.05134341e-02, 1.26508264e-02, @@ -1405,7 +2029,7 @@ static const float mdct_win_5m_32k[__LC3_MDCT_WIN_LEN(5M, 32K)] = { 1.54831778e-02, 1.14492491e-02, 8.07648266e-03, 5.30004408e-03, }; -static const float mdct_win_5m_48k[__LC3_MDCT_WIN_LEN(5M, 48K)] = { +static const float mdct_win_5m_48k[__LC3_MDCT_WIN_LEN(5000, 48000)] = { 4.09010650e-04, 6.14338818e-04, 8.57175988e-04, 1.14701506e-03, 1.48958283e-03, 1.88977038e-03, 2.35300080e-03, 2.88410496e-03, 3.48821379e-03, 4.17004043e-03, 4.93429883e-03, 5.78707651e-03, @@ -1513,9 +2137,333 @@ static const float mdct_win_5m_48k[__LC3_MDCT_WIN_LEN(5M, 48K)] = { 1.08421860e-02, 8.59675398e-03, 6.64050653e-03, 5.17270311e-03, }; -#endif /* !LC3_NPLUS */ +#if LC3_PLUS_HR -static const float mdct_win_7m5_8k[__LC3_MDCT_WIN_LEN(7M5, 8K)] = { +static const float mdct_win_5m_48k_hr[__LC3_MDCT_WIN_LEN(5000, 48000)] = { + 9.75247545e-08, 6.41356849e-07, 1.88872264e-06, 4.37003746e-06, + 8.85053487e-06, 1.64097619e-05, 2.85265469e-05, 4.71757776e-05, + 7.49369574e-05, 1.15113864e-04, 1.71864056e-04, 2.50336452e-04, + 3.56814737e-04, 4.98863636e-04, 6.85475010e-04, 9.27209505e-04, + 1.23633002e-03, 1.62692170e-03, 2.11499492e-03, 2.71856366e-03, + 3.45769688e-03, 4.35453700e-03, 5.43327769e-03, 6.72010100e-03, + 8.24306626e-03, 1.00319488e-02, 1.21180220e-02, 1.45337880e-02, + 1.73126478e-02, 2.04885192e-02, 2.40953956e-02, 2.81668510e-02, + 3.27355117e-02, 3.78324650e-02, 4.34866548e-02, 4.97242436e-02, + 5.65679595e-02, 6.40364513e-02, 7.21436515e-02, 8.08981732e-02, + 9.03027356e-02, 1.00353681e-01, 1.11040540e-01, 1.22345708e-01, + 1.34244218e-01, 1.46703660e-01, 1.59684196e-01, 1.73138753e-01, + 1.87013358e-01, 2.01247633e-01, 2.15775400e-01, 2.30525494e-01, + 2.45422661e-01, 2.60388613e-01, 2.75343060e-01, 2.90205121e-01, + 3.04894298e-01, 3.19332004e-01, 3.33442599e-01, 3.47154707e-01, + 3.60402405e-01, 3.73126328e-01, 3.85274231e-01, 3.96802038e-01, + 4.07674283e-01, 4.17864561e-01, 4.27355647e-01, 4.36139554e-01, + 4.44217294e-01, 4.51598674e-01, 4.58301634e-01, 4.64351624e-01, + 4.69781011e-01, 4.74628091e-01, 4.78936344e-01, 4.82753456e-01, + 4.86130476e-01, 4.89120960e-01, 4.91780102e-01, 4.94164050e-01, + 4.96329218e-01, 4.98331696e-01, 5.00226736e-01, 5.02068341e-01, + 5.03908992e-01, 5.05799294e-01, 5.07787943e-01, 5.09921193e-01, + 5.12243330e-01, 5.14795899e-01, 5.17618179e-01, 5.20746589e-01, + 5.24214983e-01, 5.28054178e-01, 5.32292068e-01, 5.36953092e-01, + 5.42058468e-01, 5.47625661e-01, 5.53668439e-01, 5.60196400e-01, + 5.67215025e-01, 5.74725628e-01, 5.82724869e-01, 5.91205239e-01, + 6.00154579e-01, 6.09556615e-01, 6.19390607e-01, 6.29631937e-01, + 6.40252173e-01, 6.51219368e-01, 6.62498534e-01, 6.74051821e-01, + 6.85839176e-01, 6.97818637e-01, 7.09946930e-01, 7.22179890e-01, + 7.34472811e-01, 7.46781170e-01, 7.59061038e-01, 7.71269321e-01, + 7.83364296e-01, 7.95306087e-01, 8.07056785e-01, 8.18580806e-01, + 8.29845190e-01, 8.40819776e-01, 8.51477146e-01, 8.61792982e-01, + 8.71745944e-01, 8.81317794e-01, 8.90493214e-01, 8.99259806e-01, + 9.07608211e-01, 9.15531754e-01, 9.23026323e-01, 9.30090547e-01, + 9.36725318e-01, 9.42933977e-01, 9.48721945e-01, 9.54096615e-01, + 9.59067523e-01, 9.63645637e-01, 9.67843831e-01, 9.71676290e-01, + 9.75158513e-01, 9.78307128e-01, 9.81139660e-01, 9.83674467e-01, + 9.85930443e-01, 9.87926722e-01, 9.89682734e-01, 9.91217852e-01, + 9.92551088e-01, 9.93701279e-01, 9.94686544e-01, 9.95524466e-01, + 9.96231675e-01, 9.96824026e-01, 9.97316301e-01, 9.97722328e-01, + 9.98054802e-01, 9.98325348e-01, 9.98544455e-01, 9.98721540e-01, + 9.98864949e-01, 9.98981953e-01, 9.99078929e-01, 9.99161184e-01, + 9.99233246e-01, 9.99298692e-01, 9.99360621e-01, 9.99421120e-01, + 9.99481916e-01, 9.99544203e-01, 9.99608576e-01, 9.99675393e-01, + 9.99744534e-01, 9.99815881e-01, 9.99888837e-01, 9.99962866e-01, + 1.00003707e+00, 1.00011098e+00, 1.00018346e+00, 1.00025380e+00, + 1.00032115e+00, 1.00038469e+00, 1.00044382e+00, 1.00049770e+00, + 1.00054598e+00, 1.00058782e+00, 1.00062299e+00, 1.00065112e+00, + 1.00067186e+00, 1.00068521e+00, 1.00069082e+00, 1.00068903e+00, + 1.00067961e+00, 1.00066280e+00, 1.00063896e+00, 1.00060833e+00, + 1.00057113e+00, 1.00052810e+00, 1.00047958e+00, 1.00042605e+00, + 1.00036812e+00, 1.00030637e+00, 1.00024164e+00, 1.00017428e+00, + 1.00010526e+00, 1.00003517e+00, 9.99964774e-01, 9.99894679e-01, + 9.99825716e-01, 9.99758482e-01, 9.99693692e-01, 9.99632061e-01, + 9.99574184e-01, 9.99520719e-01, 9.99472201e-01, 9.99429166e-01, + 9.99392092e-01, 9.99361455e-01, 9.99337614e-01, 9.99320924e-01, + 9.99311507e-01, 9.99309599e-01, 9.99315262e-01, 9.99328554e-01, + 9.99349296e-01, 9.99377370e-01, 9.99412537e-01, 9.99454379e-01, + 9.99502480e-01, 9.99556363e-01, 9.99615431e-01, 9.99678969e-01, + 9.99746263e-01, 9.99816597e-01, 9.99889076e-01, 9.99962866e-01, + 1.00003707e+00, 1.00011098e+00, 1.00018346e+00, 1.00025380e+00, + 1.00032115e+00, 1.00038469e+00, 1.00044382e+00, 1.00049770e+00, + 1.00054598e+00, 1.00058782e+00, 1.00062299e+00, 1.00065112e+00, + 1.00067186e+00, 1.00068521e+00, 1.00069082e+00, 1.00068903e+00, + 1.00067961e+00, 1.00066280e+00, 1.00063896e+00, 1.00060833e+00, + 1.00057113e+00, 1.00052810e+00, 1.00047958e+00, 1.00042605e+00, + 1.00036812e+00, 1.00030637e+00, 1.00024164e+00, 1.00017428e+00, + 1.00010526e+00, 1.00003517e+00, 9.99964774e-01, 9.99894679e-01, + 9.99825716e-01, 9.99758482e-01, 9.99693692e-01, 9.99632061e-01, + 9.99574184e-01, 9.99520719e-01, 9.99472201e-01, 9.99429166e-01, + 9.99392092e-01, 9.99361455e-01, 9.99337614e-01, 9.99320924e-01, + 9.99311507e-01, 9.99309599e-01, 9.99315262e-01, 9.99328554e-01, + 9.99349296e-01, 9.99377370e-01, 9.99412537e-01, 9.99454379e-01, + 9.99502480e-01, 9.99556363e-01, 9.99615431e-01, 9.99678969e-01, + 9.99746263e-01, 9.99816597e-01, 9.99889076e-01, 9.99962866e-01, + 1.00003707e+00, 1.00011075e+00, 1.00018275e+00, 1.00025201e+00, + 1.00031757e+00, 1.00037789e+00, 1.00043166e+00, 1.00047719e+00, + 1.00051260e+00, 1.00053585e+00, 1.00054419e+00, 1.00053477e+00, + 1.00050414e+00, 1.00044823e+00, 1.00036228e+00, 1.00024092e+00, + 1.00007784e+00, 9.99865890e-01, 9.99597013e-01, 9.99261975e-01, + 9.98850465e-01, 9.98351038e-01, 9.97750819e-01, 9.97035682e-01, + 9.96189833e-01, 9.95196044e-01, 9.94035423e-01, 9.92687285e-01, + 9.91129041e-01, 9.89336133e-01, 9.87281919e-01, 9.84937787e-01, + 9.82272744e-01, 9.79253709e-01, 9.75845337e-01, 9.72010076e-01, + 9.67708528e-01, 9.62899387e-01, 9.57539737e-01, 9.51585472e-01, + 9.44991708e-01, 9.37713265e-01, 9.29705381e-01, 9.20924187e-01, + 9.11327481e-01, 9.00875807e-01, 8.89532745e-01, 8.77266228e-01, + 8.64049077e-01, 8.49859893e-01, 8.34683776e-01, 8.18513036e-01, + 8.01347792e-01, 7.83196509e-01, 7.64076352e-01, 7.44013488e-01, + 7.23043203e-01, 7.01209962e-01, 6.78567350e-01, 6.55177712e-01, + 6.31111801e-01, 6.06448233e-01, 5.81272960e-01, 5.55678487e-01, + 5.29762745e-01, 5.03628492e-01, 4.77382004e-01, 4.51132149e-01, + 4.24988985e-01, 3.99062574e-01, 3.73461813e-01, 3.48293066e-01, + 3.23658854e-01, 2.99656719e-01, 2.76377857e-01, 2.53906131e-01, + 2.32316986e-01, 2.11676583e-01, 1.92040950e-01, 1.73455566e-01, + 1.55954808e-01, 1.39561892e-01, 1.24288827e-01, 1.10136725e-01, + 9.70961973e-02, 8.51479918e-02, 7.42638558e-02, 6.44074306e-02, + 5.55353425e-02, 4.75983508e-02, 4.05424982e-02, 3.43103148e-02, + 2.88419761e-02, 2.40764078e-02, 1.99523065e-02, 1.64090749e-02, + 1.33876354e-02, 1.08311241e-02, 8.68547149e-03, 6.89984858e-03, + 5.42699778e-03, 4.22345474e-03, 3.24966502e-03, 2.47000973e-03, + 1.85274973e-03, 1.36990519e-03, 9.97077208e-04, 7.13227608e-04, + 5.00426511e-04, 3.43578606e-04, 2.30138365e-04, 1.49821601e-04, + 9.43217892e-05, 5.70367956e-05, 3.28110509e-05, 1.76969679e-05, + 8.73827867e-06, 3.77677043e-06, 1.28252009e-06, 1.95021386e-07, +}; + +static const float mdct_win_5m_96k_hr[__LC3_MDCT_WIN_LEN(5000, 96000)] = { + 6.89548827e-08, 2.31516253e-07, 5.04477669e-07, 9.30795125e-07, + 1.56340695e-06, 2.46738750e-06, 3.72189174e-06, 5.42224188e-06, + 7.68219343e-06, 1.06363877e-05, 1.44429905e-05, 1.92865264e-05, + 2.53808976e-05, 3.29725954e-05, 4.23441015e-05, 5.38174427e-05, + 6.77579446e-05, 8.45781324e-05, 1.04741775e-04, 1.28768093e-04, + 1.57236034e-04, 1.90788676e-04, 2.30137754e-04, 2.76068167e-04, + 3.29442613e-04, 3.91206064e-04, 4.62390453e-04, 5.44119219e-04, + 6.37611491e-04, 7.44186866e-04, 8.65269103e-04, 1.00239040e-03, + 1.15719519e-03, 1.33144355e-03, 1.52701419e-03, 1.74590782e-03, + 1.99024938e-03, 2.26228987e-03, 2.56440835e-03, 2.89911311e-03, + 3.26904119e-03, 3.67696048e-03, 4.12576646e-03, 4.61848313e-03, + 5.15825953e-03, 5.74836833e-03, 6.39220094e-03, 7.09326472e-03, + 7.85517693e-03, 8.68165866e-03, 9.57652833e-03, 1.05436966e-02, + 1.15871523e-02, 1.27109587e-02, 1.39192408e-02, 1.52161736e-02, + 1.66059695e-02, 1.80928707e-02, 1.96811259e-02, 2.13749874e-02, + 2.31786855e-02, 2.50964165e-02, 2.71323286e-02, 2.92905010e-02, + 3.15749235e-02, 3.39894816e-02, 3.65379415e-02, 3.92239206e-02, + 4.20508720e-02, 4.50220704e-02, 4.81405817e-02, 5.14092445e-02, + 5.48306555e-02, 5.84071539e-02, 6.21407814e-02, 6.60332814e-02, + 7.00860694e-02, 7.43002295e-02, 7.86764771e-02, 8.32151473e-02, + 8.79162028e-02, 9.27791744e-02, 9.78031904e-02, 1.02986939e-01, + 1.08328678e-01, 1.13826200e-01, 1.19476855e-01, 1.25277504e-01, + 1.31224588e-01, 1.37314022e-01, 1.43541321e-01, 1.49901465e-01, + 1.56389058e-01, 1.62998185e-01, 1.69722542e-01, 1.76555380e-01, + 1.83489516e-01, 1.90517426e-01, 1.97631180e-01, 2.04822496e-01, + 2.12082773e-01, 2.19403118e-01, 2.26774365e-01, 2.34187096e-01, + 2.41631702e-01, 2.49098375e-01, 2.56577194e-01, 2.64058143e-01, + 2.71531105e-01, 2.78985947e-01, 2.86412567e-01, 2.93800950e-01, + 3.01141053e-01, 3.08423132e-01, 3.15637439e-01, 3.22774589e-01, + 3.29825372e-01, 3.36780816e-01, 3.43632400e-01, 3.50371778e-01, + 3.56991231e-01, 3.63483250e-01, 3.69840890e-01, 3.76057625e-01, + 3.82127434e-01, 3.88044775e-01, 3.93804729e-01, 3.99402857e-01, + 4.04835284e-01, 4.10098761e-01, 4.15190488e-01, 4.20108408e-01, + 4.24850911e-01, 4.29417044e-01, 4.33806360e-01, 4.38019037e-01, + 4.42055762e-01, 4.45917755e-01, 4.49606776e-01, 4.53125089e-01, + 4.56475437e-01, 4.59661037e-01, 4.62685496e-01, 4.65552896e-01, + 4.68267679e-01, 4.70834643e-01, 4.73258942e-01, 4.75546002e-01, + 4.77701575e-01, 4.79731590e-01, 4.81642276e-01, 4.83440012e-01, + 4.85131353e-01, 4.86723036e-01, 4.88221824e-01, 4.89634633e-01, + 4.90968436e-01, 4.92230296e-01, 4.93427187e-01, 4.94566232e-01, + 4.95654404e-01, 4.96698737e-01, 4.97706175e-01, 4.98683631e-01, + 4.99637932e-01, 5.00575840e-01, 5.01503944e-01, 5.02428830e-01, + 5.03356874e-01, 5.04294455e-01, 5.05247772e-01, 5.06222844e-01, + 5.07225573e-01, 5.08261740e-01, 5.09337008e-01, 5.10456860e-01, + 5.11626601e-01, 5.12851536e-01, 5.14136553e-01, 5.15486538e-01, + 5.16906321e-01, 5.18400311e-01, 5.19972920e-01, 5.21628320e-01, + 5.23370624e-01, 5.25203526e-01, 5.27130723e-01, 5.29155731e-01, + 5.31281710e-01, 5.33511758e-01, 5.35848677e-01, 5.38295090e-01, + 5.40853441e-01, 5.43525815e-01, 5.46314240e-01, 5.49220264e-01, + 5.52245498e-01, 5.55391014e-01, 5.58657765e-01, 5.62046468e-01, + 5.65557480e-01, 5.69190919e-01, 5.72946727e-01, 5.76824427e-01, + 5.80823362e-01, 5.84942579e-01, 5.89180827e-01, 5.93536615e-01, + 5.98008096e-01, 6.02593303e-01, 6.07289851e-01, 6.12095237e-01, + 6.17006540e-01, 6.22020781e-01, 6.27134562e-01, 6.32344365e-01, + 6.37646437e-01, 6.43036783e-01, 6.48511291e-01, 6.54065490e-01, + 6.59694970e-01, 6.65394902e-01, 6.71160460e-01, 6.76986754e-01, + 6.82868540e-01, 6.88800693e-01, 6.94777906e-01, 7.00794756e-01, + 7.06845820e-01, 7.12925553e-01, 7.19028473e-01, 7.25149035e-01, + 7.31281698e-01, 7.37420917e-01, 7.43561149e-01, 7.49696970e-01, + 7.55823016e-01, 7.61933863e-01, 7.68024206e-01, 7.74088979e-01, + 7.80123055e-01, 7.86121488e-01, 7.92079389e-01, 7.97992110e-01, + 8.03855121e-01, 8.09663892e-01, 8.15414310e-01, 8.21102202e-01, + 8.26723635e-01, 8.32274854e-01, 8.37752342e-01, 8.43152702e-01, + 8.48472714e-01, 8.53709280e-01, 8.58859718e-01, 8.63921225e-01, + 8.68891478e-01, 8.73768151e-01, 8.78549099e-01, 8.83232594e-01, + 8.87816727e-01, 8.92300129e-01, 8.96681368e-01, 9.00959313e-01, + 9.05132890e-01, 9.09201384e-01, 9.13164079e-01, 9.17020440e-01, + 9.20770228e-01, 9.24413145e-01, 9.27949250e-01, 9.31378603e-01, + 9.34701502e-01, 9.37918305e-01, 9.41029668e-01, 9.44036126e-01, + 9.46938515e-01, 9.49737847e-01, 9.52435017e-01, 9.55031335e-01, + 9.57527936e-01, 9.59926248e-01, 9.62227762e-01, 9.64434028e-01, + 9.66546714e-01, 9.68567610e-01, 9.70498502e-01, 9.72341299e-01, + 9.74098027e-01, 9.75770652e-01, 9.77361381e-01, 9.78872299e-01, + 9.80305672e-01, 9.81663704e-01, 9.82948720e-01, 9.84162986e-01, + 9.85308945e-01, 9.86388862e-01, 9.87405181e-01, 9.88360226e-01, + 9.89256442e-01, 9.90096152e-01, 9.90881741e-01, 9.91615593e-01, + 9.92299914e-01, 9.92937148e-01, 9.93529499e-01, 9.94079232e-01, + 9.94588435e-01, 9.95059371e-01, 9.95494127e-01, 9.95894730e-01, + 9.96263146e-01, 9.96601343e-01, 9.96911168e-01, 9.97194529e-01, + 9.97453094e-01, 9.97688591e-01, 9.97902572e-01, 9.98096704e-01, + 9.98272479e-01, 9.98431206e-01, 9.98574317e-01, 9.98703122e-01, + 9.98818815e-01, 9.98922586e-01, 9.99015450e-01, 9.99098480e-01, + 9.99172688e-01, 9.99238908e-01, 9.99298036e-01, 9.99350786e-01, + 9.99397993e-01, 9.99440193e-01, 9.99478102e-01, 9.99512255e-01, + 9.99543130e-01, 9.99571264e-01, 9.99597073e-01, 9.99620855e-01, + 9.99643087e-01, 9.99663949e-01, 9.99683797e-01, 9.99702871e-01, + 9.99721289e-01, 9.99739230e-01, 9.99756932e-01, 9.99774456e-01, + 9.99791920e-01, 9.99809384e-01, 9.99826908e-01, 9.99844551e-01, + 9.99862373e-01, 9.99880314e-01, 9.99898374e-01, 9.99916673e-01, + 9.99935031e-01, 9.99953508e-01, 9.99972105e-01, 9.99990702e-01, + 1.00000930e+00, 1.00002778e+00, 1.00004625e+00, 1.00006461e+00, + 1.00008273e+00, 1.00010061e+00, 1.00011826e+00, 1.00013554e+00, + 1.00015235e+00, 1.00016880e+00, 1.00018466e+00, 1.00020003e+00, + 1.00021482e+00, 1.00022900e+00, 1.00024247e+00, 1.00025523e+00, + 1.00026727e+00, 1.00027859e+00, 1.00028908e+00, 1.00029874e+00, + 1.00030744e+00, 1.00031543e+00, 1.00032246e+00, 1.00032854e+00, + 1.00033379e+00, 1.00033808e+00, 1.00034130e+00, 1.00034368e+00, + 1.00034511e+00, 1.00034559e+00, 1.00034511e+00, 1.00034368e+00, + 1.00034142e+00, 1.00033808e+00, 1.00033391e+00, 1.00032878e+00, + 1.00032282e+00, 1.00031602e+00, 1.00030828e+00, 1.00029981e+00, + 1.00029051e+00, 1.00028050e+00, 1.00026977e+00, 1.00025833e+00, + 1.00024617e+00, 1.00023329e+00, 1.00021994e+00, 1.00020599e+00, + 1.00019157e+00, 1.00017655e+00, 1.00016105e+00, 1.00014532e+00, + 1.00012910e+00, 1.00011253e+00, 1.00009573e+00, 1.00007868e+00, + 1.00006139e+00, 1.00004399e+00, 1.00002646e+00, 1.00000882e+00, + 9.99991179e-01, 9.99973595e-01, 9.99956071e-01, 9.99938667e-01, + 9.99921381e-01, 9.99904335e-01, 9.99887526e-01, 9.99870956e-01, + 9.99854743e-01, 9.99838948e-01, 9.99823511e-01, 9.99808550e-01, + 9.99794066e-01, 9.99780118e-01, 9.99766707e-01, 9.99753952e-01, + 9.99741793e-01, 9.99730289e-01, 9.99719560e-01, 9.99709487e-01, + 9.99700248e-01, 9.99691784e-01, 9.99684095e-01, 9.99677300e-01, + 9.99671280e-01, 9.99666214e-01, 9.99662042e-01, 9.99658763e-01, + 9.99656379e-01, 9.99655008e-01, 9.99654531e-01, 9.99654949e-01, + 9.99656379e-01, 9.99658763e-01, 9.99662101e-01, 9.99666333e-01, + 9.99671519e-01, 9.99677658e-01, 9.99684691e-01, 9.99692619e-01, + 9.99701381e-01, 9.99711037e-01, 9.99721527e-01, 9.99732792e-01, + 9.99744833e-01, 9.99757588e-01, 9.99771118e-01, 9.99785244e-01, + 9.99800026e-01, 9.99815404e-01, 9.99831259e-01, 9.99847651e-01, + 9.99864519e-01, 9.99881744e-01, 9.99899328e-01, 9.99917269e-01, + 9.99935389e-01, 9.99953687e-01, 9.99972165e-01, 9.99990702e-01, + 1.00000930e+00, 1.00002778e+00, 1.00004625e+00, 1.00006461e+00, + 1.00008273e+00, 1.00010061e+00, 1.00011826e+00, 1.00013554e+00, + 1.00015235e+00, 1.00016880e+00, 1.00018466e+00, 1.00020003e+00, + 1.00021482e+00, 1.00022900e+00, 1.00024247e+00, 1.00025523e+00, + 1.00026727e+00, 1.00027859e+00, 1.00028908e+00, 1.00029874e+00, + 1.00030744e+00, 1.00031543e+00, 1.00032246e+00, 1.00032854e+00, + 1.00033379e+00, 1.00033808e+00, 1.00034130e+00, 1.00034368e+00, + 1.00034511e+00, 1.00034559e+00, 1.00034511e+00, 1.00034368e+00, + 1.00034142e+00, 1.00033808e+00, 1.00033391e+00, 1.00032878e+00, + 1.00032282e+00, 1.00031602e+00, 1.00030828e+00, 1.00029981e+00, + 1.00029051e+00, 1.00028050e+00, 1.00026977e+00, 1.00025833e+00, + 1.00024617e+00, 1.00023329e+00, 1.00021994e+00, 1.00020599e+00, + 1.00019157e+00, 1.00017655e+00, 1.00016105e+00, 1.00014532e+00, + 1.00012910e+00, 1.00011253e+00, 1.00009573e+00, 1.00007868e+00, + 1.00006139e+00, 1.00004399e+00, 1.00002646e+00, 1.00000882e+00, + 9.99991179e-01, 9.99973595e-01, 9.99956071e-01, 9.99938667e-01, + 9.99921381e-01, 9.99904335e-01, 9.99887526e-01, 9.99870956e-01, + 9.99854743e-01, 9.99838948e-01, 9.99823511e-01, 9.99808550e-01, + 9.99794066e-01, 9.99780118e-01, 9.99766707e-01, 9.99753952e-01, + 9.99741793e-01, 9.99730289e-01, 9.99719560e-01, 9.99709487e-01, + 9.99700248e-01, 9.99691784e-01, 9.99684095e-01, 9.99677300e-01, + 9.99671280e-01, 9.99666214e-01, 9.99662042e-01, 9.99658763e-01, + 9.99656379e-01, 9.99655008e-01, 9.99654531e-01, 9.99654949e-01, + 9.99656379e-01, 9.99658763e-01, 9.99662101e-01, 9.99666333e-01, + 9.99671519e-01, 9.99677658e-01, 9.99684691e-01, 9.99692619e-01, + 9.99701381e-01, 9.99711037e-01, 9.99721527e-01, 9.99732792e-01, + 9.99744833e-01, 9.99757588e-01, 9.99771118e-01, 9.99785244e-01, + 9.99800026e-01, 9.99815404e-01, 9.99831259e-01, 9.99847651e-01, + 9.99864519e-01, 9.99881744e-01, 9.99899328e-01, 9.99917269e-01, + 9.99935389e-01, 9.99953687e-01, 9.99972165e-01, 9.99990702e-01, + 1.00000930e+00, 1.00002778e+00, 1.00004613e+00, 1.00006425e+00, + 1.00008214e+00, 1.00009966e+00, 1.00011683e+00, 1.00013340e+00, + 1.00014925e+00, 1.00016439e+00, 1.00017869e+00, 1.00019193e+00, + 1.00020397e+00, 1.00021482e+00, 1.00022411e+00, 1.00023162e+00, + 1.00023735e+00, 1.00024080e+00, 1.00024199e+00, 1.00024033e+00, + 1.00023568e+00, 1.00022769e+00, 1.00021589e+00, 1.00020003e+00, + 1.00017941e+00, 1.00015378e+00, 1.00012243e+00, 1.00008476e+00, + 1.00004041e+00, 9.99988317e-01, 9.99928057e-01, 9.99858677e-01, + 9.99779403e-01, 9.99689281e-01, 9.99587417e-01, 9.99472737e-01, + 9.99344110e-01, 9.99200404e-01, 9.99040425e-01, 9.98862803e-01, + 9.98666167e-01, 9.98449087e-01, 9.98209953e-01, 9.97947097e-01, + 9.97658968e-01, 9.97343540e-01, 9.96999085e-01, 9.96623516e-01, + 9.96214747e-01, 9.95770633e-01, 9.95288789e-01, 9.94766831e-01, + 9.94202256e-01, 9.93592501e-01, 9.92934704e-01, 9.92226064e-01, + 9.91463542e-01, 9.90644097e-01, 9.89764392e-01, 9.88821149e-01, + 9.87810850e-01, 9.86729801e-01, 9.85574305e-01, 9.84340370e-01, + 9.83024001e-01, 9.81621027e-01, 9.80127096e-01, 9.78537738e-01, + 9.76848423e-01, 9.75054383e-01, 9.73150730e-01, 9.71132576e-01, + 9.68994796e-01, 9.66732204e-01, 9.64339435e-01, 9.61811244e-01, + 9.59142029e-01, 9.56326306e-01, 9.53358531e-01, 9.50233042e-01, + 9.46944118e-01, 9.43486214e-01, 9.39853668e-01, 9.36040819e-01, + 9.32042122e-01, 9.27852154e-01, 9.23465431e-01, 9.18876767e-01, + 9.14081097e-01, 9.09073353e-01, 9.03848886e-01, 8.98403168e-01, + 8.92731845e-01, 8.86831045e-01, 8.80696952e-01, 8.74326289e-01, + 8.67715955e-01, 8.60863328e-01, 8.53766203e-01, 8.46422672e-01, + 8.38831365e-01, 8.30991328e-01, 8.22902203e-01, 8.14563930e-01, + 8.05977046e-01, 7.97142744e-01, 7.88062632e-01, 7.78738797e-01, + 7.69173980e-01, 7.59371519e-01, 7.49335289e-01, 7.39069760e-01, + 7.28579819e-01, 7.17871130e-01, 7.06949770e-01, 6.95822597e-01, + 6.84496701e-01, 6.72980070e-01, 6.61280870e-01, 6.49408042e-01, + 6.37370944e-01, 6.25179410e-01, 6.12843752e-01, 6.00374699e-01, + 5.87783396e-01, 5.75081468e-01, 5.62280834e-01, 5.49393654e-01, + 5.36432624e-01, 5.23410499e-01, 5.10340393e-01, 4.97235566e-01, + 4.84109521e-01, 4.70975846e-01, 4.57848251e-01, 4.44740474e-01, + 4.31666315e-01, 4.18639511e-01, 4.05673832e-01, 3.92782807e-01, + 3.79979968e-01, 3.67278606e-01, 3.54691803e-01, 3.42232376e-01, + 3.29912812e-01, 3.17745358e-01, 3.05741847e-01, 2.93913603e-01, + 2.82271683e-01, 2.70826548e-01, 2.59588152e-01, 2.48565957e-01, + 2.37768814e-01, 2.27205008e-01, 2.16882199e-01, 2.06807390e-01, + 1.96986943e-01, 1.87426537e-01, 1.78131178e-01, 1.69105172e-01, + 1.60352126e-01, 1.51874945e-01, 1.43675804e-01, 1.35756254e-01, + 1.28117070e-01, 1.20758407e-01, 1.13679729e-01, 1.06879868e-01, + 1.00357018e-01, 9.41087753e-02, 8.81321430e-02, 8.24235976e-02, + 7.69790635e-02, 7.17940032e-02, 6.68634027e-02, 6.21818379e-02, + 5.77434972e-02, 5.35422154e-02, 4.95715141e-02, 4.58246432e-02, + 4.22946103e-02, 3.89742292e-02, 3.58561426e-02, 3.29328589e-02, + 3.01968064e-02, 2.76403390e-02, 2.52557844e-02, 2.30354760e-02, + 2.09717732e-02, 1.90570969e-02, 1.72839500e-02, 1.56449396e-02, + 1.41328052e-02, 1.27404351e-02, 1.14608845e-02, 1.02873892e-02, + 9.21338331e-03, 8.23251065e-03, 7.33863330e-03, 6.52584061e-03, + 5.78845851e-03, 5.12105133e-03, 4.51842742e-03, 3.97564145e-03, + 3.48799396e-03, 3.05103138e-03, 2.66054412e-03, 2.31256452e-03, + 2.00336217e-03, 1.72943878e-03, 1.48752402e-03, 1.27456791e-03, + 1.08773448e-03, 9.24394117e-04, 7.82115792e-04, 6.58658682e-04, + 5.51963516e-04, 4.60143900e-04, 3.81477352e-04, 3.14396282e-04, + 2.57478940e-04, 2.09440448e-04, 1.69123945e-04, 1.35491777e-04, + 1.07617016e-04, 8.46750627e-05, 6.59356156e-05, 5.07548866e-05, + 3.85681342e-05, 2.88825358e-05, 2.12704090e-05, 1.53627971e-05, + 1.08434460e-05, 7.44312956e-06, 4.93438165e-06, 3.12659085e-06, + 1.86147406e-06, 1.00890213e-06, 4.63012810e-07, 1.37904777e-07, +}; + +#endif /* LC3_PLUS_HR */ +#endif /* LC3_PLUS */ + +static const float mdct_win_7m5_8k[__LC3_MDCT_WIN_LEN(7500, 8000)] = { 2.95060859e-03, 7.17541132e-03, 1.37695374e-02, 2.30953556e-02, 3.54036230e-02, 5.08289304e-02, 6.94696293e-02, 9.13884278e-02, 1.16604575e-01, 1.45073546e-01, 1.76711174e-01, 2.11342953e-01, @@ -1545,7 +2493,7 @@ static const float mdct_win_7m5_8k[__LC3_MDCT_WIN_LEN(7M5, 8K)] = { 1.26976223e-02, 5.35665361e-03, }; -static const float mdct_win_7m5_16k[__LC3_MDCT_WIN_LEN(7M5, 16K)] = { +static const float mdct_win_7m5_16k[__LC3_MDCT_WIN_LEN(7500, 16000)] = { 2.20824874e-03, 3.81014420e-03, 5.91552473e-03, 8.58361457e-03, 1.18759723e-02, 1.58335301e-02, 2.04918652e-02, 2.58883593e-02, 3.20415894e-02, 3.89616721e-02, 4.66742169e-02, 5.51849337e-02, @@ -1601,7 +2549,7 @@ static const float mdct_win_7m5_16k[__LC3_MDCT_WIN_LEN(7M5, 16K)] = { 1.51125125e-02, 1.05228754e-02, 6.85547314e-03, 4.02351119e-03, }; -static const float mdct_win_7m5_24k[__LC3_MDCT_WIN_LEN(7M5, 24K)] = { +static const float mdct_win_7m5_24k[__LC3_MDCT_WIN_LEN(7500, 24000)] = { 1.97084908e-03, 2.95060859e-03, 4.12447721e-03, 5.52688664e-03, 7.17541132e-03, 9.08757730e-03, 1.12819105e-02, 1.37695374e-02, 1.65600266e-02, 1.96650895e-02, 2.30953556e-02, 2.68612894e-02, @@ -1684,7 +2632,7 @@ static const float mdct_win_7m5_24k[__LC3_MDCT_WIN_LEN(7M5, 24K)] = { 5.35665361e-03, 3.83226552e-03, }; -static const float mdct_win_7m5_32k[__LC3_MDCT_WIN_LEN(7M5, 32K)] = { +static const float mdct_win_7m5_32k[__LC3_MDCT_WIN_LEN(7500, 32000)] = { 1.84833037e-03, 2.56481839e-03, 3.36762118e-03, 4.28736617e-03, 5.33830143e-03, 6.52679223e-03, 7.86112587e-03, 9.34628179e-03, 1.09916868e-02, 1.28011172e-02, 1.47805911e-02, 1.69307043e-02, @@ -1793,7 +2741,7 @@ static const float mdct_win_7m5_32k[__LC3_MDCT_WIN_LEN(7M5, 32K)] = { 7.69137380e-03, 6.07207833e-03, 4.62581217e-03, 3.60685164e-03, }; -static const float mdct_win_7m5_48k[__LC3_MDCT_WIN_LEN(7M5, 48K)] = { +static const float mdct_win_7m5_48k[__LC3_MDCT_WIN_LEN(7500, 48000)] = { 1.72152668e-03, 2.20824874e-03, 2.68901752e-03, 3.22613342e-03, 3.81014420e-03, 4.45371932e-03, 5.15369240e-03, 5.91552473e-03, 6.73869158e-03, 7.62861841e-03, 8.58361457e-03, 9.60938437e-03, @@ -1955,7 +2903,7 @@ static const float mdct_win_7m5_48k[__LC3_MDCT_WIN_LEN(7M5, 48K)] = { 5.82657334e-03, 4.87838525e-03, 4.02351119e-03, 3.15418663e-03, }; -static const float mdct_win_10m_8k[__LC3_MDCT_WIN_LEN(10M, 8K)] = { +static const float mdct_win_10m_8k[__LC3_MDCT_WIN_LEN(10000, 8000)] = { -7.07854671e-04, -2.09819773e-03, -4.52519808e-03, -8.23397633e-03, -1.33771310e-02, -1.99972156e-02, -2.80090946e-02, -3.72150208e-02, -4.73176826e-02, -5.79465483e-02, -6.86760675e-02, -7.90464744e-02, @@ -1991,7 +2939,7 @@ static const float mdct_win_10m_8k[__LC3_MDCT_WIN_LEN(10M, 8K)] = { 2.70146141e-02, 9.99674359e-03, }; -static const float mdct_win_10m_16k[__LC3_MDCT_WIN_LEN(10M, 16K)] = { +static const float mdct_win_10m_16k[__LC3_MDCT_WIN_LEN(10000, 16000)] = { -4.61989875e-04, -9.74716672e-04, -1.66447310e-03, -2.59710692e-03, -3.80628516e-03, -5.32460872e-03, -7.17588528e-03, -9.38248086e-03, -1.19527030e-02, -1.48952816e-02, -1.82066640e-02, -2.18757093e-02, @@ -2059,7 +3007,7 @@ static const float mdct_win_10m_16k[__LC3_MDCT_WIN_LEN(10M, 16K)] = { 3.28807275e-02, 2.18305756e-02, 1.33638143e-02, 6.75812489e-03, }; -static const float mdct_win_10m_24k[__LC3_MDCT_WIN_LEN(10M, 24K)] = { +static const float mdct_win_10m_24k[__LC3_MDCT_WIN_LEN(10000, 24000)] = { -3.61349642e-04, -7.07854671e-04, -1.07444364e-03, -1.53347854e-03, -2.09819773e-03, -2.77842087e-03, -3.58412992e-03, -4.52519808e-03, -5.60932724e-03, -6.84323454e-03, -8.23397633e-03, -9.78531476e-03, @@ -2160,7 +3108,7 @@ static const float mdct_win_10m_24k[__LC3_MDCT_WIN_LEN(10M, 24K)] = { 9.99674359e-03, 5.30523510e-03, }; -static const float mdct_win_10m_32k[__LC3_MDCT_WIN_LEN(10M, 32K)] = { +static const float mdct_win_10m_32k[__LC3_MDCT_WIN_LEN(10000, 32000)] = { -3.02115349e-04, -5.86773749e-04, -8.36650400e-04, -1.12663536e-03, -1.47049294e-03, -1.87347339e-03, -2.33929236e-03, -2.87200807e-03, -3.47625639e-03, -4.15596382e-03, -4.91456379e-03, -5.75517250e-03, @@ -2293,7 +3241,7 @@ static const float mdct_win_10m_32k[__LC3_MDCT_WIN_LEN(10M, 32K)] = { 1.52571017e-02, 1.16378749e-02, 8.43308778e-03, 4.44966900e-03, }; -static const float mdct_win_10m_48k[__LC3_MDCT_WIN_LEN(10M, 48K)] = { +static const float mdct_win_10m_48k[__LC3_MDCT_WIN_LEN(10000, 48000)] = { -2.35303215e-04, -4.61989875e-04, -6.26293154e-04, -7.92918043e-04, -9.74716672e-04, -1.18025689e-03, -1.40920904e-03, -1.66447310e-03, -1.94659161e-03, -2.25708173e-03, -2.59710692e-03, -2.96760762e-03, @@ -2491,45 +3439,632 @@ static const float mdct_win_10m_48k[__LC3_MDCT_WIN_LEN(10M, 48K)] = { 1.10855888e-02, 8.94347419e-03, 6.75812489e-03, 3.50443813e-03, }; +#if LC3_PLUS_HR + +static const float mdct_win_10m_48k_hr[__LC3_MDCT_WIN_LEN(10000, 48000)] = { + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 9.42341174e-08, 6.19838374e-07, 1.82603810e-06, 4.22741550e-06, + 8.56822135e-06, 1.59013834e-05, 2.76738483e-05, 4.58246141e-05, + 7.28956657e-05, 1.12155336e-04, 1.67733029e-04, 2.44763592e-04, + 3.49539070e-04, 4.89664846e-04, 6.74216484e-04, 9.13893222e-04, + 1.22116262e-03, 1.61039189e-03, 2.09795963e-03, 2.70234118e-03, + 3.44416290e-03, 4.34621749e-03, 5.43343695e-03, 6.73281262e-03, + 8.27326626e-03, 1.00854570e-02, 1.22015327e-02, 1.46548180e-02, + 1.74794346e-02, 2.07098722e-02, 2.43804958e-02, 2.85249949e-02, + 3.31758074e-02, 3.83635014e-02, 4.41161096e-02, 5.04585020e-02, + 5.74117042e-02, 6.49922863e-02, 7.32117295e-02, 8.20759088e-02, + 9.15845558e-02, 1.01730898e-01, 1.12501279e-01, 1.23875007e-01, + 1.35824218e-01, 1.48313895e-01, 1.61302090e-01, 1.74740151e-01, + 1.88573152e-01, 2.02740535e-01, 2.17176691e-01, 2.31811777e-01, + 2.46572644e-01, 2.61383832e-01, 2.76168495e-01, 2.90849626e-01, + 3.05351138e-01, 3.19598824e-01, 3.33521664e-01, 3.47052664e-01, + 3.60129982e-01, 3.72697920e-01, 3.84707332e-01, 3.96116525e-01, + 4.06891733e-01, 4.17007536e-01, 4.26446915e-01, 4.35201406e-01, + 4.43271041e-01, 4.50664014e-01, 4.57396388e-01, 4.63491529e-01, + 4.68979478e-01, 4.73896384e-01, 4.78283674e-01, 4.82187212e-01, + 4.85656589e-01, 4.88744229e-01, 4.91504699e-01, 4.93993789e-01, + 4.96267974e-01, 4.98383760e-01, 5.00396967e-01, 5.02362430e-01, + 5.04333496e-01, 5.06361604e-01, 5.08496106e-01, 5.10783911e-01, + 5.13269365e-01, 5.15994072e-01, 5.18996596e-01, 5.22312462e-01, + 5.25973916e-01, 5.30009925e-01, 5.34445822e-01, 5.39303243e-01, + 5.44600070e-01, 5.50350249e-01, 5.56563497e-01, 5.63245535e-01, + 5.70397854e-01, 5.78017771e-01, 5.86098313e-01, 5.94628513e-01, + 6.03593290e-01, 6.12973869e-01, 6.22747838e-01, 6.32889450e-01, + 6.43370092e-01, 6.54158235e-01, 6.65220201e-01, 6.76520288e-01, + 6.88021243e-01, 6.99684739e-01, 7.11471498e-01, 7.23342001e-01, + 7.35256732e-01, 7.47176409e-01, 7.59062469e-01, 7.70877421e-01, + 7.82584906e-01, 7.94150114e-01, 8.05540025e-01, 8.16723466e-01, + 8.27671409e-01, 8.38356972e-01, 8.48755658e-01, 8.58845115e-01, + 8.68605733e-01, 8.78019989e-01, 8.87072980e-01, 8.95752132e-01, + 9.04047191e-01, 9.11950290e-01, 9.19455826e-01, 9.26560223e-01, + 9.33262229e-01, 9.39562619e-01, 9.45464134e-01, 9.50971425e-01, + 9.56090987e-01, 9.60831106e-01, 9.65201676e-01, 9.69214201e-01, + 9.72881556e-01, 9.76217866e-01, 9.79238510e-01, 9.81959701e-01, + 9.84398544e-01, 9.86572623e-01, 9.88499999e-01, 9.90198970e-01, + 9.91687655e-01, 9.92984235e-01, 9.94106293e-01, 9.95071113e-01, + 9.95895147e-01, 9.96594131e-01, 9.97182965e-01, 9.97675478e-01, + 9.98084545e-01, 9.98421967e-01, 9.98698533e-01, 9.98923838e-01, + 9.99106586e-01, 9.99254227e-01, 9.99373496e-01, 9.99470055e-01, + 9.99548733e-01, 9.99613643e-01, 9.99668002e-01, 9.99714673e-01, + 9.99755740e-01, 9.99792874e-01, 9.99827385e-01, 9.99860168e-01, + 9.99891937e-01, 9.99923110e-01, 9.99953985e-01, 9.99984682e-01, + 1.00001526e+00, 1.00004578e+00, 1.00007617e+00, 1.00010622e+00, + 1.00013602e+00, 1.00016546e+00, 1.00019431e+00, 1.00022256e+00, + 1.00025010e+00, 1.00027692e+00, 1.00030291e+00, 1.00032794e+00, + 1.00035203e+00, 1.00037491e+00, 1.00039685e+00, 1.00041747e+00, + 1.00043690e+00, 1.00045502e+00, 1.00047183e+00, 1.00048721e+00, + 1.00050116e+00, 1.00051367e+00, 1.00052476e+00, 1.00053418e+00, + 1.00054228e+00, 1.00054872e+00, 1.00055361e+00, 1.00055695e+00, + 1.00055885e+00, 1.00055909e+00, 1.00055790e+00, 1.00055504e+00, + 1.00055087e+00, 1.00054502e+00, 1.00053787e+00, 1.00052929e+00, + 1.00051928e+00, 1.00050783e+00, 1.00049520e+00, 1.00048113e+00, + 1.00046599e+00, 1.00044954e+00, 1.00043201e+00, 1.00041330e+00, + 1.00039363e+00, 1.00037301e+00, 1.00035143e+00, 1.00032890e+00, + 1.00030565e+00, 1.00028157e+00, 1.00025690e+00, 1.00023150e+00, + 1.00020564e+00, 1.00017929e+00, 1.00015235e+00, 1.00012517e+00, + 1.00009763e+00, 1.00006998e+00, 1.00004208e+00, 1.00001407e+00, + 9.99985993e-01, 9.99957979e-01, 9.99930084e-01, 9.99902308e-01, + 9.99874830e-01, 9.99847591e-01, 9.99820769e-01, 9.99794364e-01, + 9.99768496e-01, 9.99743164e-01, 9.99718428e-01, 9.99694467e-01, + 9.99671161e-01, 9.99648750e-01, 9.99627173e-01, 9.99606490e-01, + 9.99586821e-01, 9.99568224e-01, 9.99550641e-01, 9.99534249e-01, + 9.99519050e-01, 9.99505103e-01, 9.99492407e-01, 9.99481022e-01, + 9.99471009e-01, 9.99462426e-01, 9.99455214e-01, 9.99449492e-01, + 9.99445200e-01, 9.99442458e-01, 9.99441206e-01, 9.99441504e-01, + 9.99443293e-01, 9.99446690e-01, 9.99451578e-01, 9.99458075e-01, + 9.99466062e-01, 9.99475598e-01, 9.99486566e-01, 9.99499083e-01, + 9.99513030e-01, 9.99528408e-01, 9.99545157e-01, 9.99563277e-01, + 9.99582708e-01, 9.99603331e-01, 9.99625206e-01, 9.99648154e-01, + 9.99672174e-01, 9.99697208e-01, 9.99723136e-01, 9.99749959e-01, + 9.99777496e-01, 9.99805748e-01, 9.99834597e-01, 9.99863982e-01, + 9.99893785e-01, 9.99923885e-01, 9.99954224e-01, 9.99984741e-01, + 1.00001526e+00, 1.00004578e+00, 1.00007617e+00, 1.00010622e+00, + 1.00013602e+00, 1.00016546e+00, 1.00019431e+00, 1.00022256e+00, + 1.00025010e+00, 1.00027692e+00, 1.00030291e+00, 1.00032794e+00, + 1.00035203e+00, 1.00037491e+00, 1.00039685e+00, 1.00041747e+00, + 1.00043690e+00, 1.00045502e+00, 1.00047183e+00, 1.00048721e+00, + 1.00050116e+00, 1.00051367e+00, 1.00052476e+00, 1.00053418e+00, + 1.00054228e+00, 1.00054872e+00, 1.00055361e+00, 1.00055695e+00, + 1.00055885e+00, 1.00055909e+00, 1.00055790e+00, 1.00055504e+00, + 1.00055087e+00, 1.00054502e+00, 1.00053787e+00, 1.00052929e+00, + 1.00051928e+00, 1.00050783e+00, 1.00049520e+00, 1.00048113e+00, + 1.00046599e+00, 1.00044954e+00, 1.00043201e+00, 1.00041330e+00, + 1.00039363e+00, 1.00037301e+00, 1.00035143e+00, 1.00032890e+00, + 1.00030565e+00, 1.00028157e+00, 1.00025690e+00, 1.00023150e+00, + 1.00020564e+00, 1.00017929e+00, 1.00015235e+00, 1.00012517e+00, + 1.00009763e+00, 1.00006998e+00, 1.00004208e+00, 1.00001407e+00, + 9.99985993e-01, 9.99957979e-01, 9.99930084e-01, 9.99902308e-01, + 9.99874830e-01, 9.99847591e-01, 9.99820769e-01, 9.99794364e-01, + 9.99768496e-01, 9.99743164e-01, 9.99718428e-01, 9.99694467e-01, + 9.99671161e-01, 9.99648750e-01, 9.99627173e-01, 9.99606490e-01, + 9.99586821e-01, 9.99568224e-01, 9.99550641e-01, 9.99534249e-01, + 9.99519050e-01, 9.99505103e-01, 9.99492407e-01, 9.99481022e-01, + 9.99471009e-01, 9.99462426e-01, 9.99455214e-01, 9.99449492e-01, + 9.99445200e-01, 9.99442458e-01, 9.99441206e-01, 9.99441504e-01, + 9.99443293e-01, 9.99446690e-01, 9.99451578e-01, 9.99458075e-01, + 9.99466062e-01, 9.99475598e-01, 9.99486566e-01, 9.99499083e-01, + 9.99513030e-01, 9.99528408e-01, 9.99545157e-01, 9.99563277e-01, + 9.99582708e-01, 9.99603331e-01, 9.99625206e-01, 9.99648154e-01, + 9.99672174e-01, 9.99697208e-01, 9.99723136e-01, 9.99749959e-01, + 9.99777496e-01, 9.99805748e-01, 9.99834597e-01, 9.99863982e-01, + 9.99893785e-01, 9.99923885e-01, 9.99954224e-01, 9.99984741e-01, + 1.00001526e+00, 1.00004578e+00, 1.00007617e+00, 1.00010622e+00, + 1.00013602e+00, 1.00016546e+00, 1.00019431e+00, 1.00022256e+00, + 1.00025010e+00, 1.00027692e+00, 1.00030291e+00, 1.00032794e+00, + 1.00035203e+00, 1.00037491e+00, 1.00039685e+00, 1.00041747e+00, + 1.00043690e+00, 1.00045502e+00, 1.00047183e+00, 1.00048721e+00, + 1.00050116e+00, 1.00051367e+00, 1.00052476e+00, 1.00053418e+00, + 1.00054228e+00, 1.00054872e+00, 1.00055361e+00, 1.00055695e+00, + 1.00055885e+00, 1.00055909e+00, 1.00055790e+00, 1.00055504e+00, + 1.00055087e+00, 1.00054502e+00, 1.00053787e+00, 1.00052929e+00, + 1.00051928e+00, 1.00050783e+00, 1.00049520e+00, 1.00048113e+00, + 1.00046599e+00, 1.00044954e+00, 1.00043201e+00, 1.00041330e+00, + 1.00039363e+00, 1.00037301e+00, 1.00035143e+00, 1.00032890e+00, + 1.00030565e+00, 1.00028157e+00, 1.00025690e+00, 1.00023150e+00, + 1.00020564e+00, 1.00017929e+00, 1.00015235e+00, 1.00012517e+00, + 1.00009763e+00, 1.00006998e+00, 1.00004208e+00, 1.00001407e+00, + 9.99985993e-01, 9.99957979e-01, 9.99930084e-01, 9.99902308e-01, + 9.99874830e-01, 9.99847591e-01, 9.99820769e-01, 9.99794364e-01, + 9.99768496e-01, 9.99743164e-01, 9.99718428e-01, 9.99694467e-01, + 9.99671161e-01, 9.99648750e-01, 9.99627173e-01, 9.99606490e-01, + 9.99586821e-01, 9.99568224e-01, 9.99550641e-01, 9.99534249e-01, + 9.99519050e-01, 9.99505103e-01, 9.99492407e-01, 9.99481022e-01, + 9.99471009e-01, 9.99462426e-01, 9.99455214e-01, 9.99449492e-01, + 9.99445200e-01, 9.99442458e-01, 9.99441206e-01, 9.99441504e-01, + 9.99443293e-01, 9.99446690e-01, 9.99451578e-01, 9.99458075e-01, + 9.99466062e-01, 9.99475598e-01, 9.99486566e-01, 9.99499083e-01, + 9.99513030e-01, 9.99528408e-01, 9.99545157e-01, 9.99563277e-01, + 9.99582708e-01, 9.99603331e-01, 9.99625206e-01, 9.99648154e-01, + 9.99672174e-01, 9.99697208e-01, 9.99723136e-01, 9.99749959e-01, + 9.99777496e-01, 9.99805748e-01, 9.99834597e-01, 9.99863982e-01, + 9.99893785e-01, 9.99923885e-01, 9.99954224e-01, 9.99984741e-01, + 1.00001526e+00, 1.00004554e+00, 1.00007534e+00, 1.00010443e+00, + 1.00013220e+00, 1.00015819e+00, 1.00018132e+00, 1.00020075e+00, + 1.00021482e+00, 1.00022173e+00, 1.00021923e+00, 1.00020432e+00, + 1.00017369e+00, 1.00012279e+00, 1.00004685e+00, 9.99939978e-01, + 9.99795198e-01, 9.99604583e-01, 9.99359250e-01, 9.99048889e-01, + 9.98662114e-01, 9.98186171e-01, 9.97606814e-01, 9.96908367e-01, + 9.96073723e-01, 9.95083988e-01, 9.93918717e-01, 9.92555678e-01, + 9.90970671e-01, 9.89137888e-01, 9.87029374e-01, 9.84615326e-01, + 9.81863916e-01, 9.78741586e-01, 9.75212753e-01, 9.71240282e-01, + 9.66785491e-01, 9.61808383e-01, 9.56268132e-01, 9.50123310e-01, + 9.43332374e-01, 9.35854316e-01, 9.27648962e-01, 9.18677926e-01, + 9.08904910e-01, 8.98296535e-01, 8.86823177e-01, 8.74459147e-01, + 8.61183822e-01, 8.46981943e-01, 8.31844091e-01, 8.15767467e-01, + 7.98755884e-01, 7.80820429e-01, 7.61979520e-01, 7.42259145e-01, + 7.21692860e-01, 7.00321794e-01, 6.78194642e-01, 6.55367255e-01, + 6.31902635e-01, 6.07870460e-01, 5.83346546e-01, 5.58412433e-01, + 5.33154905e-01, 5.07664979e-01, 4.82037485e-01, 4.56370175e-01, + 4.30762708e-01, 4.05315757e-01, 3.80130053e-01, 3.55305195e-01, + 3.30938727e-01, 3.07124883e-01, 2.83953428e-01, 2.61508703e-01, + 2.39868388e-01, 2.19102606e-01, 1.99272946e-01, 1.80431694e-01, + 1.62621215e-01, 1.45873442e-01, 1.30209655e-01, 1.15640387e-01, + 1.02165572e-01, 8.97749513e-02, 7.84486011e-02, 6.81576878e-02, + 5.88653944e-02, 5.05279638e-02, 4.30957973e-02, 3.65146622e-02, + 3.07268873e-02, 2.56725382e-02, 2.12905537e-02, 1.75197981e-02, + 1.43000064e-02, 1.15726292e-02, 9.28153656e-03, 7.37359654e-03, + 5.79912262e-03, 4.51218896e-03, 3.47083295e-03, 2.63714185e-03, + 1.97724649e-03, 1.46123092e-03, 1.06297329e-03, 7.59930001e-04, + 5.32880833e-04, 3.65644053e-04, 2.44775380e-04, 1.59260671e-04, + 1.00211051e-04, 6.05685127e-05, 3.48275607e-05, 1.87775731e-05, + 9.26902067e-06, 4.00523413e-06, 1.35989160e-06, 2.06769442e-07, +}; + +static const float mdct_win_10m_96k_hr[__LC3_MDCT_WIN_LEN(10000, 96000)] = { + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 6.66310811e-08, 2.23723916e-07, 4.87541854e-07, 8.99672727e-07, + 1.51141830e-06, 2.38590815e-06, 3.60002150e-06, 5.24645884e-06, + 7.43599958e-06, 1.02999529e-05, 1.39928125e-05, 1.86951092e-05, + 2.46164800e-05, 3.19989194e-05, 4.11202636e-05, 5.22978444e-05, + 6.58923600e-05, 8.23118899e-05, 1.02016144e-04, 1.25520819e-04, + 1.53402099e-04, 1.86301360e-04, 2.24929841e-04, 2.70073535e-04, + 3.22598062e-04, 3.83453589e-04, 4.53679706e-04, 5.34410414e-04, + 6.26878755e-04, 7.32421642e-04, 8.52484489e-04, 9.88625223e-04, + 1.14251883e-03, 1.31596089e-03, 1.51087111e-03, 1.72929652e-03, + 1.97341433e-03, 2.24553375e-03, 2.54809810e-03, 2.88368552e-03, + 3.25501012e-03, 3.66492104e-03, 4.11640201e-03, 4.61257016e-03, + 5.15667303e-03, 5.75208431e-03, 6.40230207e-03, 7.11094262e-03, + 7.88173359e-03, 8.71850923e-03, 9.62519925e-03, 1.06058242e-02, + 1.16644828e-02, 1.28053408e-02, 1.40326228e-02, 1.53505951e-02, + 1.67635549e-02, 1.82758160e-02, 1.98916886e-02, 2.16154736e-02, + 2.34514344e-02, 2.54037846e-02, 2.74766665e-02, 2.96741407e-02, + 3.20001543e-02, 3.44585292e-02, 3.70529443e-02, 3.97869013e-02, + 4.26637232e-02, 4.56865206e-02, 4.88581695e-02, 5.21813035e-02, + 5.56582808e-02, 5.92911765e-02, 6.30817562e-02, 6.70314580e-02, + 7.11413696e-02, 7.54122287e-02, 7.98443928e-02, 8.44378322e-02, + 8.91921073e-02, 9.41063836e-02, 9.91793722e-02, 1.04409374e-01, + 1.09794252e-01, 1.15331404e-01, 1.21017799e-01, 1.26849949e-01, + 1.32823929e-01, 1.38935357e-01, 1.45179421e-01, 1.51550874e-01, + 1.58044025e-01, 1.64652810e-01, 1.71370730e-01, 1.78190947e-01, + 1.85106188e-01, 1.92108899e-01, 1.99191183e-01, 2.06344813e-01, + 2.13561311e-01, 2.20831960e-01, 2.28147790e-01, 2.35499650e-01, + 2.42878228e-01, 2.50274092e-01, 2.57677704e-01, 2.65079439e-01, + 2.72469670e-01, 2.79838771e-01, 2.87177145e-01, 2.94475257e-01, + 3.01723719e-01, 3.08913231e-01, 3.16034675e-01, 3.23079228e-01, + 3.30038190e-01, 3.36903185e-01, 3.43666196e-01, 3.50319386e-01, + 3.56855512e-01, 3.63267571e-01, 3.69548947e-01, 3.75693500e-01, + 3.81695598e-01, 3.87549996e-01, 3.93251985e-01, 3.98797333e-01, + 4.04182315e-01, 4.09403801e-01, 4.14459109e-01, 4.19346124e-01, + 4.24063236e-01, 4.28609401e-01, 4.32984143e-01, 4.37187403e-01, + 4.41219747e-01, 4.45082188e-01, 4.48776275e-01, 4.52303976e-01, + 4.55667824e-01, 4.58870709e-01, 4.61916000e-01, 4.64807451e-01, + 4.67549264e-01, 4.70145911e-01, 4.72602278e-01, 4.74923581e-01, + 4.77115244e-01, 4.79183048e-01, 4.81132984e-01, 4.82971221e-01, + 4.84704226e-01, 4.86338496e-01, 4.87880766e-01, 4.89337832e-01, + 4.90716666e-01, 4.92024213e-01, 4.93267536e-01, 4.94453669e-01, + 4.95589703e-01, 4.96682733e-01, 4.97739762e-01, 4.98767793e-01, + 4.99773741e-01, 5.00764489e-01, 5.01746774e-01, 5.02727270e-01, + 5.03712595e-01, 5.04709125e-01, 5.05723178e-01, 5.06760955e-01, + 5.07828474e-01, 5.08931518e-01, 5.10075927e-01, 5.11267185e-01, + 5.12510598e-01, 5.13811469e-01, 5.15174806e-01, 5.16605377e-01, + 5.18107831e-01, 5.19686580e-01, 5.21345973e-01, 5.23089945e-01, + 5.24922311e-01, 5.26846766e-01, 5.28866649e-01, 5.30985177e-01, + 5.33205211e-01, 5.35529494e-01, 5.37960529e-01, 5.40500462e-01, + 5.43151379e-01, 5.45914948e-01, 5.48792660e-01, 5.51785827e-01, + 5.54895282e-01, 5.58121800e-01, 5.61465800e-01, 5.64927518e-01, + 5.68506777e-01, 5.72203338e-01, 5.76016545e-01, 5.79945564e-01, + 5.83989203e-01, 5.88146091e-01, 5.92414677e-01, 5.96792936e-01, + 6.01278901e-01, 6.05870068e-01, 6.10563993e-01, 6.15357757e-01, + 6.20248437e-01, 6.25232756e-01, 6.30307317e-01, 6.35468543e-01, + 6.40712619e-01, 6.46035612e-01, 6.51433527e-01, 6.56902015e-01, + 6.62436843e-01, 6.68033481e-01, 6.73687398e-01, 6.79393888e-01, + 6.85148239e-01, 6.90945625e-01, 6.96781278e-01, 7.02650130e-01, + 7.08547413e-01, 7.14468122e-01, 7.20407307e-01, 7.26359963e-01, + 7.32321203e-01, 7.38286138e-01, 7.44249880e-01, 7.50207603e-01, + 7.56154597e-01, 7.62086034e-01, 7.67997444e-01, 7.73884177e-01, + 7.79741824e-01, 7.85566032e-01, 7.91352570e-01, 7.97097266e-01, + 8.02796185e-01, 8.08445334e-01, 8.14041018e-01, 8.19579542e-01, + 8.25057447e-01, 8.30471396e-01, 8.35818112e-01, 8.41094613e-01, + 8.46297920e-01, 8.51425231e-01, 8.56473923e-01, 8.61441612e-01, + 8.66325855e-01, 8.71124566e-01, 8.75835657e-01, 8.80457282e-01, + 8.84987772e-01, 8.89425457e-01, 8.93768966e-01, 8.98017049e-01, + 9.02168512e-01, 9.06222403e-01, 9.10177886e-01, 9.14034188e-01, + 9.17790771e-01, 9.21447217e-01, 9.25003231e-01, 9.28458691e-01, + 9.31813419e-01, 9.35067594e-01, 9.38221455e-01, 9.41275299e-01, + 9.44229603e-01, 9.47084904e-01, 9.49841976e-01, 9.52501595e-01, + 9.55064654e-01, 9.57532167e-01, 9.59905326e-01, 9.62185323e-01, + 9.64373529e-01, 9.66471374e-01, 9.68480289e-01, 9.70402002e-01, + 9.72238123e-01, 9.73990440e-01, 9.75660801e-01, 9.77251112e-01, + 9.78763342e-01, 9.80199575e-01, 9.81561780e-01, 9.82852161e-01, + 9.84072864e-01, 9.85226095e-01, 9.86314118e-01, 9.87339139e-01, + 9.88303483e-01, 9.89209354e-01, 9.90059078e-01, 9.90854919e-01, + 9.91599143e-01, 9.92294014e-01, 9.92941797e-01, 9.93544638e-01, + 9.94104803e-01, 9.94624376e-01, 9.95105505e-01, 9.95550215e-01, + 9.95960534e-01, 9.96338427e-01, 9.96685863e-01, 9.97004628e-01, + 9.97296572e-01, 9.97563362e-01, 9.97806728e-01, 9.98028338e-01, + 9.98229563e-01, 9.98412073e-01, 9.98577118e-01, 9.98726189e-01, + 9.98860478e-01, 9.98981178e-01, 9.99089479e-01, 9.99186397e-01, + 9.99273062e-01, 9.99350369e-01, 9.99419153e-01, 9.99480307e-01, + 9.99534547e-01, 9.99582708e-01, 9.99625325e-01, 9.99663055e-01, + 9.99696434e-01, 9.99726057e-01, 9.99752283e-01, 9.99775589e-01, + 9.99796331e-01, 9.99814928e-01, 9.99831557e-01, 9.99846578e-01, + 9.99860287e-01, 9.99872804e-01, 9.99884307e-01, 9.99895036e-01, + 9.99905109e-01, 9.99914587e-01, 9.99923646e-01, 9.99932408e-01, + 9.99940872e-01, 9.99949098e-01, 9.99957144e-01, 9.99965072e-01, + 9.99972939e-01, 9.99980748e-01, 9.99988437e-01, 9.99996126e-01, + 1.00000381e+00, 1.00001144e+00, 1.00001907e+00, 1.00002670e+00, + 1.00003433e+00, 1.00004184e+00, 1.00004935e+00, 1.00005686e+00, + 1.00006437e+00, 1.00007176e+00, 1.00007904e+00, 1.00008631e+00, + 1.00009358e+00, 1.00010073e+00, 1.00010777e+00, 1.00011480e+00, + 1.00012159e+00, 1.00012839e+00, 1.00013518e+00, 1.00014174e+00, + 1.00014830e+00, 1.00015461e+00, 1.00016093e+00, 1.00016701e+00, + 1.00017309e+00, 1.00017893e+00, 1.00018466e+00, 1.00019026e+00, + 1.00019574e+00, 1.00020099e+00, 1.00020623e+00, 1.00021124e+00, + 1.00021613e+00, 1.00022078e+00, 1.00022531e+00, 1.00022972e+00, + 1.00023389e+00, 1.00023794e+00, 1.00024176e+00, 1.00024545e+00, + 1.00024891e+00, 1.00025225e+00, 1.00025535e+00, 1.00025833e+00, + 1.00026107e+00, 1.00026357e+00, 1.00026596e+00, 1.00026822e+00, + 1.00027013e+00, 1.00027204e+00, 1.00027359e+00, 1.00027502e+00, + 1.00027621e+00, 1.00027728e+00, 1.00027812e+00, 1.00027883e+00, + 1.00027919e+00, 1.00027955e+00, 1.00027955e+00, 1.00027943e+00, + 1.00027919e+00, 1.00027859e+00, 1.00027800e+00, 1.00027704e+00, + 1.00027597e+00, 1.00027478e+00, 1.00027335e+00, 1.00027168e+00, + 1.00026989e+00, 1.00026786e+00, 1.00026572e+00, 1.00026345e+00, + 1.00026095e+00, 1.00025821e+00, 1.00025535e+00, 1.00025237e+00, + 1.00024927e+00, 1.00024593e+00, 1.00024235e+00, 1.00023878e+00, + 1.00023496e+00, 1.00023091e+00, 1.00022686e+00, 1.00022256e+00, + 1.00021827e+00, 1.00021374e+00, 1.00020909e+00, 1.00020421e+00, + 1.00019932e+00, 1.00019431e+00, 1.00018907e+00, 1.00018382e+00, + 1.00017846e+00, 1.00017297e+00, 1.00016737e+00, 1.00016165e+00, + 1.00015581e+00, 1.00014985e+00, 1.00014389e+00, 1.00013781e+00, + 1.00013161e+00, 1.00012529e+00, 1.00011897e+00, 1.00011253e+00, + 1.00010610e+00, 1.00009954e+00, 1.00009298e+00, 1.00008631e+00, + 1.00007963e+00, 1.00007284e+00, 1.00006604e+00, 1.00005913e+00, + 1.00005233e+00, 1.00004542e+00, 1.00003850e+00, 1.00003147e+00, + 1.00002456e+00, 1.00001752e+00, 1.00001049e+00, 1.00000346e+00, + 9.99996483e-01, 9.99989510e-01, 9.99982476e-01, 9.99975502e-01, + 9.99968529e-01, 9.99961555e-01, 9.99954641e-01, 9.99947727e-01, + 9.99940813e-01, 9.99933958e-01, 9.99927163e-01, 9.99920428e-01, + 9.99913692e-01, 9.99907076e-01, 9.99900460e-01, 9.99893904e-01, + 9.99887466e-01, 9.99881029e-01, 9.99874711e-01, 9.99868453e-01, + 9.99862254e-01, 9.99856174e-01, 9.99850154e-01, 9.99844253e-01, + 9.99838412e-01, 9.99832690e-01, 9.99827087e-01, 9.99821603e-01, + 9.99816179e-01, 9.99810934e-01, 9.99805748e-01, 9.99800682e-01, + 9.99795794e-01, 9.99791026e-01, 9.99786317e-01, 9.99781847e-01, + 9.99777436e-01, 9.99773204e-01, 9.99769092e-01, 9.99765158e-01, + 9.99761343e-01, 9.99757707e-01, 9.99754190e-01, 9.99750853e-01, + 9.99747694e-01, 9.99744654e-01, 9.99741852e-01, 9.99739170e-01, + 9.99736667e-01, 9.99734342e-01, 9.99732137e-01, 9.99730170e-01, + 9.99728382e-01, 9.99726772e-01, 9.99725342e-01, 9.99724090e-01, + 9.99723017e-01, 9.99722123e-01, 9.99721408e-01, 9.99720931e-01, + 9.99720633e-01, 9.99720514e-01, 9.99720573e-01, 9.99720812e-01, + 9.99721289e-01, 9.99721944e-01, 9.99722779e-01, 9.99723792e-01, + 9.99725044e-01, 9.99726474e-01, 9.99728084e-01, 9.99729872e-01, + 9.99731898e-01, 9.99734104e-01, 9.99736488e-01, 9.99739051e-01, + 9.99741793e-01, 9.99744713e-01, 9.99747872e-01, 9.99751151e-01, + 9.99754667e-01, 9.99758303e-01, 9.99762177e-01, 9.99766171e-01, + 9.99770403e-01, 9.99774754e-01, 9.99779284e-01, 9.99783993e-01, + 9.99788821e-01, 9.99793828e-01, 9.99799013e-01, 9.99804318e-01, + 9.99809742e-01, 9.99815404e-01, 9.99821126e-01, 9.99826968e-01, + 9.99832988e-01, 9.99839127e-01, 9.99845386e-01, 9.99851763e-01, + 9.99858260e-01, 9.99864876e-01, 9.99871552e-01, 9.99878347e-01, + 9.99885261e-01, 9.99892235e-01, 9.99899328e-01, 9.99906480e-01, + 9.99913692e-01, 9.99920964e-01, 9.99928296e-01, 9.99935687e-01, + 9.99943137e-01, 9.99950647e-01, 9.99958158e-01, 9.99965727e-01, + 9.99973297e-01, 9.99980927e-01, 9.99988556e-01, 9.99996185e-01, + 1.00000381e+00, 1.00001144e+00, 1.00001907e+00, 1.00002670e+00, + 1.00003433e+00, 1.00004184e+00, 1.00004935e+00, 1.00005686e+00, + 1.00006437e+00, 1.00007176e+00, 1.00007904e+00, 1.00008631e+00, + 1.00009358e+00, 1.00010073e+00, 1.00010777e+00, 1.00011480e+00, + 1.00012159e+00, 1.00012839e+00, 1.00013518e+00, 1.00014174e+00, + 1.00014830e+00, 1.00015461e+00, 1.00016093e+00, 1.00016701e+00, + 1.00017309e+00, 1.00017893e+00, 1.00018466e+00, 1.00019026e+00, + 1.00019574e+00, 1.00020099e+00, 1.00020623e+00, 1.00021124e+00, + 1.00021613e+00, 1.00022078e+00, 1.00022531e+00, 1.00022972e+00, + 1.00023389e+00, 1.00023794e+00, 1.00024176e+00, 1.00024545e+00, + 1.00024891e+00, 1.00025225e+00, 1.00025535e+00, 1.00025833e+00, + 1.00026107e+00, 1.00026357e+00, 1.00026596e+00, 1.00026822e+00, + 1.00027013e+00, 1.00027204e+00, 1.00027359e+00, 1.00027502e+00, + 1.00027621e+00, 1.00027728e+00, 1.00027812e+00, 1.00027883e+00, + 1.00027919e+00, 1.00027955e+00, 1.00027955e+00, 1.00027943e+00, + 1.00027919e+00, 1.00027859e+00, 1.00027800e+00, 1.00027704e+00, + 1.00027597e+00, 1.00027478e+00, 1.00027335e+00, 1.00027168e+00, + 1.00026989e+00, 1.00026786e+00, 1.00026572e+00, 1.00026345e+00, + 1.00026095e+00, 1.00025821e+00, 1.00025535e+00, 1.00025237e+00, + 1.00024927e+00, 1.00024593e+00, 1.00024235e+00, 1.00023878e+00, + 1.00023496e+00, 1.00023091e+00, 1.00022686e+00, 1.00022256e+00, + 1.00021827e+00, 1.00021374e+00, 1.00020909e+00, 1.00020421e+00, + 1.00019932e+00, 1.00019431e+00, 1.00018907e+00, 1.00018382e+00, + 1.00017846e+00, 1.00017297e+00, 1.00016737e+00, 1.00016165e+00, + 1.00015581e+00, 1.00014985e+00, 1.00014389e+00, 1.00013781e+00, + 1.00013161e+00, 1.00012529e+00, 1.00011897e+00, 1.00011253e+00, + 1.00010610e+00, 1.00009954e+00, 1.00009298e+00, 1.00008631e+00, + 1.00007963e+00, 1.00007284e+00, 1.00006604e+00, 1.00005913e+00, + 1.00005233e+00, 1.00004542e+00, 1.00003850e+00, 1.00003147e+00, + 1.00002456e+00, 1.00001752e+00, 1.00001049e+00, 1.00000346e+00, + 9.99996483e-01, 9.99989510e-01, 9.99982476e-01, 9.99975502e-01, + 9.99968529e-01, 9.99961555e-01, 9.99954641e-01, 9.99947727e-01, + 9.99940813e-01, 9.99933958e-01, 9.99927163e-01, 9.99920428e-01, + 9.99913692e-01, 9.99907076e-01, 9.99900460e-01, 9.99893904e-01, + 9.99887466e-01, 9.99881029e-01, 9.99874711e-01, 9.99868453e-01, + 9.99862254e-01, 9.99856174e-01, 9.99850154e-01, 9.99844253e-01, + 9.99838412e-01, 9.99832690e-01, 9.99827087e-01, 9.99821603e-01, + 9.99816179e-01, 9.99810934e-01, 9.99805748e-01, 9.99800682e-01, + 9.99795794e-01, 9.99791026e-01, 9.99786317e-01, 9.99781847e-01, + 9.99777436e-01, 9.99773204e-01, 9.99769092e-01, 9.99765158e-01, + 9.99761343e-01, 9.99757707e-01, 9.99754190e-01, 9.99750853e-01, + 9.99747694e-01, 9.99744654e-01, 9.99741852e-01, 9.99739170e-01, + 9.99736667e-01, 9.99734342e-01, 9.99732137e-01, 9.99730170e-01, + 9.99728382e-01, 9.99726772e-01, 9.99725342e-01, 9.99724090e-01, + 9.99723017e-01, 9.99722123e-01, 9.99721408e-01, 9.99720931e-01, + 9.99720633e-01, 9.99720514e-01, 9.99720573e-01, 9.99720812e-01, + 9.99721289e-01, 9.99721944e-01, 9.99722779e-01, 9.99723792e-01, + 9.99725044e-01, 9.99726474e-01, 9.99728084e-01, 9.99729872e-01, + 9.99731898e-01, 9.99734104e-01, 9.99736488e-01, 9.99739051e-01, + 9.99741793e-01, 9.99744713e-01, 9.99747872e-01, 9.99751151e-01, + 9.99754667e-01, 9.99758303e-01, 9.99762177e-01, 9.99766171e-01, + 9.99770403e-01, 9.99774754e-01, 9.99779284e-01, 9.99783993e-01, + 9.99788821e-01, 9.99793828e-01, 9.99799013e-01, 9.99804318e-01, + 9.99809742e-01, 9.99815404e-01, 9.99821126e-01, 9.99826968e-01, + 9.99832988e-01, 9.99839127e-01, 9.99845386e-01, 9.99851763e-01, + 9.99858260e-01, 9.99864876e-01, 9.99871552e-01, 9.99878347e-01, + 9.99885261e-01, 9.99892235e-01, 9.99899328e-01, 9.99906480e-01, + 9.99913692e-01, 9.99920964e-01, 9.99928296e-01, 9.99935687e-01, + 9.99943137e-01, 9.99950647e-01, 9.99958158e-01, 9.99965727e-01, + 9.99973297e-01, 9.99980927e-01, 9.99988556e-01, 9.99996185e-01, + 1.00000381e+00, 1.00001144e+00, 1.00001907e+00, 1.00002670e+00, + 1.00003433e+00, 1.00004184e+00, 1.00004935e+00, 1.00005686e+00, + 1.00006437e+00, 1.00007176e+00, 1.00007904e+00, 1.00008631e+00, + 1.00009358e+00, 1.00010073e+00, 1.00010777e+00, 1.00011480e+00, + 1.00012159e+00, 1.00012839e+00, 1.00013518e+00, 1.00014174e+00, + 1.00014830e+00, 1.00015461e+00, 1.00016093e+00, 1.00016701e+00, + 1.00017309e+00, 1.00017893e+00, 1.00018466e+00, 1.00019026e+00, + 1.00019574e+00, 1.00020099e+00, 1.00020623e+00, 1.00021124e+00, + 1.00021613e+00, 1.00022078e+00, 1.00022531e+00, 1.00022972e+00, + 1.00023389e+00, 1.00023794e+00, 1.00024176e+00, 1.00024545e+00, + 1.00024891e+00, 1.00025225e+00, 1.00025535e+00, 1.00025833e+00, + 1.00026107e+00, 1.00026357e+00, 1.00026596e+00, 1.00026822e+00, + 1.00027013e+00, 1.00027204e+00, 1.00027359e+00, 1.00027502e+00, + 1.00027621e+00, 1.00027728e+00, 1.00027812e+00, 1.00027883e+00, + 1.00027919e+00, 1.00027955e+00, 1.00027955e+00, 1.00027943e+00, + 1.00027919e+00, 1.00027859e+00, 1.00027800e+00, 1.00027704e+00, + 1.00027597e+00, 1.00027478e+00, 1.00027335e+00, 1.00027168e+00, + 1.00026989e+00, 1.00026786e+00, 1.00026572e+00, 1.00026345e+00, + 1.00026095e+00, 1.00025821e+00, 1.00025535e+00, 1.00025237e+00, + 1.00024927e+00, 1.00024593e+00, 1.00024235e+00, 1.00023878e+00, + 1.00023496e+00, 1.00023091e+00, 1.00022686e+00, 1.00022256e+00, + 1.00021827e+00, 1.00021374e+00, 1.00020909e+00, 1.00020421e+00, + 1.00019932e+00, 1.00019431e+00, 1.00018907e+00, 1.00018382e+00, + 1.00017846e+00, 1.00017297e+00, 1.00016737e+00, 1.00016165e+00, + 1.00015581e+00, 1.00014985e+00, 1.00014389e+00, 1.00013781e+00, + 1.00013161e+00, 1.00012529e+00, 1.00011897e+00, 1.00011253e+00, + 1.00010610e+00, 1.00009954e+00, 1.00009298e+00, 1.00008631e+00, + 1.00007963e+00, 1.00007284e+00, 1.00006604e+00, 1.00005913e+00, + 1.00005233e+00, 1.00004542e+00, 1.00003850e+00, 1.00003147e+00, + 1.00002456e+00, 1.00001752e+00, 1.00001049e+00, 1.00000346e+00, + 9.99996483e-01, 9.99989510e-01, 9.99982476e-01, 9.99975502e-01, + 9.99968529e-01, 9.99961555e-01, 9.99954641e-01, 9.99947727e-01, + 9.99940813e-01, 9.99933958e-01, 9.99927163e-01, 9.99920428e-01, + 9.99913692e-01, 9.99907076e-01, 9.99900460e-01, 9.99893904e-01, + 9.99887466e-01, 9.99881029e-01, 9.99874711e-01, 9.99868453e-01, + 9.99862254e-01, 9.99856174e-01, 9.99850154e-01, 9.99844253e-01, + 9.99838412e-01, 9.99832690e-01, 9.99827087e-01, 9.99821603e-01, + 9.99816179e-01, 9.99810934e-01, 9.99805748e-01, 9.99800682e-01, + 9.99795794e-01, 9.99791026e-01, 9.99786317e-01, 9.99781847e-01, + 9.99777436e-01, 9.99773204e-01, 9.99769092e-01, 9.99765158e-01, + 9.99761343e-01, 9.99757707e-01, 9.99754190e-01, 9.99750853e-01, + 9.99747694e-01, 9.99744654e-01, 9.99741852e-01, 9.99739170e-01, + 9.99736667e-01, 9.99734342e-01, 9.99732137e-01, 9.99730170e-01, + 9.99728382e-01, 9.99726772e-01, 9.99725342e-01, 9.99724090e-01, + 9.99723017e-01, 9.99722123e-01, 9.99721408e-01, 9.99720931e-01, + 9.99720633e-01, 9.99720514e-01, 9.99720573e-01, 9.99720812e-01, + 9.99721289e-01, 9.99721944e-01, 9.99722779e-01, 9.99723792e-01, + 9.99725044e-01, 9.99726474e-01, 9.99728084e-01, 9.99729872e-01, + 9.99731898e-01, 9.99734104e-01, 9.99736488e-01, 9.99739051e-01, + 9.99741793e-01, 9.99744713e-01, 9.99747872e-01, 9.99751151e-01, + 9.99754667e-01, 9.99758303e-01, 9.99762177e-01, 9.99766171e-01, + 9.99770403e-01, 9.99774754e-01, 9.99779284e-01, 9.99783993e-01, + 9.99788821e-01, 9.99793828e-01, 9.99799013e-01, 9.99804318e-01, + 9.99809742e-01, 9.99815404e-01, 9.99821126e-01, 9.99826968e-01, + 9.99832988e-01, 9.99839127e-01, 9.99845386e-01, 9.99851763e-01, + 9.99858260e-01, 9.99864876e-01, 9.99871552e-01, 9.99878347e-01, + 9.99885261e-01, 9.99892235e-01, 9.99899328e-01, 9.99906480e-01, + 9.99913692e-01, 9.99920964e-01, 9.99928296e-01, 9.99935687e-01, + 9.99943137e-01, 9.99950647e-01, 9.99958158e-01, 9.99965727e-01, + 9.99973297e-01, 9.99980927e-01, 9.99988556e-01, 9.99996185e-01, + 1.00000381e+00, 1.00001132e+00, 1.00001884e+00, 1.00002635e+00, + 1.00003362e+00, 1.00004077e+00, 1.00004780e+00, 1.00005460e+00, + 1.00006104e+00, 1.00006711e+00, 1.00007272e+00, 1.00007772e+00, + 1.00008214e+00, 1.00008571e+00, 1.00008833e+00, 1.00008976e+00, + 1.00008988e+00, 1.00008845e+00, 1.00008512e+00, 1.00007975e+00, + 1.00007200e+00, 1.00006139e+00, 1.00004768e+00, 1.00003028e+00, + 1.00000894e+00, 9.99982893e-01, 9.99951661e-01, 9.99914646e-01, + 9.99871135e-01, 9.99820411e-01, 9.99761701e-01, 9.99694109e-01, + 9.99616742e-01, 9.99528646e-01, 9.99428689e-01, 9.99315858e-01, + 9.99188840e-01, 9.99046445e-01, 9.98887360e-01, 9.98710036e-01, + 9.98513043e-01, 9.98294711e-01, 9.98053491e-01, 9.97787535e-01, + 9.97494996e-01, 9.97173846e-01, 9.96822178e-01, 9.96437728e-01, + 9.96018291e-01, 9.95561540e-01, 9.95064974e-01, 9.94526088e-01, + 9.93942142e-01, 9.93310452e-01, 9.92628038e-01, 9.91891921e-01, + 9.91099000e-01, 9.90245998e-01, 9.89329517e-01, 9.88346159e-01, + 9.87292290e-01, 9.86164153e-01, 9.84957933e-01, 9.83669639e-01, + 9.82295156e-01, 9.80830312e-01, 9.79270697e-01, 9.77612019e-01, + 9.75849628e-01, 9.73978817e-01, 9.71994996e-01, 9.69893157e-01, + 9.67668533e-01, 9.65315938e-01, 9.62830484e-01, 9.60206985e-01, + 9.57440197e-01, 9.54525113e-01, 9.51456368e-01, 9.48228836e-01, + 9.44837391e-01, 9.41276729e-01, 9.37541902e-01, 9.33627844e-01, + 9.29529607e-01, 9.25242424e-01, 9.20761466e-01, 9.16082382e-01, + 9.11200643e-01, 9.06112134e-01, 9.00812864e-01, 8.95299196e-01, + 8.89567554e-01, 8.83614719e-01, 8.77437830e-01, 8.71034324e-01, + 8.64401877e-01, 8.57538521e-01, 8.50442827e-01, 8.43113542e-01, + 8.35549891e-01, 8.27751517e-01, 8.19718421e-01, 8.11451137e-01, + 8.02950621e-01, 7.94218183e-01, 7.85255671e-01, 7.76065350e-01, + 7.66650081e-01, 7.57013023e-01, 7.47157931e-01, 7.37088978e-01, + 7.26810873e-01, 7.16328681e-01, 7.05648124e-01, 6.94775164e-01, + 6.83716357e-01, 6.72478795e-01, 6.61069810e-01, 6.49497330e-01, + 6.37769580e-01, 6.25895321e-01, 6.13883674e-01, 6.01744056e-01, + 5.89486361e-01, 5.77120781e-01, 5.64657867e-01, 5.52108407e-01, + 5.39483547e-01, 5.26794672e-01, 5.14053404e-01, 5.01271665e-01, + 4.88461435e-01, 4.75634992e-01, 4.62804615e-01, 4.49982822e-01, + 4.37182158e-01, 4.24415171e-01, 4.11694527e-01, 3.99032772e-01, + 3.86442453e-01, 3.73936087e-01, 3.61525953e-01, 3.49224269e-01, + 3.37043047e-01, 3.24994087e-01, 3.13088894e-01, 3.01338732e-01, + 2.89754450e-01, 2.78346658e-01, 2.67125458e-01, 2.56100595e-01, + 2.45281324e-01, 2.34676436e-01, 2.24294156e-01, 2.14142203e-01, + 2.04227716e-01, 1.94557235e-01, 1.85136691e-01, 1.75971389e-01, + 1.67065978e-01, 1.58424467e-01, 1.50050193e-01, 1.41945809e-01, + 1.34113312e-01, 1.26554012e-01, 1.19268581e-01, 1.12257004e-01, + 1.05518632e-01, 9.90521908e-02, 9.28557739e-02, 8.69268849e-02, + 8.12624842e-02, 7.58589506e-02, 7.07121640e-02, 6.58175275e-02, + 6.11699894e-02, 5.67640625e-02, 5.25939018e-02, 4.86532971e-02, + 4.49357443e-02, 4.14344519e-02, 3.81424055e-02, 3.50523964e-02, + 3.21570449e-02, 2.94488575e-02, 2.69202497e-02, 2.45635863e-02, + 2.23712083e-02, 2.03354694e-02, 1.84487645e-02, 1.67035554e-02, + 1.50924018e-02, 1.36079816e-02, 1.22431125e-02, 1.09907771e-02, + 9.84413363e-03, 8.79654102e-03, 7.84156192e-03, 6.97298534e-03, + 6.18482940e-03, 5.47135156e-03, 4.82705561e-03, 4.24669450e-03, + 3.72527563e-03, 3.25805834e-03, 2.84055714e-03, 2.46853800e-03, + 2.13801605e-03, 1.84525200e-03, 1.58674677e-03, 1.35923503e-03, + 1.15967961e-03, 9.85263032e-04, 8.33379803e-04, 7.01628160e-04, + 5.87800692e-04, 4.89875500e-04, 4.06006613e-04, 3.34514218e-04, + 2.73875427e-04, 2.22714254e-04, 1.79792376e-04, 1.43999539e-04, + 1.14344395e-04, 8.99455481e-05, 7.00227974e-05, 5.38887325e-05, + 4.09407221e-05, 3.06531692e-05, 2.25702297e-05, 1.62988836e-05, + 1.15024377e-05, 7.89443584e-06, 5.23298331e-06, 3.31548563e-06, + 1.97379018e-06, 1.06971811e-06, 4.90905393e-07, 1.46209757e-07, +}; + +#endif /* LC3_PLUS_HR */ + #undef __LC3_MDCT_WIN_LEN const float *lc3_mdct_win[LC3_NUM_DT][LC3_NUM_SRATE] = { -#if !LC3_NPLUS - [LC3_DT_2M5] = { - [LC3_SRATE_8K ] = mdct_win_2m5_8k, - [LC3_SRATE_16K] = mdct_win_2m5_16k, - [LC3_SRATE_24K] = mdct_win_2m5_24k, - [LC3_SRATE_32K] = mdct_win_2m5_32k, - [LC3_SRATE_48K] = mdct_win_2m5_48k, - }, + LC3_IF_PLUS( mdct_win_2m5_8k , NULL ), + LC3_IF_PLUS( mdct_win_2m5_16k, NULL ), + LC3_IF_PLUS( mdct_win_2m5_24k, NULL ), + LC3_IF_PLUS( mdct_win_2m5_32k, NULL ), + LC3_IF_PLUS( mdct_win_2m5_48k, NULL ), + LC3_IF_PLUS( LC3_IF_PLUS_HR( mdct_win_2m5_48k_hr, NULL ), NULL ), + LC3_IF_PLUS( LC3_IF_PLUS_HR( mdct_win_2m5_96k_hr, NULL ), NULL ) }, - [LC3_DT_5M] = { - [LC3_SRATE_8K ] = mdct_win_5m_8k, - [LC3_SRATE_16K] = mdct_win_5m_16k, - [LC3_SRATE_24K] = mdct_win_5m_24k, - [LC3_SRATE_32K] = mdct_win_5m_32k, - [LC3_SRATE_48K] = mdct_win_5m_48k, - }, - -#endif /* !LC3_NPLUS */ + [LC3_DT_5M ] = { + LC3_IF_PLUS( mdct_win_5m_8k , NULL ), + LC3_IF_PLUS( mdct_win_5m_16k, NULL ), + LC3_IF_PLUS( mdct_win_5m_24k, NULL ), + LC3_IF_PLUS( mdct_win_5m_32k, NULL ), + LC3_IF_PLUS( mdct_win_5m_48k, NULL ), + LC3_IF_PLUS( LC3_IF_PLUS_HR( mdct_win_5m_48k_hr, NULL ), NULL ), + LC3_IF_PLUS( LC3_IF_PLUS_HR( mdct_win_5m_96k_hr, NULL ), NULL ) }, [LC3_DT_7M5] = { - [LC3_SRATE_8K ] = mdct_win_7m5_8k, - [LC3_SRATE_16K] = mdct_win_7m5_16k, - [LC3_SRATE_24K] = mdct_win_7m5_24k, - [LC3_SRATE_32K] = mdct_win_7m5_32k, - [LC3_SRATE_48K] = mdct_win_7m5_48k, - }, + mdct_win_7m5_8k , mdct_win_7m5_16k, mdct_win_7m5_24k, + mdct_win_7m5_32k, mdct_win_7m5_48k }, [LC3_DT_10M] = { - [LC3_SRATE_8K ] = mdct_win_10m_8k, - [LC3_SRATE_16K] = mdct_win_10m_16k, - [LC3_SRATE_24K] = mdct_win_10m_24k, - [LC3_SRATE_32K] = mdct_win_10m_32k, - [LC3_SRATE_48K] = mdct_win_10m_48k, - }, + mdct_win_10m_8k , mdct_win_10m_16k, mdct_win_10m_24k, + mdct_win_10m_32k, mdct_win_10m_48k, + LC3_IF_PLUS_HR( mdct_win_10m_48k_hr, NULL), + LC3_IF_PLUS_HR( mdct_win_10m_96k_hr, NULL), }, }; @@ -2537,22 +4072,22 @@ const float *lc3_mdct_win[LC3_NUM_DT][LC3_NUM_SRATE] = { * Bands limits */ -#if !LC3_NPLUS +#if LC3_PLUS -static const uint16_t band_lim_2m5_8k[] = { +static const int band_lim_2m5_8k[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 }; -static const uint16_t band_lim_2m5_16k[] = { +static const int band_lim_2m5_16k[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 32, 34, 36, 38, 40 }; -static const uint16_t band_lim_2m5_24k[] = { +static const int band_lim_2m5_24k[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 28, 30, 32, @@ -2560,7 +4095,7 @@ static const uint16_t band_lim_2m5_24k[] = { 60 }; -static const uint16_t band_lim_2m5_32k[] = { +static const int band_lim_2m5_32k[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 28, 30, 32, 34, @@ -2568,7 +4103,7 @@ static const uint16_t band_lim_2m5_32k[] = { 67, 71, 75, 80 }; -static const uint16_t band_lim_2m5_48k[] = { +static const int band_lim_2m5_48k[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 25, 27, 29, 31, 33, 35, 37, @@ -2576,14 +4111,34 @@ static const uint16_t band_lim_2m5_48k[] = { 77, 82, 87, 93, 100 }; -static const uint16_t band_lim_5m_8k[] = { +#if LC3_PLUS_HR + +static const int band_lim_2m5_48k_hr[] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 21, 23, 25, 27, 29, 31, 33, 35, 37, 40, + 43, 46, 49, 53, 57, 61, 65, 69, 74, 79, + 85, 91, 97, 104, 112, 120 +}; + +static const int band_lim_2m5_96k_hr[] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 18, 20, 22, + 24, 26, 28, 30, 32, 35, 38, 41, 45, 49, + 53, 57, 62, 67, 73, 79, 85, 92, 100, 108, + 117, 127, 137, 149, 161, 174, 189, 204, 221, 240 +}; + +#endif /* LC3_PLUS_HR */ + +static const int band_lim_5m_8k[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 40 }; -static const uint16_t band_lim_5m_16k[] = { +static const int band_lim_5m_16k[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, @@ -2592,7 +4147,7 @@ static const uint16_t band_lim_5m_16k[] = { 80 }; -static const uint16_t band_lim_5m_24k[] = { +static const int band_lim_5m_24k[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 28, 30, 32, 34, @@ -2601,7 +4156,7 @@ static const uint16_t band_lim_5m_24k[] = { 107, 113, 120 }; -static const uint16_t band_lim_5m_32k[] = { +static const int band_lim_5m_32k[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 24, 26, 28, 30, 32, 34, 36, @@ -2610,7 +4165,7 @@ static const uint16_t band_lim_5m_32k[] = { 126, 134, 142, 151, 160 }; -static const uint16_t band_lim_5m_48k[] = { +static const int band_lim_5m_48k[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 25, 27, 29, 31, 33, 35, 37, @@ -2619,9 +4174,30 @@ static const uint16_t band_lim_5m_48k[] = { 145, 155, 165, 176, 187, 200 }; -#endif /* !LC3_NPLUS */ +#if LC3_PLUS_HR -static const uint16_t band_lim_7m5_8k[] = { +static const int band_lim_5m_48k_hr[] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 21, 23, 25, 27, 29, 31, 33, 35, 38, 41, + 44, 47, 50, 54, 58, 62, 66, 71, 76, 81, + 87, 93, 100, 107, 114, 122, 131, 140, 149, 160, + 171, 183, 196, 209, 224, 240 +}; + +static const int band_lim_5m_96k_hr[] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 19, 21, + 23, 25, 27, 29, 31, 34, 37, 40, 44, 48, + 52, 56, 61, 66, 71, 77, 83, 90, 98, 106, + 115, 124, 135, 146, 158, 171, 185, 200, 217, 235, + 254, 275, 298, 323, 349, 378, 409, 443, 480 +}; + +#endif /* LC3_PLUS_HR */ +#endif /* LC3_PLUS */ + +static const int band_lim_7m5_8k[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, @@ -2631,7 +4207,7 @@ static const uint16_t band_lim_7m5_8k[] = { 60 }; -static const uint16_t band_lim_7m5_16k[] = { +static const int band_lim_7m5_16k[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, @@ -2641,7 +4217,7 @@ static const uint16_t band_lim_7m5_16k[] = { 102, 106, 110, 115, 120 }; -static const uint16_t band_lim_7m5_24k[] = { +static const int band_lim_7m5_24k[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 29, 31, @@ -2651,7 +4227,7 @@ static const uint16_t band_lim_7m5_24k[] = { 148, 155, 163, 171, 180 }; -static const uint16_t band_lim_7m5_32k[] = { +static const int band_lim_7m5_32k[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 28, 30, 32, 34, @@ -2661,7 +4237,7 @@ static const uint16_t band_lim_7m5_32k[] = { 192, 203, 215, 227, 240 }; -static const uint16_t band_lim_7m5_48k[] = { +static const int band_lim_7m5_48k[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 24, 26, 28, 30, 32, 34, 36, @@ -2671,7 +4247,7 @@ static const uint16_t band_lim_7m5_48k[] = { 236, 251, 266, 283, 300 }; -static const uint16_t band_lim_10m_8k[] = { +static const int band_lim_10m_8k[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, @@ -2681,7 +4257,7 @@ static const uint16_t band_lim_10m_8k[] = { 71, 73, 75, 77, 80 }; -static const uint16_t band_lim_10m_16k[] = { +static const int band_lim_10m_16k[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 30, @@ -2691,7 +4267,7 @@ static const uint16_t band_lim_10m_16k[] = { 133, 139, 146, 153, 160 }; -static const uint16_t band_lim_10m_24k[] = { +static const int band_lim_10m_24k[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 25, 27, 29, 31, 33, 35, @@ -2701,7 +4277,7 @@ static const uint16_t band_lim_10m_24k[] = { 193, 204, 215, 227, 240 }; -static const uint16_t band_lim_10m_32k[] = { +static const int band_lim_10m_32k[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, @@ -2711,7 +4287,7 @@ static const uint16_t band_lim_10m_32k[] = { 252, 268, 284, 302, 320 }; -static const uint16_t band_lim_10m_48k[] = { +static const int band_lim_10m_48k[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 39, 42, @@ -2721,43 +4297,59 @@ static const uint16_t band_lim_10m_48k[] = { 310, 330, 352, 375, 400 }; -const uint16_t *lc3_band_lim[LC3_NUM_DT][LC3_NUM_SRATE] = { +#if LC3_PLUS_HR -#if !LC3_NPLUS +static const int band_lim_10m_48k_hr[] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 19, 21, + 23, 25, 27, 29, 31, 33, 36, 39, 42, 45, + 48, 51, 55, 59, 63, 67, 72, 77, 83, 89, + 95, 101, 108, 116, 124, 133, 142, 152, 163, 174, + 187, 200, 214, 229, 244, 262, 280, 299, 320, 343, + 367, 392, 419, 449, 480 +}; + +static const int band_lim_10m_96k_hr[] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8 , 9, + 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, + 28, 30, 33, 36, 39, 42, 46, 50, 54, 59, + 64, 69, 75, 82, 89, 96, 104, 113, 122, 132, + 143, 155, 168, 181, 196, 213, 230, 249, 270, 292, + 316, 342, 371, 401, 434, 470, 509, 551, 596, 646, + 699, 757, 819, 887, 960 +}; + +#endif /* LC3_PLUS_HR */ + +const int *lc3_band_lim[LC3_NUM_DT][LC3_NUM_SRATE] = { [LC3_DT_2M5] = { - [LC3_SRATE_8K ] = band_lim_2m5_8k, - [LC3_SRATE_16K] = band_lim_2m5_16k, - [LC3_SRATE_24K] = band_lim_2m5_24k, - [LC3_SRATE_32K] = band_lim_2m5_32k, - [LC3_SRATE_48K] = band_lim_2m5_48k, - }, + LC3_IF_PLUS( band_lim_2m5_8k , NULL ), + LC3_IF_PLUS( band_lim_2m5_16k, NULL ), + LC3_IF_PLUS( band_lim_2m5_24k, NULL ), + LC3_IF_PLUS( band_lim_2m5_32k, NULL ), + LC3_IF_PLUS( band_lim_2m5_48k, NULL ), + LC3_IF_PLUS( LC3_IF_PLUS_HR( band_lim_2m5_48k_hr, NULL ), NULL ), + LC3_IF_PLUS( LC3_IF_PLUS_HR( band_lim_2m5_96k_hr, NULL ), NULL ) }, [LC3_DT_5M] = { - [LC3_SRATE_8K ] = band_lim_5m_8k, - [LC3_SRATE_16K] = band_lim_5m_16k, - [LC3_SRATE_24K] = band_lim_5m_24k, - [LC3_SRATE_32K] = band_lim_5m_32k, - [LC3_SRATE_48K] = band_lim_5m_48k, - }, - -#endif /* !LC3_NPLUS */ + LC3_IF_PLUS( band_lim_5m_8k , NULL ), + LC3_IF_PLUS( band_lim_5m_16k, NULL ), + LC3_IF_PLUS( band_lim_5m_24k, NULL ), + LC3_IF_PLUS( band_lim_5m_32k, NULL ), + LC3_IF_PLUS( band_lim_5m_48k, NULL ), + LC3_IF_PLUS( LC3_IF_PLUS_HR( band_lim_5m_48k_hr, NULL ), NULL ), + LC3_IF_PLUS( LC3_IF_PLUS_HR( band_lim_5m_96k_hr, NULL ), NULL ) }, [LC3_DT_7M5] = { - [LC3_SRATE_8K ] = band_lim_7m5_8k, - [LC3_SRATE_16K] = band_lim_7m5_16k, - [LC3_SRATE_24K] = band_lim_7m5_24k, - [LC3_SRATE_32K] = band_lim_7m5_32k, - [LC3_SRATE_48K] = band_lim_7m5_48k, - }, + band_lim_7m5_8k , band_lim_7m5_16k, band_lim_7m5_24k, + band_lim_7m5_32k, band_lim_7m5_48k }, [LC3_DT_10M] = { - [LC3_SRATE_8K ] = band_lim_10m_8k, - [LC3_SRATE_16K] = band_lim_10m_16k, - [LC3_SRATE_24K] = band_lim_10m_24k, - [LC3_SRATE_32K] = band_lim_10m_32k, - [LC3_SRATE_48K] = band_lim_10m_48k, - }, + band_lim_10m_8k , band_lim_10m_16k, band_lim_10m_24k, + band_lim_10m_32k, band_lim_10m_48k, + LC3_IF_PLUS_HR( band_lim_10m_48k_hr, NULL ), + LC3_IF_PLUS_HR( band_lim_10m_96k_hr, NULL ) }, }; #define __LC3_NUM_BANDS(_lim) \ @@ -2765,43 +4357,47 @@ const uint16_t *lc3_band_lim[LC3_NUM_DT][LC3_NUM_SRATE] = { const int lc3_num_bands[LC3_NUM_DT][LC3_NUM_SRATE] = { -#if !LC3_NPLUS - [LC3_DT_2M5] = { - [LC3_SRATE_8K ] = __LC3_NUM_BANDS(band_lim_2m5_8k ), - [LC3_SRATE_16K] = __LC3_NUM_BANDS(band_lim_2m5_16k), - [LC3_SRATE_24K] = __LC3_NUM_BANDS(band_lim_2m5_24k), - [LC3_SRATE_32K] = __LC3_NUM_BANDS(band_lim_2m5_32k), - [LC3_SRATE_48K] = __LC3_NUM_BANDS(band_lim_2m5_48k), - }, + LC3_IF_PLUS( __LC3_NUM_BANDS( band_lim_2m5_8k ), 0 ), + LC3_IF_PLUS( __LC3_NUM_BANDS( band_lim_2m5_16k ), 0 ), + LC3_IF_PLUS( __LC3_NUM_BANDS( band_lim_2m5_24k ), 0 ), + LC3_IF_PLUS( __LC3_NUM_BANDS( band_lim_2m5_32k ), 0 ), + LC3_IF_PLUS( __LC3_NUM_BANDS( band_lim_2m5_48k ), 0 ), + LC3_IF_PLUS( LC3_IF_PLUS_HR( + __LC3_NUM_BANDS( band_lim_2m5_48k_hr ), 0 ), 0 ), + LC3_IF_PLUS( LC3_IF_PLUS_HR( + __LC3_NUM_BANDS( band_lim_2m5_96k_hr ), 0 ), 0 ) }, [LC3_DT_5M] = { - [LC3_SRATE_8K ] = __LC3_NUM_BANDS(band_lim_5m_8k ), - [LC3_SRATE_16K] = __LC3_NUM_BANDS(band_lim_5m_16k), - [LC3_SRATE_24K] = __LC3_NUM_BANDS(band_lim_5m_24k), - [LC3_SRATE_32K] = __LC3_NUM_BANDS(band_lim_5m_32k), - [LC3_SRATE_48K] = __LC3_NUM_BANDS(band_lim_5m_48k), - }, - -#endif /* !LC3_NPLUS */ + LC3_IF_PLUS( __LC3_NUM_BANDS( band_lim_5m_8k ), 0 ), + LC3_IF_PLUS( __LC3_NUM_BANDS( band_lim_5m_16k ), 0 ), + LC3_IF_PLUS( __LC3_NUM_BANDS( band_lim_5m_24k ), 0 ), + LC3_IF_PLUS( __LC3_NUM_BANDS( band_lim_5m_32k ), 0 ), + LC3_IF_PLUS( __LC3_NUM_BANDS( band_lim_5m_48k ), 0 ), + LC3_IF_PLUS( LC3_IF_PLUS_HR( + __LC3_NUM_BANDS( band_lim_5m_48k_hr ), 0 ), 0 ), + LC3_IF_PLUS( LC3_IF_PLUS_HR( + __LC3_NUM_BANDS( band_lim_5m_96k_hr ), 0 ), 0 ) }, [LC3_DT_7M5] = { - [LC3_SRATE_8K ] = __LC3_NUM_BANDS(band_lim_7m5_8k ), - [LC3_SRATE_16K] = __LC3_NUM_BANDS(band_lim_7m5_16k), - [LC3_SRATE_24K] = __LC3_NUM_BANDS(band_lim_7m5_24k), - [LC3_SRATE_32K] = __LC3_NUM_BANDS(band_lim_7m5_32k), - [LC3_SRATE_48K] = __LC3_NUM_BANDS(band_lim_7m5_48k), - }, + __LC3_NUM_BANDS( band_lim_7m5_8k ), + __LC3_NUM_BANDS( band_lim_7m5_16k ), + __LC3_NUM_BANDS( band_lim_7m5_24k ), + __LC3_NUM_BANDS( band_lim_7m5_32k ), + __LC3_NUM_BANDS( band_lim_7m5_48k ) }, [LC3_DT_10M] = { - [LC3_SRATE_8K ] = __LC3_NUM_BANDS(band_lim_10m_8k ), - [LC3_SRATE_16K] = __LC3_NUM_BANDS(band_lim_10m_16k), - [LC3_SRATE_24K] = __LC3_NUM_BANDS(band_lim_10m_24k), - [LC3_SRATE_32K] = __LC3_NUM_BANDS(band_lim_10m_32k), - [LC3_SRATE_48K] = __LC3_NUM_BANDS(band_lim_10m_48k), - }, + __LC3_NUM_BANDS( band_lim_10m_8k ), + __LC3_NUM_BANDS( band_lim_10m_16k ), + __LC3_NUM_BANDS( band_lim_10m_24k ), + __LC3_NUM_BANDS( band_lim_10m_32k ), + __LC3_NUM_BANDS( band_lim_10m_48k ), + LC3_IF_PLUS_HR( __LC3_NUM_BANDS( band_lim_10m_48k_hr ), 0 ), + LC3_IF_PLUS_HR( __LC3_NUM_BANDS( band_lim_10m_96k_hr ), 0 ) }, }; +#undef __LC3_NUM_BANDS + /** * SNS Quantization diff --git a/src/tables.h b/src/tables.h index 5377fd9..2dc7810 100644 --- a/src/tables.h +++ b/src/tables.h @@ -23,6 +23,72 @@ #include "bits.h" +/** + * Characteristics + * + * ns Number of temporal samples / frequency coefficients within a frame + * + * ne Number of encoded frequency coefficients + * + * nd Number of MDCT delayed samples, sum of half a frame and an ovelap + * of future by 1.25 ms (2.5ms, 5ms and 10ms frame durations), + * or 2 ms (7.5ms frame duration). + * + * nh Number of 18 ms samples of the history buffer, aligned on a frame + * + * nt Number of 1.25 ms previous samples + */ + +extern const int lc3_ns_2m5[LC3_NUM_SRATE]; +extern const int lc3_ne_2m5[LC3_NUM_SRATE]; +extern const int lc3_ns_4m [LC3_NUM_SRATE]; + +static inline int lc3_ns(enum lc3_dt dt, enum lc3_srate sr) { + return lc3_ns_2m5[sr] * (1 + dt); +} + +static inline int lc3_ne(enum lc3_dt dt, enum lc3_srate sr) { + return lc3_ne_2m5[sr] * (1 + dt); +} + +static inline int lc3_nd(enum lc3_dt dt, enum lc3_srate sr) { + return ( lc3_ns(dt, sr) + + (dt == LC3_DT_7M5 ? lc3_ns_4m[sr] : lc3_ns_2m5[sr]) ) >> 1; +} + +static inline int lc3_nh(enum lc3_dt dt, enum lc3_srate sr) { + return sr > LC3_SRATE_48K_HR ? 0 : + (8 + (dt == LC3_DT_7M5)) * lc3_ns_2m5[sr]; +} + +static inline int lc3_nt(enum lc3_srate sr) { + return lc3_ns_2m5[sr] >> 1; +} + +#define LC3_MAX_SRATE_HZ ( LC3_PLUS_HR ? 96000 : 48000 ) + +#define LC3_MAX_NS ( LC3_NS(10000, LC3_MAX_SRATE_HZ) ) +#define LC3_MAX_NE ( LC3_PLUS_HR ? LC3_MAX_NS : LC3_NS(10000, 40000) ) + + +/** + * Limits on size of frame + */ + +extern const int lc3_frame_bytes_hr_lim + [LC3_NUM_DT][LC3_NUM_SRATE - LC3_SRATE_48K_HR][2]; + +static inline int lc3_min_frame_bytes(enum lc3_dt dt, enum lc3_srate sr) { + return !lc3_hr(sr) ? LC3_MIN_FRAME_BYTES : + lc3_frame_bytes_hr_lim[dt][sr - LC3_SRATE_48K_HR][0]; +} + +static inline int lc3_max_frame_bytes(enum lc3_dt dt, enum lc3_srate sr) { + return !lc3_hr(sr) ? LC3_MAX_FRAME_BYTES : + lc3_frame_bytes_hr_lim[dt][sr - LC3_SRATE_48K_HR][1]; +} + + /** * MDCT Twiddles and window coefficients */ @@ -45,7 +111,7 @@ extern const float *lc3_mdct_win[LC3_NUM_DT][LC3_NUM_SRATE]; #define LC3_MAX_BANDS 64 extern const int lc3_num_bands[LC3_NUM_DT][LC3_NUM_SRATE]; -extern const uint16_t *lc3_band_lim[LC3_NUM_DT][LC3_NUM_SRATE]; +extern const int *lc3_band_lim[LC3_NUM_DT][LC3_NUM_SRATE]; /** diff --git a/src/tns.c b/src/tns.c index 7e80a5d..e809203 100644 --- a/src/tns.c +++ b/src/tns.c @@ -61,7 +61,7 @@ LC3_HOT static void compute_lpc_coeffs( const float *x, float *gain, float (*a)[9]) { -#if !LC3_NPLUS +#if LC3_PLUS static const int sub_2m5_nb[] = { 3, 10, 20 }; static const int sub_2m5_wb[] = { 3, 20, 40 }; @@ -75,7 +75,7 @@ LC3_HOT static void compute_lpc_coeffs( static const int sub_5m_swb[] = { 6, 43, 80, 120, 160 }; static const int sub_5m_fb[] = { 6, 53, 100, 150, 200 }; -#endif /* !LC3_NPLUS */ +#endif /* LC3_PLUS */ static const int sub_7m5_nb[] = { 9, 26, 43, 60 }; static const int sub_7m5_wb[] = { 9, 46, 83, 120 }; @@ -89,8 +89,6 @@ LC3_HOT static void compute_lpc_coeffs( static const int sub_10m_swb[] = { 12, 61, 110, 160, 213, 266, 320 }; static const int sub_10m_fb[] = { 12, 74, 137, 200, 266, 333, 400 }; - /* --- Normalized autocorrelation --- */ - static const float lag_window[] = { 1.00000000e+00, 9.98028026e-01, 9.92135406e-01, 9.82391584e-01, 9.68910791e-01, 9.51849807e-01, 9.31404933e-01, 9.07808230e-01, @@ -99,22 +97,30 @@ LC3_HOT static void compute_lpc_coeffs( const int *sub = (const int * const [LC3_NUM_DT][LC3_NUM_BANDWIDTH]){ -#if !LC3_NPLUS +#if LC3_PLUS - [LC3_DT_2M5] = { sub_2m5_nb, sub_2m5_wb, - sub_2m5_sswb, sub_2m5_swb, sub_2m5_fb }, - [LC3_DT_5M ] = { sub_5m_nb , sub_5m_wb , - sub_5m_sswb , sub_5m_swb , sub_5m_fb }, + [LC3_DT_2M5] = { + sub_2m5_nb, sub_2m5_wb, sub_2m5_sswb, sub_2m5_swb, + sub_2m5_fb, sub_2m5_fb, sub_2m5_fb }, -#endif /* !LC3_NPLUS */ + [LC3_DT_5M] = { + sub_5m_nb , sub_5m_wb , sub_5m_sswb , sub_5m_swb , + sub_5m_fb , sub_5m_fb , sub_5m_fb }, - [LC3_DT_7M5] = { sub_7m5_nb, sub_7m5_wb, - sub_7m5_sswb, sub_7m5_swb, sub_7m5_fb }, - [LC3_DT_10M] = { sub_10m_nb, sub_10m_wb, - sub_10m_sswb, sub_10m_swb, sub_10m_fb }, +#endif /* LC3_PLUS */ + + [LC3_DT_7M5] = { + sub_7m5_nb, sub_7m5_wb, sub_7m5_sswb, sub_7m5_swb, + sub_7m5_fb }, + + [LC3_DT_10M] = { + sub_10m_nb, sub_10m_wb, sub_10m_sswb, sub_10m_swb, + sub_10m_fb, sub_10m_fb, sub_10m_fb }, }[dt][bw]; + /* --- Normalized autocorrelation --- */ + int nfilters = 1 + (dt >= LC3_DT_5M && bw >= LC3_BANDWIDTH_SWB); int nsubdivisions = 2 + (dt >= LC3_DT_7M5); @@ -296,7 +302,8 @@ LC3_HOT static void forward_filtering( const int rc_order[2], float (* const rc)[8], float *x) { int nfilters = 1 + (dt >= LC3_DT_5M && bw >= LC3_BANDWIDTH_SWB); - int nf = LC3_NE(dt, bw) >> (nfilters - 1); + int nf = lc3_ne(dt, (enum lc3_srate)LC3_MIN(bw, LC3_BANDWIDTH_FB)) + >> (nfilters - 1); int i0, ie = 3*(1 + dt); float s[8] = { 0 }; @@ -337,7 +344,8 @@ LC3_HOT static void inverse_filtering( const int rc_order[2], float (* const rc)[8], float *x) { int nfilters = 1 + (dt >= LC3_DT_5M && bw >= LC3_BANDWIDTH_SWB); - int nf = LC3_NE(dt, bw) >> (nfilters - 1); + int nf = lc3_ne(dt, (enum lc3_srate)LC3_MIN(bw, LC3_BANDWIDTH_FB)) + >> (nfilters - 1); int i0, ie = 3*(1 + dt); float s[8] = { 0 }; diff --git a/tables/mktables.py b/tables/mktables.py index 1cb56ef..c2b8297 100755 --- a/tables/mktables.py +++ b/tables/mktables.py @@ -98,7 +98,7 @@ def print_table(t, m=4): def mdct_fft_twiddles(): - for n in (10, 20, 30, 40, 60, 80, 90, 120, 160, 180, 240): + for n in (10, 20, 30, 40, 60, 80, 90, 120, 160, 180, 240, 480): print('\n--- fft bf2 twiddles {:3d} ---'.format(n)) @@ -120,7 +120,7 @@ def mdct_fft_twiddles(): def mdct_rot_twiddles(): - for n in (40, 80, 120, 160, 240, 320, 360, 480, 640, 720, 960): + for n in (40, 80, 120, 160, 240, 320, 360, 480, 640, 720, 960, 1920): print('\n--- mdct rot twiddles {:3d} ---'.format(n)) @@ -132,14 +132,6 @@ def mdct_rot_twiddles(): end = '\n' if i%2 == 1 else ' ') -def mdct_scaling(): - - print('\n--- mdct scaling ---') - ns = np.array([ [ 60, 120, 180, 240, 360], [ 80, 160, 240, 320, 480] ]) - print_table(np.sqrt(2 / ns[0])) - print_table(np.sqrt(2 / ns[1])) - - def tns_lag_window(): print('\n--- tns lag window ---') @@ -161,7 +153,7 @@ def quant_iq_table(): def sns_ge_table(): - g_tilt_table = [ 14, 18, 22, 26, 30 ] + g_tilt_table = [ 14, 18, 22, 26, 30, 34 ] for (sr, g_tilt) in enumerate(g_tilt_table): print('\n--- sns ge table, sr:{} ---'.format(sr)) @@ -175,7 +167,7 @@ def inv_table(): def ltpf_resampler_table(): - for sr in [ 8, 16, 32, 24, 48 ]: + for sr in [ 8, 16, 32, 24, 48, 96 ]: r = 192 // sr k = 64 if r & (r-1) else 192 @@ -217,7 +209,6 @@ if __name__ == '__main__': mdct_fft_twiddles() mdct_rot_twiddles() - mdct_scaling() inv_table() sns_ge_table() diff --git a/test/attdet.py b/test/attdet.py index 78af304..389b547 100644 --- a/test/attdet.py +++ b/test/attdet.py @@ -105,7 +105,7 @@ def check_enabling(rng, dt): ok = True - for sr in range(T.SRATE_16K, T.NUM_SRATE): + for sr in range(T.SRATE_8K, T.SRATE_48K + 1): attdet = AttackDetector(dt, sr) @@ -175,11 +175,11 @@ def check(): for dt in range(T.NUM_DT): ok and check_enabling(rng, dt) - for dt in range(T.DT_7M5, T.NUM_DT): - for sr in range(T.SRATE_32K, T.NUM_SRATE): + for dt in ( T.DT_7M5, T.DT_10M ): + for sr in ( T.SRATE_32K, T.SRATE_48K ): ok = ok and check_unit(rng, dt, sr) - for dt in range(T.DT_7M5, T.NUM_DT): + for dt in ( T.DT_7M5, T.DT_10M ): ok = ok and check_appendix_c(dt) return ok diff --git a/test/attdet_py.c b/test/attdet_py.c index d85a8a5..95da0ef 100644 --- a/test/attdet_py.c +++ b/test/attdet_py.c @@ -37,7 +37,7 @@ static PyObject *attdet_run_py(PyObject *m, PyObject *args) CTYPES_CHECK("sr", (unsigned)sr < LC3_NUM_SRATE); CTYPES_CHECK(NULL, attdet_obj = to_attdet_analysis(attdet_obj, &attdet)); - int ns = LC3_NS(dt, sr); + int ns = lc3_ns(dt, sr); CTYPES_CHECK("x", x_obj = to_1d_ptr(x_obj, NPY_INT16, ns+6, &x)); diff --git a/test/bwdet.py b/test/bwdet.py index 852fde4..d56d039 100644 --- a/test/bwdet.py +++ b/test/bwdet.py @@ -157,10 +157,10 @@ def check(): ok = True for dt in range(T.NUM_DT): - for sr in range(T.NUM_SRATE): + for sr in range(T.SRATE_8K, T.SRATE_48K + 1): ok = ok and check_unit(rng, dt, sr) - for dt in range(T.DT_7M5, T.NUM_DT): + for dt in ( T.DT_7M5, T.DT_10M ): ok = ok and check_appendix_c(dt) return ok diff --git a/test/bwdet_py.c b/test/bwdet_py.c index 457c160..c029997 100644 --- a/test/bwdet_py.c +++ b/test/bwdet_py.c @@ -31,8 +31,8 @@ static PyObject *bwdet_run_py(PyObject *m, PyObject *args) if (!PyArg_ParseTuple(args, "IIO", &dt, &sr, &e_obj)) return NULL; - CTYPES_CHECK("dt", (unsigned)dt < LC3_NUM_DT); - CTYPES_CHECK("sr", (unsigned)sr < LC3_NUM_SRATE); + CTYPES_CHECK("dt", dt < LC3_NUM_DT); + CTYPES_CHECK("sr", sr < LC3_NUM_SRATE); CTYPES_CHECK("e", to_1d_ptr(e_obj, NPY_FLOAT, LC3_MAX_BANDS, &e)); int bw = lc3_bwdet_run(dt, sr, e); diff --git a/test/ctypes.h b/test/ctypes.h index 2442657..c619c78 100644 --- a/test/ctypes.h +++ b/test/ctypes.h @@ -701,9 +701,9 @@ static PyObject *from_encoder(PyObject *obj, const struct lc3_encoder *enc) { unsigned dt = enc->dt, sr = enc->sr; unsigned sr_pcm = enc->sr_pcm; - int ns = LC3_NS(dt, sr); - int nd = LC3_ND(dt, sr); - int nt = LC3_NT(sr); + int ns = lc3_ns(dt, sr); + int nd = lc3_nd(dt, sr); + int nt = lc3_nt(sr); if (!obj) obj = PyDict_New(); @@ -759,9 +759,9 @@ static PyObject *to_encoder(PyObject *obj, struct lc3_encoder *enc) CTYPES_CHECK("encoder.s_pcmr", (unsigned)(enc->sr_pcm = sr_pcm) < LC3_NUM_SRATE); - int ns = LC3_NS(dt, sr); - int nd = LC3_ND(dt, sr); - int nt = LC3_NT(sr); + int ns = lc3_ns(dt, sr); + int nd = lc3_nd(dt, sr); + int nt = lc3_nt(sr); CTYPES_CHECK(NULL, to_attdet_analysis( PyDict_GetItemString(obj, "attdet"), &enc->attdet)); @@ -796,9 +796,9 @@ static PyObject *from_decoder(PyObject *obj, const struct lc3_decoder *dec) unsigned dt = dec->dt, sr = dec->sr; unsigned sr_pcm = dec->sr_pcm; unsigned xs_pos = dec->xs_off - dec->xh_off; - int nh = LC3_NH(dt, sr); - int ns = LC3_NS(dt, sr); - int nd = LC3_ND(dt, sr); + int nh = lc3_nh(dt, sr); + int ns = lc3_ns(dt, sr); + int nd = lc3_nd(dt, sr); if (!obj) obj = PyDict_New(); @@ -818,7 +818,7 @@ static PyObject *from_decoder(PyObject *obj, const struct lc3_decoder *dec) new_plc_state(&dec->plc)); PyDict_SetItemString(obj, "xh", - new_1d_copy(NPY_FLOAT, nh, dec->x + dec->xh_off)); + new_1d_copy(NPY_FLOAT, nh + ns, dec->x + dec->xh_off)); PyDict_SetItemString(obj, "xs_pos", new_scalar(NPY_INT, &xs_pos)); @@ -853,9 +853,9 @@ static PyObject *to_decoder(PyObject *obj, struct lc3_decoder *dec) CTYPES_CHECK("decoder.sr_pcm", (unsigned)(dec->sr_pcm = sr_pcm) < LC3_NUM_SRATE); - int nh = LC3_NH(dt, sr); - int ns = LC3_NS(dt, sr); - int nd = LC3_ND(dt, sr); + int nh = lc3_nh(dt, sr); + int ns = lc3_ns(dt, sr); + int nd = lc3_nd(dt, sr); CTYPES_CHECK(NULL, to_ltpf_synthesis( PyDict_GetItemString(obj, "ltpf"), &dec->ltpf)); @@ -865,7 +865,7 @@ static PyObject *to_decoder(PyObject *obj, struct lc3_decoder *dec) CTYPES_CHECK("decoder.xh", xh_obj = to_1d_copy( PyDict_GetItemString(obj, "xh"), NPY_FLOAT, - dec->x + dec->xh_off, nh)); + dec->x + dec->xh_off, nh + ns)); PyDict_SetItemString(obj, "xh", xh_obj); CTYPES_CHECK("decoder.xs", to_scalar( diff --git a/test/encoder.py b/test/encoder.py index 2d32505..f687d4b 100755 --- a/test/encoder.py +++ b/test/encoder.py @@ -124,7 +124,7 @@ def check(): ok = True - for dt in range(T.DT_7M5, T.NUM_DT): + for dt in ( T.DT_7M5, T.DT_10M ): ok = ok and check_appendix_c(dt) return ok diff --git a/test/energy.py b/test/energy.py index 5cdbc36..8bca9c0 100644 --- a/test/energy.py +++ b/test/energy.py @@ -83,10 +83,14 @@ def check(): ok = True for dt in range(T.NUM_DT): - for sr in range(T.NUM_SRATE): + for sr in range(T.SRATE_8K, T.SRATE_48K + 1): ok = ok and check_unit(rng, dt, sr) - for dt in range(T.DT_7M5, T.NUM_DT): + for dt in ( T.DT_2M5, T.DT_5M, T.DT_10M ): + for sr in ( T.SRATE_48K_HR, T.SRATE_96K_HR ): + ok = ok and check_unit(rng, dt, sr) + + for dt in ( T.DT_7M5, T.DT_10M ): ok = ok and check_appendix_c(dt) return ok diff --git a/test/energy_py.c b/test/energy_py.c index 6f2d97a..98b7fba 100644 --- a/test/energy_py.c +++ b/test/energy_py.c @@ -34,10 +34,10 @@ static PyObject *energy_compute_py(PyObject *m, PyObject *args) if (!PyArg_ParseTuple(args, "IIO", &dt, &sr, &x_obj)) return NULL; - CTYPES_CHECK("dt", (unsigned)dt < LC3_NUM_DT); - CTYPES_CHECK("sr", (unsigned)sr < LC3_NUM_SRATE); + CTYPES_CHECK("dt", dt < LC3_NUM_DT); + CTYPES_CHECK("sr", sr < LC3_NUM_SRATE); - int ns = LC3_NS(dt, sr); + int ns = lc3_ns(dt, sr); CTYPES_CHECK("x", to_1d_ptr(x_obj, NPY_FLOAT, ns, &x)); e_obj = new_1d_ptr(NPY_FLOAT, lc3_num_bands[dt][sr], &e); diff --git a/test/lc3_py.c b/test/lc3_py.c index 2984beb..0528d04 100644 --- a/test/lc3_py.c +++ b/test/lc3_py.c @@ -61,7 +61,7 @@ static PyObject *encode_py(PyObject *m, PyObject *args) CTYPES_CHECK(NULL, encoder_obj = to_encoder(encoder_obj, encoder)); - int ns = LC3_NS(encoder->dt, encoder->sr); + int ns = lc3_ns(encoder->dt, encoder->sr); CTYPES_CHECK("x", pcm_obj = to_1d_ptr(pcm_obj, NPY_INT16, ns, &pcm)); CTYPES_CHECK("nbytes", nbytes >= 20 && nbytes <= 400); @@ -114,7 +114,7 @@ static PyObject *decode_py(PyObject *m, PyObject *args) CTYPES_CHECK(NULL, decoder_obj = to_decoder(decoder_obj, decoder)); - int ns = LC3_NS(decoder->dt, decoder->sr); + int ns = lc3_ns(decoder->dt, decoder->sr); pcm_obj = new_1d_ptr(NPY_INT16, ns, &pcm); lc3_decode(decoder, in, nbytes, LC3_PCM_FORMAT_S16, pcm, 1); diff --git a/test/ltpf.py b/test/ltpf.py index 5c0019a..ec07c1a 100644 --- a/test/ltpf.py +++ b/test/ltpf.py @@ -662,12 +662,12 @@ def check(): ok = True for dt in range(T.NUM_DT): - for sr in range(T.NUM_SRATE): + for sr in range(T.SRATE_8K, T.SRATE_48K + 1): ok = ok and check_resampler(rng, dt, sr) ok = ok and check_analysis(rng, dt, sr) ok = ok and check_synthesis(rng, dt, sr) - for dt in range(T.DT_7M5, T.NUM_DT): + for dt in ( T.DT_7M5, T.DT_10M ): ok = ok and check_resampler_appendix_c(dt) ok = ok and check_analysis_appendix_c(dt) ok = ok and check_synthesis_appendix_c(dt) diff --git a/test/ltpf_py.c b/test/ltpf_py.c index b25c16a..a8e8bfd 100644 --- a/test/ltpf_py.c +++ b/test/ltpf_py.c @@ -36,7 +36,7 @@ static PyObject *resample_py(PyObject *m, PyObject *args) CTYPES_CHECK("sr", (unsigned)sr < LC3_NUM_SRATE); CTYPES_CHECK(NULL, hp50_obj = to_ltpf_hp50_state(hp50_obj, &hp50)); - int ns = LC3_NS(dt, sr), nt = LC3_NT(dt); + int ns = lc3_ns(dt, sr), nt = lc3_nt(sr); int ny = sizeof((struct lc3_ltpf_analysis){ }.x_12k8) / sizeof(int16_t); int n = (1 + dt) * 32; @@ -64,7 +64,7 @@ static PyObject *analyse_py(PyObject *m, PyObject *args) CTYPES_CHECK("sr", sr < LC3_NUM_SRATE); CTYPES_CHECK(NULL, ltpf_obj = to_ltpf_analysis(ltpf_obj, <pf)); - int ns = LC3_NS(dt, sr), nt = LC3_NT(sr); + int ns = lc3_ns(dt, sr), nt = lc3_nt(sr); CTYPES_CHECK("x", x_obj = to_1d_ptr(x_obj, NPY_INT16, ns+nt, &x)); @@ -97,7 +97,7 @@ static PyObject *synthesize_py(PyObject *m, PyObject *args) if ((pitch_present = (data_obj != Py_None))) CTYPES_CHECK(NULL, data_obj = to_ltpf_data(data_obj, &data)); - int ns = LC3_NS(dt,sr), nd = 18 * LC3_SRATE_KHZ(sr); + int ns = lc3_ns(dt,sr), nd = 18 * (lc3_ns_4m[sr] / 4); CTYPES_CHECK("x", x_obj = to_1d_ptr(x_obj, NPY_FLOAT, nd+ns, &x)); diff --git a/test/mdct.py b/test/mdct.py index 8a19383..835af9e 100644 --- a/test/mdct.py +++ b/test/mdct.py @@ -24,10 +24,17 @@ import tables as T, appendix_c as C class Mdct: - W = [ [ T.W_2M5_8K, T.W_2M5_16K, T.W_2M5_24K, T.W_2M5_32K, T.W_2M5_48K ], - [ T.W_5M_8K , T.W_5M_16K , T.W_5M_24K , T.W_5M_32K , T.W_5M_48K ], - [ T.W_7M5_8K, T.W_7M5_16K, T.W_7M5_24K, T.W_7M5_32K, T.W_7M5_48K ], - [ T.W_10M_8K, T.W_10M_16K, T.W_10M_24K, T.W_10M_32K, T.W_10M_48K ] ] + W = [ [ T.W_2M5_8K , T.W_2M5_16K, T.W_2M5_24K, + T.W_2M5_32K, T.W_2M5_48K, T.W_2M5_48K_HR, T.W_2M5_96K_HR ], + + [ T.W_5M_8K , T.W_5M_16K , T.W_5M_24K , + T.W_5M_32K , T.W_5M_48K , T.W_5M_48K_HR , T.W_5M_96K_HR ], + + [ T.W_7M5_8K , T.W_7M5_16K, T.W_7M5_24K, + T.W_7M5_32K, T.W_7M5_48K, None, None ], + + [ T.W_10M_8K , T.W_10M_16K, T.W_10M_24K, + T.W_10M_32K, T.W_10M_48K, T.W_10M_48K_HR, T.W_10M_96K_HR ] ] def __init__(self, dt, sr): @@ -195,11 +202,16 @@ def check(): ok = True for dt in range(T.NUM_DT): - for sr in range(T.NUM_SRATE): + for sr in range(T.SRATE_8K, T.SRATE_48K + 1): ok = ok and check_forward_unit(rng, dt, sr) ok = ok and check_inverse_unit(rng, dt, sr) - for dt in range(T.DT_7M5, T.NUM_DT): + for dt in ( T.DT_2M5, T.DT_5M, T.DT_10M ): + for sr in ( T.SRATE_48K_HR, T.SRATE_96K_HR ): + ok = ok and check_forward_unit(rng, dt, sr) + ok = ok and check_inverse_unit(rng, dt, sr) + + for dt in ( T.DT_7M5, T.DT_10M ): ok = ok and check_forward_appendix_c(dt) ok = ok and check_inverse_appendix_c(dt) diff --git a/test/mdct_py.c b/test/mdct_py.c index 3479503..792937e 100644 --- a/test/mdct_py.c +++ b/test/mdct_py.c @@ -25,18 +25,17 @@ static PyObject *mdct_forward_py(PyObject *m, PyObject *args) { + unsigned dt, sr; PyObject *x_obj, *xd_obj, *y_obj, *d_obj; - enum lc3_dt dt; - enum lc3_srate sr; float *x, *xd, *y, *d; - if (!PyArg_ParseTuple(args, "iiOO", &dt, &sr, &x_obj, &xd_obj)) + if (!PyArg_ParseTuple(args, "IIOO", &dt, &sr, &x_obj, &xd_obj)) return NULL; - CTYPES_CHECK("dt", (unsigned)dt < LC3_NUM_DT); - CTYPES_CHECK("sr", (unsigned)sr < LC3_NUM_SRATE); + CTYPES_CHECK("dt", dt < LC3_NUM_DT); + CTYPES_CHECK("sr", sr < LC3_NUM_SRATE); - int ns = LC3_NS(dt, sr), nd = LC3_ND(dt, sr); + int ns = lc3_ns(dt, sr), nd = lc3_nd(dt, sr); CTYPES_CHECK("x", to_1d_ptr(x_obj, NPY_FLOAT, ns, &x)); CTYPES_CHECK("xd", to_1d_ptr(xd_obj, NPY_FLOAT, nd, &xd)); @@ -52,18 +51,17 @@ static PyObject *mdct_forward_py(PyObject *m, PyObject *args) static PyObject *mdct_inverse_py(PyObject *m, PyObject *args) { + unsigned dt, sr; PyObject *x_obj, *xd_obj, *d_obj, *y_obj; - enum lc3_dt dt; - enum lc3_srate sr; float *x, *xd, *d, *y; - if (!PyArg_ParseTuple(args, "iiOO", &dt, &sr, &x_obj, &xd_obj)) + if (!PyArg_ParseTuple(args, "IIOO", &dt, &sr, &x_obj, &xd_obj)) return NULL; - CTYPES_CHECK("dt", (unsigned)dt < LC3_NUM_DT); - CTYPES_CHECK("sr", (unsigned)sr < LC3_NUM_SRATE); + CTYPES_CHECK("dt", dt < LC3_NUM_DT); + CTYPES_CHECK("sr", sr < LC3_NUM_SRATE); - int ns = LC3_NS(dt, sr), nd = LC3_ND(dt, sr); + int ns = lc3_ns(dt, sr), nd = lc3_nd(dt, sr); CTYPES_CHECK("x", to_1d_ptr(x_obj, NPY_FLOAT, ns, &x)); CTYPES_CHECK("xd", to_1d_ptr(xd_obj, NPY_FLOAT, nd, &xd)); diff --git a/test/sns.py b/test/sns.py index ed66413..641d99f 100644 --- a/test/sns.py +++ b/test/sns.py @@ -28,6 +28,7 @@ class Sns: self.dt = dt self.sr = sr + self.I = T.I[dt][sr] (self.ind_lf, self.ind_hf, self.shape, self.gain) = \ (None, None, None, None) @@ -64,7 +65,7 @@ class Sns: scf_i[62 ] = scf[15 ] + 1/8 * (scf[15] - scf[14 ]) scf_i[63 ] = scf[15 ] + 3/8 * (scf[15] - scf[14 ]) - nb = len(T.I[self.dt][self.sr]) - 1 + nb = len(self.I) - 1 if nb < 32: n4 = round(abs(1-32/nb)*nb) @@ -90,7 +91,7 @@ class Sns: ## Spectral shaping y = np.empty(len(x)) - I = T.I[self.dt][self.sr] + I = self.I for b in range(nb): y[I[b]:I[b+1]] = x[I[b]:I[b+1]] * g_sns[b] @@ -104,9 +105,11 @@ class SnsAnalysis(Sns): super().__init__(dt, sr) - def compute_scale_factors(self, e, att): + def compute_scale_factors(self, e, att, nbytes): dt = self.dt + sr = self.sr + hr = self.sr >= T.SRATE_48K_HR ## Padding @@ -138,7 +141,7 @@ class SnsAnalysis(Sns): ## Pre-emphasis - g_tilt = [ 14, 18, 22, 26, 30 ][self.sr] + g_tilt = [ 14, 18, 22, 26, 30, 30, 34 ][self.sr] e_p = e_s * (10 ** ((np.arange(64) * g_tilt) / 630)) ## Noise floor @@ -161,7 +164,11 @@ class SnsAnalysis(Sns): ## Mean removal and scaling, attack handling - scf = 0.85 * (e_4 - np.average(e_4)) + cf = [ 0.85, 0.6 ][hr] + if hr and nbytes * 8 > [ 1150, 2300, 0, 4400 ][self.dt]: + cf *= [ 0.25, 0.35 ][ self.dt == T.DT_10M ] + + scf = cf * (e_4 - np.average(e_4)) scf_a = np.zeros(len(scf)) scf_a[0 ] = np.mean(scf[:3]) @@ -322,9 +329,9 @@ class SnsAnalysis(Sns): return scf_q - def run(self, eb, att, x): + def run(self, eb, att, nbytes, x): - scf = self.compute_scale_factors(eb, att) + scf = self.compute_scale_factors(eb, att, nbytes) scf_q = self.quantize(scf) y = self.spectral_shaping(scf_q, False, x) @@ -492,20 +499,36 @@ def check_analysis(rng, dt, sr): analysis = SnsAnalysis(dt, sr) for i in range(10): - x = rng.random(T.NE[dt][sr]) * 1e4 - e = rng.random(len(T.I[dt][sr]) - 1) * 1e10 + ne = T.I[dt][sr][-1] + x = rng.random(ne) * 1e4 + e = rng.random(len(T.I[dt][sr]) - 1) * 1e10 - for att in (0, 1): - y = analysis.run(e, att, x) - data = analysis.get_data() + if sr >= T.SRATE_48K_HR: + for nbits in (1144, 1152, 2296, 2304, 4400, 4408): + y = analysis.run(e, False, nbits // 8, x) + data = analysis.get_data() - (y_c, data_c) = lc3.sns_analyze(dt, sr, e, att, x) + (y_c, data_c) = lc3.sns_analyze( + dt, sr, nbits // 8, e, False, x) - for k in data.keys(): - ok = ok and data_c[k] == data[k] + for k in data.keys(): + ok = ok and data_c[k] == data[k] - ok = ok and lc3.sns_get_nbits() == analysis.get_nbits() - ok = ok and np.amax(np.abs(y - y_c)) < 1e-1 + ok = ok and lc3.sns_get_nbits() == analysis.get_nbits() + ok = ok and np.amax(np.abs(y - y_c)) < 1e-1 + + else: + for att in (0, 1): + y = analysis.run(e, att, 0, x) + data = analysis.get_data() + + (y_c, data_c) = lc3.sns_analyze(dt, sr, 0, e, att, x) + + for k in data.keys(): + ok = ok and data_c[k] == data[k] + + ok = ok and lc3.sns_get_nbits() == analysis.get_nbits() + ok = ok and np.amax(np.abs(y - y_c)) < 1e-1 return ok @@ -530,7 +553,8 @@ def check_synthesis(rng, dt, sr): synthesis.idx_b = rng.integers(0, sz_shape_b, endpoint=True) synthesis.ls_b = bool(rng.integers(0, 1, endpoint=True)) - x = rng.random(T.NE[dt][sr]) * 1e4 + ne = T.I[dt][sr][-1] + x = rng.random(ne) * 1e4 y = synthesis.run(x) y_c = lc3.sns_synthesize(dt, sr, synthesis.get_data(), x) @@ -547,7 +571,7 @@ def check_analysis_appendix_c(dt): for i in range(len(C.E_B[i0])): - scf = lc3.sns_compute_scale_factors(dt, sr, C.E_B[i0][i], False) + scf = lc3.sns_compute_scale_factors(dt, sr, 0, C.E_B[i0][i], False) ok = ok and np.amax(np.abs(scf - C.SCF[i0][i])) < 1e-4 (lf, hf) = lc3.sns_resolve_codebooks(scf) @@ -564,12 +588,10 @@ def check_analysis_appendix_c(dt): scf_q = lc3.sns_unquantize(lf, hf, yn[shape], shape, gain) ok = ok and np.amax(np.abs(scf_q - C.SCF_Q[i0][i])) < 1e-5 - x = lc3.sns_spectral_shaping( - dt, sr, C.SCF_Q[i0][i], False, C.X[i0][i]) + x = lc3.sns_spectral_shaping(dt, sr, C.SCF_Q[i0][i], False, C.X[i0][i]) ok = ok and np.amax(np.abs(1 - x/C.X_S[i0][i])) < 1e-5 - (x, data) = lc3.sns_analyze( - dt, sr, C.E_B[i0][i], False, C.X[i0][i]) + (x, data) = lc3.sns_analyze(dt, sr, 0, C.E_B[i0][i], False, C.X[i0][i]) ok = ok and data['lfcb'] == C.IND_LF[i0][i] ok = ok and data['hfcb'] == C.IND_HF[i0][i] ok = ok and data['shape'] == 2*C.SUBMODE_MSB[i0][i] + \ @@ -615,11 +637,16 @@ def check(): ok = True for dt in range(T.NUM_DT): - for sr in range(T.NUM_SRATE): + for sr in range(T.SRATE_8K, T.SRATE_48K + 1): ok = ok and check_analysis(rng, dt, sr) ok = ok and check_synthesis(rng, dt, sr) - for dt in range(T.DT_7M5, T.NUM_DT): + for dt in ( T.DT_2M5, T.DT_5M, T.DT_10M ): + for sr in ( T.SRATE_48K_HR, T.SRATE_96K_HR ): + ok = ok and check_analysis(rng, dt, sr) + ok = ok and check_synthesis(rng, dt, sr) + + for dt in ( T.DT_7M5, T.DT_10M ): check_analysis_appendix_c(dt) check_synthesis_appendix_c(dt) diff --git a/test/sns_py.c b/test/sns_py.c index d70838b..29015e7 100644 --- a/test/sns_py.c +++ b/test/sns_py.c @@ -26,22 +26,22 @@ static PyObject *compute_scale_factors_py(PyObject *m, PyObject *args) { unsigned dt, sr; + int nbytes, att; PyObject *eb_obj, *scf_obj; float *eb, *scf; - int att; - if (!PyArg_ParseTuple(args, "IIOp", &dt, &sr, &eb_obj, &att)) + if (!PyArg_ParseTuple(args, "IIiOp", &dt, &sr, &nbytes, &eb_obj, &att)) return NULL; - CTYPES_CHECK("dt", (unsigned)dt < LC3_NUM_DT); - CTYPES_CHECK("sr", (unsigned)sr < LC3_NUM_SRATE); + CTYPES_CHECK("dt", dt < LC3_NUM_DT); + CTYPES_CHECK("sr", sr < LC3_NUM_SRATE); int nb = lc3_num_bands[dt][sr]; CTYPES_CHECK("eb", to_1d_ptr(eb_obj, NPY_FLOAT, nb, &eb)); scf_obj = new_1d_ptr(NPY_FLOAT, 16, &scf); - compute_scale_factors(dt, sr, eb, att, scf); + compute_scale_factors(dt, sr, nbytes, eb, att, scf); return Py_BuildValue("N", scf_obj); } @@ -66,6 +66,7 @@ static PyObject *quantize_py(PyObject *m, PyObject *args) { PyObject *scf_obj, *y_obj, *yn_obj; float *scf; + int lfcb_idx, hfcb_idx; int shape_idx, gain_idx; float (*yn)[16]; @@ -122,10 +123,10 @@ static PyObject *spectral_shaping_py(PyObject *m, PyObject *args) if (!PyArg_ParseTuple(args, "IIOpO", &dt, &sr, &scf_q_obj, &inv, &x_obj)) return NULL; - CTYPES_CHECK("dt", (unsigned)dt < LC3_NUM_DT); - CTYPES_CHECK("sr", (unsigned)sr < LC3_NUM_SRATE); + CTYPES_CHECK("dt", dt < LC3_NUM_DT); + CTYPES_CHECK("sr", sr < LC3_NUM_SRATE); - int ne = LC3_NE(dt, sr); + int ne = lc3_ne(dt, sr); CTYPES_CHECK("scf_q", to_1d_ptr(scf_q_obj, NPY_FLOAT, 16, &scf_q)); CTYPES_CHECK("x", x_obj = to_1d_ptr(x_obj, NPY_FLOAT, ne, &x)); @@ -140,22 +141,23 @@ static PyObject *analyze_py(PyObject *m, PyObject *args) PyObject *eb_obj, *x_obj; struct lc3_sns_data data = { 0 }; unsigned dt, sr; + int nbytes, att; float *eb, *x; - int att; - if (!PyArg_ParseTuple(args, "IIOpO", &dt, &sr, &eb_obj, &att, &x_obj)) + if (!PyArg_ParseTuple(args, "IIiOpO", + &dt, &sr, &nbytes, &eb_obj, &att, &x_obj)) return NULL; - CTYPES_CHECK("dt", (unsigned)dt < LC3_NUM_DT); - CTYPES_CHECK("sr", (unsigned)sr < LC3_NUM_SRATE); + CTYPES_CHECK("dt", dt < LC3_NUM_DT); + CTYPES_CHECK("sr", sr < LC3_NUM_SRATE); - int ne = LC3_NE(dt, sr); + int ne = lc3_ne(dt, sr); int nb = lc3_num_bands[dt][sr]; CTYPES_CHECK("eb", to_1d_ptr(eb_obj, NPY_FLOAT, nb, &eb)); CTYPES_CHECK("x", x_obj = to_1d_ptr(x_obj, NPY_FLOAT, ne, &x)); - lc3_sns_analyze(dt, sr, eb, att, &data, x, x); + lc3_sns_analyze(dt, sr, nbytes, eb, att, &data, x, x); return Py_BuildValue("ON", x_obj, new_sns_data(&data)); } @@ -170,11 +172,11 @@ static PyObject *synthesize_py(PyObject *m, PyObject *args) if (!PyArg_ParseTuple(args, "IIOO", &dt, &sr, &data_obj, &x_obj)) return NULL; - CTYPES_CHECK("dt", (unsigned)dt < LC3_NUM_DT); - CTYPES_CHECK("sr", (unsigned)sr < LC3_NUM_SRATE); + CTYPES_CHECK("dt", dt < LC3_NUM_DT); + CTYPES_CHECK("sr", sr < LC3_NUM_SRATE); CTYPES_CHECK(NULL, data_obj = to_sns_data(data_obj, &data)); - int ne = LC3_NE(dt, sr); + int ne = lc3_ne(dt, sr); CTYPES_CHECK("x", x_obj = to_1d_ptr(x_obj, NPY_FLOAT, ne, &x)); diff --git a/test/spec.py b/test/spec.py index 1adb01b..7bc237b 100644 --- a/test/spec.py +++ b/test/spec.py @@ -35,8 +35,13 @@ class SpectrumQuantization: def get_gain_offset(self, nbytes): - g_off = (nbytes * 8) // (10 * (1 + self.sr)) - g_off = -min(115, g_off) - (105 + 5*(1 + self.sr)) + sr_ind = self.sr if self.sr < T.SRATE_48K_HR \ + else 4 + (self.sr - T.SRATE_48K_HR) + + g_off = (nbytes * 8) // (10 * (1 + sr_ind)) + g_off = -min(115, g_off) - (105 + 5*(1 + sr_ind)) + if self.sr >= T.SRATE_48K_HR: + g_off = max(g_off, -181) return g_off @@ -45,14 +50,13 @@ class SpectrumQuantization: nf_start = [ 6, 12, 18, 24 ][self.dt] nf_width = [ 1, 1, 2, 3 ][self.dt] - bw_stop = int([ 80, 160, 240, 320, 400 ][bw] * (T.DT_MS[self.dt] / 10)) + bw_stop = T.I[self.dt][min(bw, T.SRATE_48K)][-1] xq = np.append(xq[:lastnz], np.zeros(len(xq) - lastnz)) xq[:nf_start-nf_width] = 1 - xq[min(bw_stop+nf_width+1,bw_stop):] = 1 return [ np.all(xq[max(k-nf_width, 0):min(k+nf_width+1, bw_stop)] == 0) - for k in range(len(xq)) ] + for k in range(bw_stop) ] class SpectrumAnalysis(SpectrumQuantization): @@ -69,14 +73,36 @@ class SpectrumAnalysis(SpectrumQuantization): self.nbits_residual_max, self.xg) = \ (None, None, None, None, None, None) - def estimate_gain(self, x, nbits_spec, nbits_off, g_off): + def estimate_gain(self, x, nbytes, nbits_spec, nbits_off, g_off): nbits = int(nbits_spec + nbits_off + 0.5) ### Energy (dB) by 4 MDCT coefficients + hr = (self.sr >= T.SRATE_48K_HR) + nf = 0 + + if hr: + dt = self.dt + sr = self.sr + + dt_ms = T.DT_MS[dt] + bitrate = (8 * nbytes / (dt_ms * 1e-3)).astype(int) + + C = [ [ -6, 0, None, 2 ], [ -6, 0, None, 5 ] ] + + reg_bits = np.clip( + bitrate // 12500 + C[sr - T.SRATE_48K_HR][dt], 6, 23) + + M0 = np.sum(np.abs(x)) + 1e-5 + M1 = np.sum(np.arange(len(x)) * np.abs(x)) + 1e-5 + + low_bits = (4 / dt_ms) * (2*dt_ms - min(M0/M1, 2*dt_ms)) + + nf = np.max(np.abs(x)) * np.exp2(-reg_bits - low_bits) + e = [ np.sum(x[4*k:4*(k+1)] ** 2) for k in range(len(x) // 4) ] - e = 10 * np.log10(2**-31 + np.array(e)) + e = 10 * np.log10(2**-31 + np.array(e) + nf) ### Compute gain index @@ -107,7 +133,8 @@ class SpectrumAnalysis(SpectrumQuantization): x_max = np.amax(np.abs(x)) if x_max > 0: - g_min = 28 * np.log10(x_max / (32768 - 0.375)) + x_lim = [ 2**15 - 0.375, 2**23 ][hr] + g_min = 28 * np.log10(x_max / x_lim) g_min = np.ceil(g_min).astype(int) - g_off reset_off = g_idx < g_min else: @@ -123,9 +150,14 @@ class SpectrumAnalysis(SpectrumQuantization): xg = x / 10 ** (g_int / 28) - xq = np.where(xg < 0, np.ceil(xg - 0.375), np.floor(xg + 0.375)) - xq = xq.astype(int) - xq = np.fmin(np.fmax(xq, -32768), 32767) + hr = (self.sr >= T.SRATE_48K_HR) + offset = [ 0.375, 0.5 ][hr] + xq_min = [ -(2**15) , -(2**23) ][hr] + xq_max = [ (2**15)-1, (2**23)-1 ][hr] + + xq = np.where(xg < 0, np.ceil(xg - offset), np.floor(xg + offset)) + xq = xq.astype(np.int32) + xq = np.fmin(np.fmax(xq, xq_min), xq_max) nz_pairs = np.any([ xq[::2] != 0, xq[1::2] != 0 ], axis=0) lastnz = len(xq) - 2 * np.argmax(nz_pairs[-1::-1]) @@ -136,8 +168,10 @@ class SpectrumAnalysis(SpectrumQuantization): def compute_nbits(self, nbytes, x, lastnz, nbits_spec): - mode = 1 if nbytes >= 20 * (3 + self.sr) else 0 - rate = 512 if nbytes > 20 * (1 + self.sr) else 0 + mode = [ 0, 1 ][int(self.sr < T.SRATE_96K_HR and \ + nbytes >= 20 * (3 + min(self.sr, T.SRATE_48K)))] + rate = [ 0, 512 ][int(self.sr < T.SRATE_96K_HR and \ + nbytes > 20 * (1 + min(self.sr, T.SRATE_48K)))] nbits_est = 0 nbits_trunc = 0 @@ -195,10 +229,11 @@ class SpectrumAnalysis(SpectrumQuantization): def adjust_gain(self, g_idx, nbits, nbits_spec): - T1 = [ 80, 230, 380, 530, 680 ] - T2 = [ 500, 1025, 1550, 2075, 2600 ] - T3 = [ 850, 1700, 2550, 3400, 4250 ] + T1 = [ 80, 230, 380, 530, 680, 680, 830 ] + T2 = [ 500, 1025, 1550, 2075, 2600, 2600, 3125 ] + T3 = [ 850, 1700, 2550, 3400, 4250, 4250, 5100 ] + dt = self.dt sr = self.sr if nbits < T1[sr]: @@ -217,8 +252,16 @@ class SpectrumAnalysis(SpectrumQuantization): delta = np.fix(delta + 0.5).astype(int) - if (g_idx < 255 and nbits > nbits_spec) or \ - (g_idx > 0 and nbits < nbits_spec - (delta + 2)): + if self.sr >= T.SRATE_48K_HR and \ + (g_idx < 255 and nbits > nbits_spec): + + factor = [ 3 + (nbits >= 520), 2, 0, 1 ][dt] + g_incr = int(factor * (1 + (nbits - nbits_spec) / delta)) + return min(g_idx + g_incr, 255) - g_idx; + + elif self.sr < T.SRATE_48K_HR and \ + ( (g_idx < 255 and nbits > nbits_spec) or \ + (g_idx > 0 and nbits < nbits_spec - (delta + 2)) ): if nbits < nbits_spec - (delta + 2): return -1 @@ -234,22 +277,24 @@ class SpectrumAnalysis(SpectrumQuantization): def estimate_noise(self, bw, xq, lastnz, x): i_nf = self.get_noise_indices(bw, xq, lastnz) - l_nf = sum(abs(x * i_nf)) / sum(i_nf) if sum(i_nf) > 0 else 0 + l_nf = sum(abs(x[:len(i_nf)] * i_nf)) / sum(i_nf) \ + if sum(i_nf) > 0 else 0 return min(max(np.rint(8 - 16 * l_nf).astype(int), 0), 7) - def run(self, - bw, nbytes, nbits_bw, nbits_ltpf, nbits_sns, nbits_tns, x): + def run(self, bw, nbytes, nbits_bw, nbits_ltpf, nbits_sns, nbits_tns, x): sr = self.sr ### Bit budget + hr = self.sr >= T.SRATE_48K_HR + nbits_gain = 8 nbits_nf = 3 nbits_ari = np.ceil(np.log2(len(x) / 2)).astype(int) - nbits_ari += 3 + min((8*nbytes - 1) // 1280, 2) + nbits_ari += 3 + int(hr) + min((8*nbytes - 1) // 1280, 2) nbits_spec = 8*nbytes - \ nbits_bw - nbits_ltpf - nbits_sns - nbits_tns - \ @@ -266,7 +311,7 @@ class SpectrumAnalysis(SpectrumQuantization): g_off = self.get_gain_offset(nbytes) (g_min, g_int, self.reset_off) = \ - self.estimate_gain(x, nbits_spec, nbits_off, g_off) + self.estimate_gain(x, nbytes, nbits_spec, nbits_off, g_off) self.nbits_off = nbits_off self.nbits_spec = nbits_spec @@ -304,7 +349,7 @@ class SpectrumAnalysis(SpectrumQuantization): def store(self, b): - ne = T.NE[self.dt][self.sr] + ne = T.I[self.dt][self.sr][-1] nbits_lastnz = np.ceil(np.log2(ne/2)).astype(int) b.write_uint((self.lastnz >> 1) - 1, nbits_lastnz) @@ -421,7 +466,7 @@ class SpectrumSynthesis(SpectrumQuantization): def load(self, b): - ne = T.NE[self.dt][self.sr] + ne = T.I[self.dt][self.sr][-1] nbits_lastnz = np.ceil(np.log2(ne/2)).astype(int) self.lastnz = (b.read_uint(nbits_lastnz) + 1) << 1 @@ -439,8 +484,10 @@ class SpectrumSynthesis(SpectrumQuantization): ### Quantized data - x = np.zeros(T.NE[self.dt][self.sr]) - rate = 512 if nbytes > 20 * (1 + self.sr) else 0 + ne = T.I[self.dt][self.sr][-1] + x = np.zeros(ne) + rate = [ 0, 512 ][int(self.sr < T.SRATE_96K_HR and \ + nbytes > 20 * (1 + min(self.sr, T.SRATE_48K)))] levs = np.zeros(len(x), dtype=np.intc) c = 0 @@ -571,14 +618,14 @@ def initial_state(): def check_estimate_gain(rng, dt, sr): - ne = T.I[dt][sr][-1] ok = True analysis = SpectrumAnalysis(dt, sr) mismatch_count = 0 for i in range(10): - x = rng.random(ne) * i * 1e2 + ne = T.I[dt][sr][-1] + x = rng.random(ne) * i * 1e2 nbytes = 20 + int(rng.random() * 100) nbits_budget = 8 * nbytes - int(rng.random() * 100) @@ -586,10 +633,10 @@ def check_estimate_gain(rng, dt, sr): g_off = 10 - int(rng.random() * 20) (_, g_int, reset_off) = \ - analysis.estimate_gain(x, nbits_budget, nbits_off, g_off) + analysis.estimate_gain(x, nbytes, nbits_budget, nbits_off, g_off) (g_int_c, reset_off_c, _) = lc3.spec_estimate_gain( - dt, sr, x, nbits_budget, nbits_off, -g_off) + dt, sr, x, nbytes, nbits_budget, nbits_off, -g_off) if g_int_c != g_int: mismatch_count += 1 @@ -601,28 +648,26 @@ def check_estimate_gain(rng, dt, sr): def check_quantization(rng, dt, sr): - ne = T.I[dt][sr][-1] ok = True analysis = SpectrumAnalysis(dt, sr) for g_int in range(-128, 128): - x = rng.random(ne) * 1e2 + ne = T.I[dt][sr][-1] + x = rng.random(ne) * 1e2 nbytes = 20 + int(rng.random() * 30) (xg, xq, nq) = analysis.quantize(g_int, x) - (xg_c, xq_c, nq_c) = lc3.spec_quantize(dt, sr, g_int, x) + (xg_c, nq_c) = lc3.spec_quantize(dt, sr, g_int, x) ok = ok and np.amax(np.abs(1 - xg_c/xg)) < 1e-6 - ok = ok and np.any(abs(xq_c - xq) < 1) ok = ok and nq_c == nq return ok def check_compute_nbits(rng, dt, sr): - ne = T.I[dt][sr][-1] ok = True analysis = SpectrumAnalysis(dt, sr) @@ -630,6 +675,7 @@ def check_compute_nbits(rng, dt, sr): for nbytes in range(20, 150): nbits_budget = nbytes * 8 - int(rng.random() * 100) + ne = T.I[dt][sr][-1] xq = (rng.random(ne) * 8).astype(int) nq = ne // 2 + int(rng.random() * ne // 2) @@ -655,7 +701,6 @@ def check_compute_nbits(rng, dt, sr): def check_adjust_gain(rng, dt, sr): - ne = T.I[dt][sr][-1] ok = True analysis = SpectrumAnalysis(dt, sr) @@ -666,7 +711,8 @@ def check_adjust_gain(rng, dt, sr): g_adj = analysis.adjust_gain(g_idx, nbits, nbits_budget) - g_adj_c = lc3.spec_adjust_gain(sr, g_idx, nbits, nbits_budget, 0) + g_adj_c = lc3.spec_adjust_gain( + dt, sr, g_idx, nbits, nbits_budget, 0) ok = ok and g_adj_c == g_adj @@ -674,8 +720,6 @@ def check_adjust_gain(rng, dt, sr): def check_unit(rng, dt, sr): - ns = T.NS[dt][sr] - ne = T.I[dt][sr][-1] ok = True state_c = initial_state() @@ -689,42 +733,47 @@ def check_unit(rng, dt, sr): nbytes = 100 for i in range(10): + ns = T.NS[dt][sr] + ne = T.I[dt][sr][-1] x = rng.random(ns) * 1e4 e = rng.random(min(len(x), 64)) * 1e10 - bwdet.run(e) + if sr < T.SRATE_48K_HR: + bwdet.run(e) pitch_present = ltpf.run(x) tns.run(x[:ne], sr, False, nbytes) - sns.run(e, False, x) + sns.run(e, False, 0, x) - (xq, nq, _) = analysis.run(sr, nbytes, bwdet.get_nbits(), + (xq, nq, xg) = analysis.run(sr, nbytes, + 0 if sr >= T.SRATE_48K_HR else bwdet.get_nbits(), ltpf.get_nbits(), sns.get_nbits(), tns.get_nbits(), x[:ne]) - (_, xq_c, side_c) = lc3.spec_analyze( - dt, sr, nbytes, pitch_present, tns.get_data(), state_c, x[:ne]) + (xg_c, side_c) = lc3.spec_analyze(dt, sr, + nbytes, pitch_present, tns.get_data(), state_c, x[:ne]) ok = ok and side_c['g_idx'] == analysis.g_idx ok = ok and side_c['nq'] == nq - ok = ok and np.any(abs(xq_c - xq) < 1) + ok = ok and np.amax(np.abs(1 - xg_c/xg)) < 1e-6 return ok -def check_noise(rng, dt, bw): +def check_noise(rng, dt, bw, hrmode = False): - ne = T.NE[dt][bw] ok = True analysis = SpectrumAnalysis(dt, bw) - for i in range(10): + xq_off = [ 0.375, 0.5 ][hrmode] + for i in range(10): + ne = T.I[dt][bw][-1] xq = ((rng.random(ne) - 0.5) * 10 ** (0.5)).astype(int) nq = ne - int(rng.random() * 5) - x = rng.random(ne) * i * 1e-1 + x = xq - np.select([xq < 0, xq > 0], np.array([ xq_off, -xq_off ])) nf = analysis.estimate_noise(bw, xq, nq, x) - nf_c = lc3.spec_estimate_noise(dt, bw, xq, nq, x) + nf_c = lc3.spec_estimate_noise(dt, bw, hrmode, x, nq) ok = ok and nf_c == nf @@ -735,36 +784,38 @@ def check_appendix_c(dt): i0 = dt - T.DT_7M5 sr = T.SRATE_16K - ne = T.NE[dt][sr] ok = True state_c = initial_state() for i in range(len(C.X_F[i0])): + ne = T.I[dt][sr][-1] + g_int = lc3.spec_estimate_gain(dt, sr, C.X_F[i0][i], - C.NBITS_SPEC[i0][i], C.NBITS_OFFSET[i0][i], -C.GG_OFF[i0][i])[0] + 0, C.NBITS_SPEC[i0][i], C.NBITS_OFFSET[i0][i], -C.GG_OFF[i0][i])[0] ok = ok and g_int == C.GG_IND[i0][i] + C.GG_OFF[i0][i] - (_, xq, nq) = lc3.spec_quantize(dt, sr, + (x, nq) = lc3.spec_quantize(dt, sr, C.GG_IND[i0][i] + C.GG_OFF[i0][i], C.X_F[i0][i]) - ok = ok and np.any((xq - C.X_Q[i0][i]) == 0) + x += np.select([x < 0, x > 0], np.array([ 0.375, -0.375 ])) + ok = ok and np.any((np.trunc(x) - C.X_Q[i0][i]) == 0) ok = ok and nq == C.LASTNZ[i0][i] - nbits = lc3.spec_compute_nbits(dt, sr, C.NBYTES[i0], C.X_Q[i0][i], C.LASTNZ[i0][i], 0)[0] ok = ok and nbits == C.NBITS_EST[i0][i] - g_adj = lc3.spec_adjust_gain(sr, + g_adj = lc3.spec_adjust_gain(dt, sr, C.GG_IND[i0][i], C.NBITS_EST[i0][i], C.NBITS_SPEC[i0][i], 0) ok = ok and g_adj == C.GG_IND_ADJ[i0][i] - C.GG_IND[i0][i] if C.GG_IND_ADJ[i0][i] != C.GG_IND[i0][i]: - (_, xq, nq) = lc3.spec_quantize(dt, sr, + (x, nq) = lc3.spec_quantize(dt, sr, C.GG_IND_ADJ[i0][i] + C.GG_OFF[i0][i], C.X_F[i0][i]) lastnz = C.LASTNZ_REQ[i0][i] - ok = ok and np.any(((xq - C.X_Q_REQ[i0][i])[:lastnz]) == 0) + x += np.select([x < 0, x > 0], np.array([ 0.375, -0.375 ])) + ok = ok and np.any(((np.trunc(x) - C.X_Q_REQ[i0][i])[:lastnz]) == 0) tns_data = { 'nfilters' : C.NUM_TNS_FILTERS[i0][i], @@ -773,9 +824,12 @@ def check_appendix_c(dt): 'rc' : [ C.RC_I_1[i0][i] - 8, np.zeros(8, dtype = np.intc) ] } - (x, xq, side) = lc3.spec_analyze(dt, sr, C.NBYTES[i0], + (x, side) = lc3.spec_analyze(dt, sr, C.NBYTES[i0], C.PITCH_PRESENT[i0][i], tns_data, state_c, C.X_F[i0][i]) + xq = x + np.select([x < 0, x > 0], np.array([ 0.375, -0.375 ])) + xq = np.trunc(xq) + ok = ok and np.abs(state_c['nbits_off'] - C.NBITS_OFFSET[i0][i]) < 1e-5 if C.GG_IND_ADJ[i0][i] != C.GG_IND[i0][i]: xq = C.X_Q_REQ[i0][i] @@ -794,8 +848,8 @@ def check_appendix_c(dt): gg = C.GG[i0][i] if C.GG_IND_ADJ[i0][i] == C.GG_IND[i0][i] \ else C.GG_ADJ[i0][i] - nf = lc3.spec_estimate_noise(dt, C.P_BW[i0][i], - xq, nq, C.X_F[i0][i] / gg) + nf = lc3.spec_estimate_noise( + dt, C.P_BW[i0][i], False, C.X_F[i0][i] / gg, nq) ok = ok and nf == C.F_NF[i0][i] return ok @@ -806,7 +860,7 @@ def check(): ok = True for dt in range(T.NUM_DT): - for sr in range(T.NUM_SRATE): + for sr in range(T.SRATE_8K, T.SRATE_48K + 1): ok = ok and check_estimate_gain(rng, dt, sr) ok = ok and check_quantization(rng, dt, sr) ok = ok and check_compute_nbits(rng, dt, sr) @@ -814,7 +868,16 @@ def check(): ok = ok and check_unit(rng, dt, sr) ok = ok and check_noise(rng, dt, sr) - for dt in range(T.DT_7M5, T.NUM_DT): + for dt in ( T.DT_2M5, T.DT_5M, T.DT_10M ): + for sr in ( T.SRATE_48K_HR, T.SRATE_96K_HR ): + ok = ok and check_estimate_gain(rng, dt, sr) + ok = ok and check_quantization(rng, dt, sr) + ok = ok and check_compute_nbits(rng, dt, sr) + ok = ok and check_adjust_gain(rng, dt, sr) + ok = ok and check_unit(rng, dt, sr) + ok = ok and check_noise(rng, dt, sr, True) + + for dt in ( T.DT_7M5, T.DT_10M ): ok = ok and check_appendix_c(dt) return ok diff --git a/test/spec_py.c b/test/spec_py.c index 730f68f..5ef3731 100644 --- a/test/spec_py.c +++ b/test/spec_py.c @@ -25,167 +25,149 @@ static PyObject *estimate_gain_py(PyObject *m, PyObject *args) { - PyObject *x_obj; unsigned dt, sr; - float *x; - int nbits_budget; + int nbytes, nbits_budget, g_off; float nbits_off; - int g_off, g_min; - bool reset_off; + PyObject *x_obj; + float *x; - if (!PyArg_ParseTuple(args, "IIOifi", &dt, &sr, - &x_obj, &nbits_budget, &nbits_off, &g_off)) + if (!PyArg_ParseTuple(args, "IIOiifi", &dt, &sr, + &x_obj, &nbytes, &nbits_budget, &nbits_off, &g_off)) return NULL; - CTYPES_CHECK("dt", (unsigned)dt < LC3_NUM_DT); - CTYPES_CHECK("sr", (unsigned)sr < LC3_NUM_SRATE); + CTYPES_CHECK("dt", dt < LC3_NUM_DT); + CTYPES_CHECK("sr", sr < LC3_NUM_SRATE); - int ne = LC3_NE(dt, sr); + int ne = lc3_ne(dt, sr); CTYPES_CHECK("x", x_obj = to_1d_ptr(x_obj, NPY_FLOAT, ne, &x)); + int g_min; + bool reset_off; + int g_int = estimate_gain(dt, sr, - x, nbits_budget, nbits_off, g_off, &reset_off, &g_min); + x, nbytes, nbits_budget, nbits_off, g_off, &reset_off, &g_min); return Py_BuildValue("iii", g_int, reset_off, g_min); } static PyObject *adjust_gain_py(PyObject *m, PyObject *args) { - unsigned sr; + unsigned dt, sr; int g_idx, nbits, nbits_budget, g_idx_min; - if (!PyArg_ParseTuple(args, "Iiiii", &sr, &g_idx, - &nbits, &nbits_budget, &g_idx_min)) + if (!PyArg_ParseTuple(args, "IIiiii", &dt, &sr, + &g_idx, &nbits, &nbits_budget, &g_idx_min)) return NULL; - CTYPES_CHECK("sr", (unsigned)sr < LC3_NUM_SRATE); + CTYPES_CHECK("dt", dt < LC3_NUM_DT); + CTYPES_CHECK("sr", sr < LC3_NUM_SRATE); CTYPES_CHECK("g_idx", g_idx >= 0 && g_idx <= 255); - g_idx = adjust_gain(sr, g_idx, nbits, nbits_budget, g_idx_min); + g_idx = adjust_gain(dt, sr, g_idx, nbits, nbits_budget, g_idx_min); return Py_BuildValue("i", g_idx); } static PyObject *quantize_py(PyObject *m, PyObject *args) { - PyObject *x_obj, *xq_obj; unsigned dt, sr; + int g_int; + PyObject *x_obj; float *x; - int16_t *xq; - int g_int, nq; + int nq; if (!PyArg_ParseTuple(args, "IIiO", &dt, &sr, &g_int, &x_obj)) return NULL; - CTYPES_CHECK("dt", (unsigned)dt < LC3_NUM_DT); - CTYPES_CHECK("sr", (unsigned)sr < LC3_NUM_SRATE); + CTYPES_CHECK("dt", dt < LC3_NUM_DT); + CTYPES_CHECK("sr", sr < LC3_NUM_SRATE); CTYPES_CHECK("g_int", g_int >= -255 && g_int <= 255); - int ne = LC3_NE(dt, sr); + int ne = lc3_ne(dt, sr); CTYPES_CHECK("x", x_obj = to_1d_ptr(x_obj, NPY_FLOAT, ne, &x)); - xq_obj = new_1d_ptr(NPY_INT16, ne, &xq); - uint16_t __xq[ne]; + quantize(dt, sr, g_int, x, &nq); - quantize(dt, sr, g_int, x, __xq, &nq); - - for (int i = 0; i < nq; i++) - xq[i] = __xq[i] & 1 ? -(__xq[i] >> 1) : (__xq[i] >> 1); - - return Py_BuildValue("ONi", x_obj, xq_obj, nq); + return Py_BuildValue("Oi", x_obj, nq); } static PyObject *compute_nbits_py(PyObject *m, PyObject *args) { - PyObject *xq_obj; - unsigned dt, sr, nbytes; - int16_t *xq; - int nq, nbits_budget; - bool lsb_mode; + unsigned dt, sr; + int nbytes, nq, nbits_budget; + PyObject *x_obj; + float *x; - if (!PyArg_ParseTuple(args, "IIIOii", &dt, &sr, - &nbytes, &xq_obj, &nq, &nbits_budget)) + if (!PyArg_ParseTuple(args, "IIiOii", &dt, &sr, + &nbytes, &x_obj, &nq, &nbits_budget)) return NULL; - CTYPES_CHECK("dt", (unsigned)dt < LC3_NUM_DT); - CTYPES_CHECK("sr", (unsigned)sr < LC3_NUM_SRATE); + CTYPES_CHECK("dt", dt < LC3_NUM_DT); + CTYPES_CHECK("sr", sr < LC3_NUM_SRATE); - int ne = LC3_NE(dt, sr); + int ne = lc3_ne(dt, sr); - CTYPES_CHECK("xq", xq_obj = to_1d_ptr(xq_obj, NPY_INT16, ne, &xq)); + CTYPES_CHECK("x", x_obj = to_1d_ptr(x_obj, NPY_FLOAT, ne, &x)); - uint16_t __xq[ne]; - for (int i = 0; i < ne; i++) - __xq[i] = xq[i] < 0 ? (-xq[i] << 1) + 1 : (xq[i] << 1); + bool lsb_mode; int nbits = compute_nbits( - dt, sr, nbytes, __xq, &nq, nbits_budget, &lsb_mode); + dt, sr, nbytes, x, &nq, nbits_budget, &lsb_mode); return Py_BuildValue("iii", nbits, nq, lsb_mode); } static PyObject *analyze_py(PyObject *m, PyObject *args) { - PyObject *tns_obj, *spec_obj, *x_obj, *xq_obj; + unsigned dt, sr; + int nbytes, pitch; + + PyObject *tns_obj, *spec_obj, *x_obj; struct lc3_tns_data tns = { 0 }; struct lc3_spec_analysis spec = { 0 }; struct lc3_spec_side side = { 0 }; - unsigned dt, sr, nbytes; - int pitch; float *x; - int16_t *xq; - if (!PyArg_ParseTuple(args, "IIIpOOO", &dt, &sr, &nbytes, - &pitch, &tns_obj, &spec_obj, &x_obj)) + if (!PyArg_ParseTuple(args, "IIipOOO", &dt, &sr, + &nbytes, &pitch, &tns_obj, &spec_obj, &x_obj)) return NULL; - CTYPES_CHECK("dt", (unsigned)dt < LC3_NUM_DT); - CTYPES_CHECK("sr", (unsigned)sr < LC3_NUM_SRATE); + CTYPES_CHECK("dt", dt < LC3_NUM_DT); + CTYPES_CHECK("sr", sr < LC3_NUM_SRATE); - int ne = LC3_NE(dt, sr); + int ne = lc3_ne(dt, sr); CTYPES_CHECK(NULL, tns_obj = to_tns_data(tns_obj, &tns)); CTYPES_CHECK(NULL, spec_obj = to_spec_analysis(spec_obj, &spec)); CTYPES_CHECK("x", x_obj = to_1d_ptr(x_obj, NPY_FLOAT, ne, &x)); - xq_obj = new_1d_ptr(NPY_INT16, ne, &xq); - uint16_t __xq[ne]; - - lc3_spec_analyze(dt, sr, nbytes, pitch, &tns, &spec, x, __xq, &side); - - for (int i = 0; i < ne; i++) - xq[i] = __xq[i] & 1 ? -(__xq[i] >> 1) : (__xq[i] >> 1); + lc3_spec_analyze(dt, sr, nbytes, pitch, &tns, &spec, x, &side); from_spec_analysis(spec_obj, &spec); - return Py_BuildValue("ONN", x_obj, xq_obj, new_spec_side(&side)); + return Py_BuildValue("ON", x_obj, new_spec_side(&side)); } static PyObject *estimate_noise_py(PyObject *m, PyObject *args) { - PyObject *x_obj, *xq_obj; unsigned dt, bw; - int16_t *xq; + PyObject *x_obj; float *x; - int nq; + int hrmode, n; - if (!PyArg_ParseTuple(args, "IIOIO", &dt, &bw, &xq_obj, &nq, &x_obj)) + if (!PyArg_ParseTuple(args, "IIpOI", + &dt, &bw, &hrmode, &x_obj, &n)) return NULL; - CTYPES_CHECK("dt", (unsigned)dt < LC3_NUM_DT); - CTYPES_CHECK("bw", (unsigned)bw < LC3_NUM_BANDWIDTH); + CTYPES_CHECK("dt", dt < LC3_NUM_DT); + CTYPES_CHECK("bw", bw < LC3_NUM_BANDWIDTH); - int ne = LC3_NE(dt, bw); + int ne = lc3_ne(dt, bw); - CTYPES_CHECK("xq", xq_obj = to_1d_ptr(xq_obj, NPY_INT16, ne, &xq)); CTYPES_CHECK("x" , x_obj = to_1d_ptr(x_obj, NPY_FLOAT, ne, &x )); - uint16_t __xq[nq]; - for (int i = 0; i < nq; i++) - __xq[i] = xq[i] < 0 ? (-xq[i] << 1) + 1 : (xq[i] << 1); - - int noise_factor = estimate_noise(dt, bw, __xq, nq, x); + int noise_factor = estimate_noise(dt, bw, hrmode, x, n); return Py_BuildValue("i", noise_factor); } diff --git a/test/tables.py b/test/tables.py index 0d63593..5df36ea 100644 --- a/test/tables.py +++ b/test/tables.py @@ -28,25 +28,24 @@ NUM_DT = 4 DT_MS = np.array([ 2.5, 5, 7.5, 10 ]) -SRATE_8K = 0 -SRATE_16K = 1 -SRATE_24K = 2 -SRATE_32K = 3 -SRATE_48K = 4 -NUM_SRATE = 5 +SRATE_8K = 0 +SRATE_8K = 0 +SRATE_16K = 1 +SRATE_24K = 2 +SRATE_32K = 3 +SRATE_48K = 4 +SRATE_48K_HR = 5 +SRATE_96K_HR = 6 +NUM_SR = 6 -SRATE_KHZ = np.array([ 8, 16, 24, 32, 48 ]) +SRATE_KHZ = np.array([ 8, 16, 24, 32, 48, 48, 96 ]) -NS = np.array([(SRATE_KHZ * DT_MS[dt]).astype(int) - for dt in range(NUM_DT) ]) -NE = np.array([np.append(NS[dt][:-1], (NS[dt][-1] * 5) // 6) - for dt in range(NUM_DT) ]) +NS = np.array([(SRATE_KHZ * DT_MS[dt]).astype(int) for dt in range(NUM_DT) ]) ND = NS // 2 + np.array([ 5 * SRATE_KHZ, 5 * SRATE_KHZ, \ - 8 * SRATE_KHZ, 5 * SRATE_KHZ ]) // 4 + 8 * SRATE_KHZ, 5 * SRATE_KHZ ]) // 4 -### LC3 PLUS - 5.9.1 ### I_2M5_8K = np.array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, @@ -85,6 +84,22 @@ I_2M5_48K = np.array([ 77, 82, 87, 93, 100, ]) +I_2M5_48K_HR = np.array([ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 21, 23, 25, 27, 29, 31, 33, 35, 37, 40, + 43, 46, 49, 53, 57, 61, 65, 69, 74, 79, + 85, 91, 97, 104, 112, 120 +]) + +I_2M5_96K_HR = np.array([ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 18, 20, 22, + 24, 26, 28, 30, 32, 35, 38, 41, 45, 49, + 53, 57, 62, 67, 73, 79, 85, 92, 100, 108, + 117, 127, 137, 149, 161, 174, 189, 204, 221, 240 +]) + I_5M_8K = np.array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, @@ -128,56 +143,22 @@ I_5M_48K = np.array([ 145, 155, 165, 176, 187, 200, ]) -### LC3 - 3.7.1/2 ### - -I_10M_8K = np.array([ +I_5M_48K_HR = np.array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, - 71, 73, 75, 77, 80 + 21, 23, 25, 27, 29, 31, 33, 35, 38, 41, + 44, 47, 50, 54, 58, 62, 66, 71, 76, 81, + 87, 93, 100, 107, 114, 122, 131, 140, 149, 160, + 171, 183, 196, 209, 224, 240, ]) -I_10M_16K = np.array([ +I_5M_96K_HR = np.array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 30, - 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, - 52, 55, 58, 61, 64, 67, 70, 73, 76, 80, - 84, 88, 92, 96, 101, 106, 111, 116, 121, 127, - 133, 139, 146, 153, 160 -]) - -I_10M_24K = np.array([ - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 25, 27, 29, 31, 33, 35, - 37, 39, 41, 43, 46, 49, 52, 55, 58, 61, - 64, 68, 72, 76, 80, 85, 90, 95, 100, 106, - 112, 118, 125, 132, 139, 147, 155, 164, 173, 183, - 193, 204, 215, 227, 240 -]) - -I_10M_32K = np.array([ - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, - 41, 44, 47, 50, 53, 56, 60, 64, 68, 72, - 76, 81, 86, 91, 97, 103, 109, 116, 123, 131, - 139, 148, 157, 166, 176, 187, 199, 211, 224, 238, - 252, 268, 284, 302, 320 -]) - -I_10M_48K = np.array([ - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, - 22, 24, 26, 28, 30, 32, 34, 36, 39, 42, - 45, 48, 51, 55, 59, 63, 67, 71, 76, 81, - 86, 92, 98, 105, 112, 119, 127, 135, 144, 154, - 164, 175, 186, 198, 211, 225, 240, 256, 273, 291, - 310, 330, 352, 375, 400 + 10, 11, 12, 13, 14, 15, 16, 17, 19, 21, + 23, 25, 27, 29, 31, 34, 37, 40, 44, 48, + 52, 56, 61, 66, 71, 77, 83, 90, 98, 106, + 115, 124, 135, 146, 158, 171, 185, 200, 217, 235, + 254, 275, 298, 323, 349, 378, 409, 443, 480 ]) I_7M5_8K = np.array([ @@ -230,10 +211,87 @@ I_7M5_48K = np.array([ 236, 251, 266, 283, 300 ]) -I = [ [ I_2M5_8K, I_2M5_16K, I_2M5_24K, I_2M5_32K, I_2M5_48K ], - [ I_5M_8K , I_5M_16K , I_5M_24K , I_5M_32K , I_5M_48K ], +I_10M_8K = np.array([ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, + 71, 73, 75, 77, 80 +]) + +I_10M_16K = np.array([ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 30, + 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, + 52, 55, 58, 61, 64, 67, 70, 73, 76, 80, + 84, 88, 92, 96, 101, 106, 111, 116, 121, 127, + 133, 139, 146, 153, 160 +]) + +I_10M_24K = np.array([ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 25, 27, 29, 31, 33, 35, + 37, 39, 41, 43, 46, 49, 52, 55, 58, 61, + 64, 68, 72, 76, 80, 85, 90, 95, 100, 106, + 112, 118, 125, 132, 139, 147, 155, 164, 173, 183, + 193, 204, 215, 227, 240 +]) + +I_10M_32K = np.array([ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, + 41, 44, 47, 50, 53, 56, 60, 64, 68, 72, + 76, 81, 86, 91, 97, 103, 109, 116, 123, 131, + 139, 148, 157, 166, 176, 187, 199, 211, 224, 238, + 252, 268, 284, 302, 320 +]) + +I_10M_48K = np.array([ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, + 22, 24, 26, 28, 30, 32, 34, 36, 39, 42, + 45, 48, 51, 55, 59, 63, 67, 71, 76, 81, + 86, 92, 98, 105, 112, 119, 127, 135, 144, 154, + 164, 175, 186, 198, 211, 225, 240, 256, 273, 291, + 310, 330, 352, 375, 400 +]) + +I_10M_48K_HR = np.array([ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 19, 21, + 23, 25, 27, 29, 31, 33, 36, 39, 42, 45, + 48, 51, 55, 59, 63, 67, 72, 77, 83, 89, + 95, 101, 108, 116, 124, 133, 142, 152, 163, 174, + 187, 200, 214, 229, 244, 262, 280, 299, 320, 343, + 367, 392, 419, 449, 480 +]) + +I_10M_96K_HR = np.array([ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, + 28, 30, 33, 36, 39, 42, 46, 50, 54, 59, + 64, 69, 75, 82, 89, 96, 104, 113, 122, 132, + 143, 155, 168, 181, 196, 213, 230, 249, 270, 292, + 316, 342, 371, 401, 434, 470, 509, 551, 596, 646, + 699, 757, 819, 887, 960 +]) + +I = [ [ I_2M5_8K, I_2M5_16K, I_2M5_24K, I_2M5_32K, I_2M5_48K, + I_2M5_48K_HR, I_2M5_96K_HR ], + + [ I_5M_8K , I_5M_16K , I_5M_24K , I_5M_32K , I_5M_48K , + I_5M_48K_HR, I_5M_96K_HR ], + [ I_7M5_8K, I_7M5_16K, I_7M5_24K, I_7M5_32K, I_7M5_48K ], - [ I_10M_8K, I_10M_16K, I_10M_24K, I_10M_32K, I_10M_48K ] ] + + [ I_10M_8K, I_10M_16K, I_10M_24K, I_10M_32K, I_10M_48K, + I_10M_48K_HR, I_10M_96K_HR ] ] + ### LC3 PLUS - 5.9.2 ### @@ -412,6 +470,192 @@ W_2M5_48K = np.array([ 9.47011816e-03, 6.99126548e-03, 4.77524515e-03, 2.75074638e-03, ]) +W_2M5_48K_HR = np.array([ + 1.92887526e-07, 1.26862312e-06, 3.73694297e-06, 8.64938647e-06, + 1.75249988e-05, 3.25100409e-05, 5.65499504e-05, 9.35865319e-05, + 1.48780979e-04, 2.28761899e-04, 3.41896375e-04, 4.98580979e-04, + 7.11548259e-04, 9.96182440e-04, 1.37083745e-03, 1.85714674e-03, + 2.48031598e-03, 3.26938415e-03, 4.25744150e-03, 5.48178842e-03, + 6.98402245e-03, 8.81003775e-03, 1.10099232e-02, 1.36377569e-02, + 1.67512707e-02, 2.04114113e-02, 2.46817525e-02, 2.96278261e-02, + 3.53163108e-02, 4.18141559e-02, 4.91876006e-02, 5.75011559e-02, + 6.68165460e-02, 7.71916136e-02, 8.86792317e-02, 1.01326235e-01, + 1.15172401e-01, 1.30249396e-01, 1.46579877e-01, 1.64176553e-01, + 1.83041364e-01, 2.03164726e-01, 2.24524856e-01, 2.47087196e-01, + 2.70803988e-01, 2.95613915e-01, 3.21442008e-01, 3.48199695e-01, + 3.75785023e-01, 4.04083431e-01, 4.32968378e-01, 4.62302625e-01, + 4.91939783e-01, 5.21726012e-01, 5.51502347e-01, 5.81106782e-01, + 6.10377192e-01, 6.39154077e-01, 6.67283058e-01, 6.94617987e-01, + 7.21023440e-01, 7.46377110e-01, 7.70571768e-01, 7.93517113e-01, + 8.15140784e-01, 8.35389018e-01, 8.54227006e-01, 8.71638596e-01, + 8.87625158e-01, 9.02204990e-01, 9.15411413e-01, 9.27291155e-01, + 9.37902570e-01, 9.47313428e-01, 9.55598950e-01, 9.62839723e-01, + 9.69119847e-01, 9.74524975e-01, 9.79140759e-01, 9.83051181e-01, + 9.86337543e-01, 9.89076972e-01, 9.91342008e-01, 9.93199587e-01, + 9.94710743e-01, 9.95930433e-01, 9.96907234e-01, 9.97683644e-01, + 9.98296261e-01, 9.98776138e-01, 9.99149203e-01, 9.99436796e-01, + 9.99656200e-01, 9.99821365e-01, 9.99943137e-01, 1.00003016e+00, + 1.00008917e+00, 1.00012529e+00, 1.00014281e+00, 1.00014508e+00, + 1.00013494e+00, 1.00011492e+00, 1.00008726e+00, 1.00005412e+00, + 1.00001764e+00, 9.99979734e-01, 9.99942362e-01, 9.99907196e-01, + 9.99876022e-01, 9.99850094e-01, 9.99830663e-01, 9.99818563e-01, + 9.99814391e-01, 9.99818325e-01, 9.99830186e-01, 9.99849498e-01, + 9.99875486e-01, 9.99906898e-01, 9.99942422e-01, 9.99980509e-01, + 1.00001943e+00, 1.00005758e+00, 1.00009310e+00, 1.00012457e+00, + 1.00015044e+00, 1.00016987e+00, 1.00018167e+00, 1.00018561e+00, + 1.00018144e+00, 1.00016928e+00, 1.00014985e+00, 1.00012374e+00, + 1.00009227e+00, 1.00005662e+00, 1.00001836e+00, 9.99978960e-01, + 9.99939740e-01, 9.99902129e-01, 9.99867082e-01, 9.99835134e-01, + 9.99806285e-01, 9.99779761e-01, 9.99753773e-01, 9.99725282e-01, + 9.99689877e-01, 9.99641180e-01, 9.99570787e-01, 9.99467850e-01, + 9.99318600e-01, 9.99105930e-01, 9.98809040e-01, 9.98403072e-01, + 9.97858584e-01, 9.97141182e-01, 9.96211350e-01, 9.95023966e-01, + 9.93528485e-01, 9.91668522e-01, 9.89382327e-01, 9.86602664e-01, + 9.83257711e-01, 9.79271173e-01, 9.74563420e-01, 9.69052374e-01, + 9.62654769e-01, 9.55287457e-01, 9.46869195e-01, 9.37322080e-01, + 9.26573634e-01, 9.14558887e-01, 9.01221931e-01, 8.86518419e-01, + 8.70416999e-01, 8.52901220e-01, 8.33971083e-01, 8.13643873e-01, + 7.91955233e-01, 7.68959403e-01, 7.44728804e-01, 7.19353676e-01, + 6.92940772e-01, 6.65611804e-01, 6.37501359e-01, 6.08754635e-01, + 5.79524696e-01, 5.49970031e-01, 5.20251453e-01, 4.90529478e-01, + 4.60961968e-01, 4.31701392e-01, 4.02893007e-01, 3.74672860e-01, + 3.47166419e-01, 3.20487350e-01, 2.94736743e-01, 2.70002425e-01, + 2.46358722e-01, 2.23866433e-01, 2.02572897e-01, 1.82512373e-01, + 1.63706377e-01, 1.46164373e-01, 1.29884347e-01, 1.14853561e-01, + 1.01049446e-01, 8.84404257e-02, 7.69868940e-02, 6.66421950e-02, + 5.73536530e-02, 4.90636751e-02, 4.17107828e-02, 3.52307148e-02, + 2.95574907e-02, 2.46244166e-02, 2.03650557e-02, 1.67141166e-02, + 1.36082442e-02, 1.09867034e-02, 8.79194960e-03, 6.97008055e-03, + 5.47116203e-03, 4.24943818e-03, 3.26343346e-03, 2.47595203e-03, + 1.85399409e-03, 1.36859657e-03, 9.94618051e-04, 7.10477470e-04, + 4.97864152e-04, 3.41428356e-04, 2.28464938e-04, 1.48598730e-04, + 9.34789787e-05, 5.64894217e-05, 3.24779357e-05, 1.75092246e-05, + 8.64240701e-06, 3.73430225e-06, 1.26786131e-06, 1.92776696e-07, +]) + +W_2M5_96K_HR = np.array([ + 1.36335345e-07, 4.57767612e-07, 9.97567554e-07, 1.84077624e-06, + 3.09224833e-06, 4.88094383e-06, 7.36381799e-06, 1.07300075e-05, + 1.52053863e-05, 2.10575054e-05, 2.86009363e-05, 3.82030121e-05, + 5.02899893e-05, 6.53535899e-05, 8.39579952e-05, 1.06747175e-04, + 1.34452668e-04, 1.67901671e-04, 2.08025551e-04, 2.55868625e-04, + 3.12597229e-04, 3.79509147e-04, 4.58043127e-04, 5.49788703e-04, + 6.56496093e-04, 7.80086033e-04, 9.22659819e-04, 1.08650920e-03, + 1.27412600e-03, 1.48821168e-03, 1.73168664e-03, 2.00769864e-03, + 2.31963093e-03, 2.67111068e-03, 3.06601473e-03, 3.50847607e-03, + 4.00288915e-03, 4.55391267e-03, 5.16647473e-03, 5.84577024e-03, + 6.59726607e-03, 7.42669497e-03, 8.34005512e-03, 9.34360363e-03, + 1.04438523e-02, 1.16475578e-02, 1.29617099e-02, 1.43935224e-02, + 1.59504171e-02, 1.76400058e-02, 1.94700807e-02, 2.14485861e-02, + 2.35835947e-02, 2.58832965e-02, 2.83559617e-02, 3.10099237e-02, + 3.38535421e-02, 3.68951820e-02, 4.01431806e-02, 4.36058082e-02, + 4.72912528e-02, 5.12075722e-02, 5.53626679e-02, 5.97642474e-02, + 6.44197986e-02, 6.93365484e-02, 7.45214298e-02, 7.99810365e-02, + 8.57216269e-02, 9.17490497e-02, 9.80687290e-02, 1.04685634e-01, + 1.11604236e-01, 1.18828513e-01, 1.26361862e-01, 1.34207115e-01, + 1.42366499e-01, 1.50841609e-01, 1.59633383e-01, 1.68742076e-01, + 1.78167209e-01, 1.87907621e-01, 1.97961360e-01, 2.08325714e-01, + 2.18997195e-01, 2.29971498e-01, 2.41243511e-01, 2.52807260e-01, + 2.64655977e-01, 2.76782036e-01, 2.89176911e-01, 3.01831275e-01, + 3.14734906e-01, 3.27876776e-01, 3.41245025e-01, 3.54826927e-01, + 3.68608981e-01, 3.82576853e-01, 3.96715522e-01, 4.11009163e-01, + 4.25441355e-01, 4.39994961e-01, 4.54652220e-01, 4.69394863e-01, + 4.84204173e-01, 4.99060899e-01, 5.13945460e-01, 5.28838038e-01, + 5.43718576e-01, 5.58566749e-01, 5.73362410e-01, 5.88085234e-01, + 6.02715075e-01, 6.17232025e-01, 6.31616414e-01, 6.45848989e-01, + 6.59910858e-01, 6.73783839e-01, 6.87450290e-01, 7.00893283e-01, + 7.14096606e-01, 7.27045000e-01, 7.39724100e-01, 7.52120554e-01, + 7.64221907e-01, 7.76016891e-01, 7.87495315e-01, 7.98648119e-01, + 8.09467375e-01, 8.19946468e-01, 8.30079675e-01, 8.39862764e-01, + 8.49292517e-01, 8.58366787e-01, 8.67084682e-01, 8.75446379e-01, + 8.83453131e-01, 8.91107082e-01, 8.98411512e-01, 9.05370474e-01, + 9.11989033e-01, 9.18272913e-01, 9.24228728e-01, 9.29863691e-01, + 9.35185611e-01, 9.40202892e-01, 9.44924474e-01, 9.49359715e-01, + 9.53518271e-01, 9.57410157e-01, 9.61045623e-01, 9.64435160e-01, + 9.67589259e-01, 9.70518589e-01, 9.73233819e-01, 9.75745618e-01, + 9.78064537e-01, 9.80201006e-01, 9.82165277e-01, 9.83967602e-01, + 9.85617757e-01, 9.87125397e-01, 9.88499880e-01, 9.89750206e-01, + 9.90885139e-01, 9.91913080e-01, 9.92841959e-01, 9.93679583e-01, + 9.94433045e-01, 9.95109439e-01, 9.95715141e-01, 9.96256351e-01, + 9.96738791e-01, 9.97167945e-01, 9.97548699e-01, 9.97885823e-01, + 9.98183608e-01, 9.98446047e-01, 9.98676717e-01, 9.98879075e-01, + 9.99056041e-01, 9.99210536e-01, 9.99344945e-01, 9.99461591e-01, + 9.99562562e-01, 9.99649644e-01, 9.99724448e-01, 9.99788404e-01, + 9.99842882e-01, 9.99888957e-01, 9.99927700e-01, 9.99959946e-01, + 9.99986470e-01, 1.00000799e+00, 1.00002515e+00, 1.00003839e+00, + 1.00004816e+00, 1.00005496e+00, 1.00005913e+00, 1.00006092e+00, + 1.00006080e+00, 1.00005877e+00, 1.00005519e+00, 1.00005031e+00, + 1.00004435e+00, 1.00003731e+00, 1.00002968e+00, 1.00002134e+00, + 1.00001252e+00, 1.00000334e+00, 9.99994040e-01, 9.99984682e-01, + 9.99975443e-01, 9.99966383e-01, 9.99957621e-01, 9.99949336e-01, + 9.99941528e-01, 9.99934316e-01, 9.99927878e-01, 9.99922156e-01, + 9.99917269e-01, 9.99913335e-01, 9.99910295e-01, 9.99908268e-01, + 9.99907196e-01, 9.99907196e-01, 9.99908149e-01, 9.99910176e-01, + 9.99913156e-01, 9.99917090e-01, 9.99921918e-01, 9.99927640e-01, + 9.99934137e-01, 9.99941349e-01, 9.99949217e-01, 9.99957681e-01, + 9.99966562e-01, 9.99975860e-01, 9.99985397e-01, 9.99995112e-01, + 1.00000489e+00, 1.00001454e+00, 1.00002408e+00, 1.00003338e+00, + 1.00004232e+00, 1.00005078e+00, 1.00005865e+00, 1.00006592e+00, + 1.00007236e+00, 1.00007808e+00, 1.00008297e+00, 1.00008690e+00, + 1.00008988e+00, 1.00009179e+00, 1.00009286e+00, 1.00009274e+00, + 1.00009179e+00, 1.00008965e+00, 1.00008667e+00, 1.00008261e+00, + 1.00007772e+00, 1.00007200e+00, 1.00006545e+00, 1.00005817e+00, + 1.00005031e+00, 1.00004172e+00, 1.00003278e+00, 1.00002337e+00, + 1.00001371e+00, 1.00000370e+00, 9.99993682e-01, 9.99983490e-01, + 9.99973357e-01, 9.99963224e-01, 9.99953210e-01, 9.99943376e-01, + 9.99933660e-01, 9.99924064e-01, 9.99914587e-01, 9.99905109e-01, + 9.99895573e-01, 9.99885738e-01, 9.99875546e-01, 9.99864578e-01, + 9.99852657e-01, 9.99839306e-01, 9.99824166e-01, 9.99806523e-01, + 9.99785900e-01, 9.99761462e-01, 9.99732316e-01, 9.99697566e-01, + 9.99655962e-01, 9.99606311e-01, 9.99547124e-01, 9.99476731e-01, + 9.99393344e-01, 9.99294996e-01, 9.99179363e-01, 9.99043941e-01, + 9.98886049e-01, 9.98702645e-01, 9.98490512e-01, 9.98246014e-01, + 9.97965276e-01, 9.97644246e-01, 9.97278214e-01, 9.96862471e-01, + 9.96391773e-01, 9.95860577e-01, 9.95262980e-01, 9.94592726e-01, + 9.93843138e-01, 9.93007302e-01, 9.92077827e-01, 9.91046965e-01, + 9.89906728e-01, 9.88648713e-01, 9.87264156e-01, 9.85744119e-01, + 9.84079301e-01, 9.82260108e-01, 9.80276704e-01, 9.78119195e-01, + 9.75777209e-01, 9.73240614e-01, 9.70498860e-01, 9.67541456e-01, + 9.64357972e-01, 9.60937798e-01, 9.57270682e-01, 9.53346252e-01, + 9.49154437e-01, 9.44685459e-01, 9.39929724e-01, 9.34878111e-01, + 9.29521918e-01, 9.23852861e-01, 9.17863250e-01, 9.11546052e-01, + 9.04894829e-01, 8.97903919e-01, 8.90568554e-01, 8.82884681e-01, + 8.74849200e-01, 8.66460025e-01, 8.57716084e-01, 8.48617196e-01, + 8.39164436e-01, 8.29359889e-01, 8.19206893e-01, 8.08709860e-01, + 7.97874272e-01, 7.86707044e-01, 7.75215983e-01, 7.63410211e-01, + 7.51299858e-01, 7.38896310e-01, 7.26211846e-01, 7.13259816e-01, + 7.00054646e-01, 6.86611593e-01, 6.72946632e-01, 6.59076810e-01, + 6.45019531e-01, 6.30793154e-01, 6.16416335e-01, 6.01908267e-01, + 5.87288618e-01, 5.72577178e-01, 5.57793975e-01, 5.42959273e-01, + 5.28093219e-01, 5.13215959e-01, 4.98347521e-01, 4.83507633e-01, + 4.68715757e-01, 4.53991085e-01, 4.39352304e-01, 4.24817562e-01, + 4.10404533e-01, 3.96130294e-01, 3.82011205e-01, 3.68063033e-01, + 3.54300767e-01, 3.40738595e-01, 3.27390045e-01, 3.14267725e-01, + 3.01383466e-01, 2.88748264e-01, 2.76372313e-01, 2.64264882e-01, + 2.52434462e-01, 2.40888610e-01, 2.29634136e-01, 2.18676925e-01, + 2.08022103e-01, 1.97673932e-01, 1.87635899e-01, 1.77910715e-01, + 1.68500274e-01, 1.59405768e-01, 1.50627658e-01, 1.42165691e-01, + 1.34018898e-01, 1.26185730e-01, 1.18663922e-01, 1.11450672e-01, + 1.04542568e-01, 9.79356542e-02, 9.16254595e-02, 8.56070295e-02, + 7.98749477e-02, 7.44233727e-02, 6.92460760e-02, 6.43364564e-02, + 5.96875995e-02, 5.52923009e-02, 5.11430874e-02, 4.72322591e-02, + 4.35519405e-02, 4.00940813e-02, 3.68505120e-02, 3.38129811e-02, + 3.09731625e-02, 2.83227116e-02, 2.58532818e-02, 2.35565584e-02, + 2.14242823e-02, 1.94482822e-02, 1.76204946e-02, 1.59329921e-02, + 1.43779973e-02, 1.29479105e-02, 1.16353221e-02, 1.04330294e-02, + 9.33405478e-03, 8.33165180e-03, 7.41932075e-03, 6.59081247e-03, + 5.84013900e-03, 5.16157458e-03, 4.54966258e-03, 3.99921415e-03, + 3.50530911e-03, 3.06329457e-03, 2.66878284e-03, 2.31764605e-03, + 2.00601248e-03, 1.73026032e-03, 1.48701016e-03, 1.27311819e-03, + 1.08566787e-03, 9.21960978e-04, 7.79508497e-04, 6.56021410e-04, + 5.49400807e-04, 4.57728049e-04, 3.79254925e-04, 3.12393560e-04, + 2.55706662e-04, 2.07897814e-04, 1.67801816e-04, 1.34375354e-04, + 1.06687941e-04, 8.39131390e-05, 6.53200550e-05, 5.02652765e-05, + 3.81850987e-05, 2.85881870e-05, 2.10486251e-05, 1.51993554e-05, + 1.07260339e-05, 7.36129550e-06, 4.87941543e-06, 3.09137795e-06, + 1.84032115e-06, 9.97358256e-07, 4.57689993e-07, 1.36315705e-07, +]) + W_5M_8K = np.array([ 9.95908659e-04, 3.81905679e-03, 9.54083261e-03, 1.92165980e-02, 3.38271908e-02, 5.42483167e-02, 8.12077767e-02, 1.15217189e-01, @@ -747,6 +991,372 @@ W_5M_48K = np.array([ 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, ]) +W_5M_48K_HR = np.array([ + 9.75247545e-08, 6.41356849e-07, 1.88872264e-06, 4.37003746e-06, + 8.85053487e-06, 1.64097619e-05, 2.85265469e-05, 4.71757776e-05, + 7.49369574e-05, 1.15113864e-04, 1.71864056e-04, 2.50336452e-04, + 3.56814737e-04, 4.98863636e-04, 6.85475010e-04, 9.27209505e-04, + 1.23633002e-03, 1.62692170e-03, 2.11499492e-03, 2.71856366e-03, + 3.45769688e-03, 4.35453700e-03, 5.43327769e-03, 6.72010100e-03, + 8.24306626e-03, 1.00319488e-02, 1.21180220e-02, 1.45337880e-02, + 1.73126478e-02, 2.04885192e-02, 2.40953956e-02, 2.81668510e-02, + 3.27355117e-02, 3.78324650e-02, 4.34866548e-02, 4.97242436e-02, + 5.65679595e-02, 6.40364513e-02, 7.21436515e-02, 8.08981732e-02, + 9.03027356e-02, 1.00353681e-01, 1.11040540e-01, 1.22345708e-01, + 1.34244218e-01, 1.46703660e-01, 1.59684196e-01, 1.73138753e-01, + 1.87013358e-01, 2.01247633e-01, 2.15775400e-01, 2.30525494e-01, + 2.45422661e-01, 2.60388613e-01, 2.75343060e-01, 2.90205121e-01, + 3.04894298e-01, 3.19332004e-01, 3.33442599e-01, 3.47154707e-01, + 3.60402405e-01, 3.73126328e-01, 3.85274231e-01, 3.96802038e-01, + 4.07674283e-01, 4.17864561e-01, 4.27355647e-01, 4.36139554e-01, + 4.44217294e-01, 4.51598674e-01, 4.58301634e-01, 4.64351624e-01, + 4.69781011e-01, 4.74628091e-01, 4.78936344e-01, 4.82753456e-01, + 4.86130476e-01, 4.89120960e-01, 4.91780102e-01, 4.94164050e-01, + 4.96329218e-01, 4.98331696e-01, 5.00226736e-01, 5.02068341e-01, + 5.03908992e-01, 5.05799294e-01, 5.07787943e-01, 5.09921193e-01, + 5.12243330e-01, 5.14795899e-01, 5.17618179e-01, 5.20746589e-01, + 5.24214983e-01, 5.28054178e-01, 5.32292068e-01, 5.36953092e-01, + 5.42058468e-01, 5.47625661e-01, 5.53668439e-01, 5.60196400e-01, + 5.67215025e-01, 5.74725628e-01, 5.82724869e-01, 5.91205239e-01, + 6.00154579e-01, 6.09556615e-01, 6.19390607e-01, 6.29631937e-01, + 6.40252173e-01, 6.51219368e-01, 6.62498534e-01, 6.74051821e-01, + 6.85839176e-01, 6.97818637e-01, 7.09946930e-01, 7.22179890e-01, + 7.34472811e-01, 7.46781170e-01, 7.59061038e-01, 7.71269321e-01, + 7.83364296e-01, 7.95306087e-01, 8.07056785e-01, 8.18580806e-01, + 8.29845190e-01, 8.40819776e-01, 8.51477146e-01, 8.61792982e-01, + 8.71745944e-01, 8.81317794e-01, 8.90493214e-01, 8.99259806e-01, + 9.07608211e-01, 9.15531754e-01, 9.23026323e-01, 9.30090547e-01, + 9.36725318e-01, 9.42933977e-01, 9.48721945e-01, 9.54096615e-01, + 9.59067523e-01, 9.63645637e-01, 9.67843831e-01, 9.71676290e-01, + 9.75158513e-01, 9.78307128e-01, 9.81139660e-01, 9.83674467e-01, + 9.85930443e-01, 9.87926722e-01, 9.89682734e-01, 9.91217852e-01, + 9.92551088e-01, 9.93701279e-01, 9.94686544e-01, 9.95524466e-01, + 9.96231675e-01, 9.96824026e-01, 9.97316301e-01, 9.97722328e-01, + 9.98054802e-01, 9.98325348e-01, 9.98544455e-01, 9.98721540e-01, + 9.98864949e-01, 9.98981953e-01, 9.99078929e-01, 9.99161184e-01, + 9.99233246e-01, 9.99298692e-01, 9.99360621e-01, 9.99421120e-01, + 9.99481916e-01, 9.99544203e-01, 9.99608576e-01, 9.99675393e-01, + 9.99744534e-01, 9.99815881e-01, 9.99888837e-01, 9.99962866e-01, + 1.00003707e+00, 1.00011098e+00, 1.00018346e+00, 1.00025380e+00, + 1.00032115e+00, 1.00038469e+00, 1.00044382e+00, 1.00049770e+00, + 1.00054598e+00, 1.00058782e+00, 1.00062299e+00, 1.00065112e+00, + 1.00067186e+00, 1.00068521e+00, 1.00069082e+00, 1.00068903e+00, + 1.00067961e+00, 1.00066280e+00, 1.00063896e+00, 1.00060833e+00, + 1.00057113e+00, 1.00052810e+00, 1.00047958e+00, 1.00042605e+00, + 1.00036812e+00, 1.00030637e+00, 1.00024164e+00, 1.00017428e+00, + 1.00010526e+00, 1.00003517e+00, 9.99964774e-01, 9.99894679e-01, + 9.99825716e-01, 9.99758482e-01, 9.99693692e-01, 9.99632061e-01, + 9.99574184e-01, 9.99520719e-01, 9.99472201e-01, 9.99429166e-01, + 9.99392092e-01, 9.99361455e-01, 9.99337614e-01, 9.99320924e-01, + 9.99311507e-01, 9.99309599e-01, 9.99315262e-01, 9.99328554e-01, + 9.99349296e-01, 9.99377370e-01, 9.99412537e-01, 9.99454379e-01, + 9.99502480e-01, 9.99556363e-01, 9.99615431e-01, 9.99678969e-01, + 9.99746263e-01, 9.99816597e-01, 9.99889076e-01, 9.99962866e-01, + 1.00003707e+00, 1.00011098e+00, 1.00018346e+00, 1.00025380e+00, + 1.00032115e+00, 1.00038469e+00, 1.00044382e+00, 1.00049770e+00, + 1.00054598e+00, 1.00058782e+00, 1.00062299e+00, 1.00065112e+00, + 1.00067186e+00, 1.00068521e+00, 1.00069082e+00, 1.00068903e+00, + 1.00067961e+00, 1.00066280e+00, 1.00063896e+00, 1.00060833e+00, + 1.00057113e+00, 1.00052810e+00, 1.00047958e+00, 1.00042605e+00, + 1.00036812e+00, 1.00030637e+00, 1.00024164e+00, 1.00017428e+00, + 1.00010526e+00, 1.00003517e+00, 9.99964774e-01, 9.99894679e-01, + 9.99825716e-01, 9.99758482e-01, 9.99693692e-01, 9.99632061e-01, + 9.99574184e-01, 9.99520719e-01, 9.99472201e-01, 9.99429166e-01, + 9.99392092e-01, 9.99361455e-01, 9.99337614e-01, 9.99320924e-01, + 9.99311507e-01, 9.99309599e-01, 9.99315262e-01, 9.99328554e-01, + 9.99349296e-01, 9.99377370e-01, 9.99412537e-01, 9.99454379e-01, + 9.99502480e-01, 9.99556363e-01, 9.99615431e-01, 9.99678969e-01, + 9.99746263e-01, 9.99816597e-01, 9.99889076e-01, 9.99962866e-01, + 1.00003707e+00, 1.00011075e+00, 1.00018275e+00, 1.00025201e+00, + 1.00031757e+00, 1.00037789e+00, 1.00043166e+00, 1.00047719e+00, + 1.00051260e+00, 1.00053585e+00, 1.00054419e+00, 1.00053477e+00, + 1.00050414e+00, 1.00044823e+00, 1.00036228e+00, 1.00024092e+00, + 1.00007784e+00, 9.99865890e-01, 9.99597013e-01, 9.99261975e-01, + 9.98850465e-01, 9.98351038e-01, 9.97750819e-01, 9.97035682e-01, + 9.96189833e-01, 9.95196044e-01, 9.94035423e-01, 9.92687285e-01, + 9.91129041e-01, 9.89336133e-01, 9.87281919e-01, 9.84937787e-01, + 9.82272744e-01, 9.79253709e-01, 9.75845337e-01, 9.72010076e-01, + 9.67708528e-01, 9.62899387e-01, 9.57539737e-01, 9.51585472e-01, + 9.44991708e-01, 9.37713265e-01, 9.29705381e-01, 9.20924187e-01, + 9.11327481e-01, 9.00875807e-01, 8.89532745e-01, 8.77266228e-01, + 8.64049077e-01, 8.49859893e-01, 8.34683776e-01, 8.18513036e-01, + 8.01347792e-01, 7.83196509e-01, 7.64076352e-01, 7.44013488e-01, + 7.23043203e-01, 7.01209962e-01, 6.78567350e-01, 6.55177712e-01, + 6.31111801e-01, 6.06448233e-01, 5.81272960e-01, 5.55678487e-01, + 5.29762745e-01, 5.03628492e-01, 4.77382004e-01, 4.51132149e-01, + 4.24988985e-01, 3.99062574e-01, 3.73461813e-01, 3.48293066e-01, + 3.23658854e-01, 2.99656719e-01, 2.76377857e-01, 2.53906131e-01, + 2.32316986e-01, 2.11676583e-01, 1.92040950e-01, 1.73455566e-01, + 1.55954808e-01, 1.39561892e-01, 1.24288827e-01, 1.10136725e-01, + 9.70961973e-02, 8.51479918e-02, 7.42638558e-02, 6.44074306e-02, + 5.55353425e-02, 4.75983508e-02, 4.05424982e-02, 3.43103148e-02, + 2.88419761e-02, 2.40764078e-02, 1.99523065e-02, 1.64090749e-02, + 1.33876354e-02, 1.08311241e-02, 8.68547149e-03, 6.89984858e-03, + 5.42699778e-03, 4.22345474e-03, 3.24966502e-03, 2.47000973e-03, + 1.85274973e-03, 1.36990519e-03, 9.97077208e-04, 7.13227608e-04, + 5.00426511e-04, 3.43578606e-04, 2.30138365e-04, 1.49821601e-04, + 9.43217892e-05, 5.70367956e-05, 3.28110509e-05, 1.76969679e-05, + 8.73827867e-06, 3.77677043e-06, 1.28252009e-06, 1.95021386e-07, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, +]) + +W_5M_96K_HR = np.array([ + 6.89548827e-08, 2.31516253e-07, 5.04477669e-07, 9.30795125e-07, + 1.56340695e-06, 2.46738750e-06, 3.72189174e-06, 5.42224188e-06, + 7.68219343e-06, 1.06363877e-05, 1.44429905e-05, 1.92865264e-05, + 2.53808976e-05, 3.29725954e-05, 4.23441015e-05, 5.38174427e-05, + 6.77579446e-05, 8.45781324e-05, 1.04741775e-04, 1.28768093e-04, + 1.57236034e-04, 1.90788676e-04, 2.30137754e-04, 2.76068167e-04, + 3.29442613e-04, 3.91206064e-04, 4.62390453e-04, 5.44119219e-04, + 6.37611491e-04, 7.44186866e-04, 8.65269103e-04, 1.00239040e-03, + 1.15719519e-03, 1.33144355e-03, 1.52701419e-03, 1.74590782e-03, + 1.99024938e-03, 2.26228987e-03, 2.56440835e-03, 2.89911311e-03, + 3.26904119e-03, 3.67696048e-03, 4.12576646e-03, 4.61848313e-03, + 5.15825953e-03, 5.74836833e-03, 6.39220094e-03, 7.09326472e-03, + 7.85517693e-03, 8.68165866e-03, 9.57652833e-03, 1.05436966e-02, + 1.15871523e-02, 1.27109587e-02, 1.39192408e-02, 1.52161736e-02, + 1.66059695e-02, 1.80928707e-02, 1.96811259e-02, 2.13749874e-02, + 2.31786855e-02, 2.50964165e-02, 2.71323286e-02, 2.92905010e-02, + 3.15749235e-02, 3.39894816e-02, 3.65379415e-02, 3.92239206e-02, + 4.20508720e-02, 4.50220704e-02, 4.81405817e-02, 5.14092445e-02, + 5.48306555e-02, 5.84071539e-02, 6.21407814e-02, 6.60332814e-02, + 7.00860694e-02, 7.43002295e-02, 7.86764771e-02, 8.32151473e-02, + 8.79162028e-02, 9.27791744e-02, 9.78031904e-02, 1.02986939e-01, + 1.08328678e-01, 1.13826200e-01, 1.19476855e-01, 1.25277504e-01, + 1.31224588e-01, 1.37314022e-01, 1.43541321e-01, 1.49901465e-01, + 1.56389058e-01, 1.62998185e-01, 1.69722542e-01, 1.76555380e-01, + 1.83489516e-01, 1.90517426e-01, 1.97631180e-01, 2.04822496e-01, + 2.12082773e-01, 2.19403118e-01, 2.26774365e-01, 2.34187096e-01, + 2.41631702e-01, 2.49098375e-01, 2.56577194e-01, 2.64058143e-01, + 2.71531105e-01, 2.78985947e-01, 2.86412567e-01, 2.93800950e-01, + 3.01141053e-01, 3.08423132e-01, 3.15637439e-01, 3.22774589e-01, + 3.29825372e-01, 3.36780816e-01, 3.43632400e-01, 3.50371778e-01, + 3.56991231e-01, 3.63483250e-01, 3.69840890e-01, 3.76057625e-01, + 3.82127434e-01, 3.88044775e-01, 3.93804729e-01, 3.99402857e-01, + 4.04835284e-01, 4.10098761e-01, 4.15190488e-01, 4.20108408e-01, + 4.24850911e-01, 4.29417044e-01, 4.33806360e-01, 4.38019037e-01, + 4.42055762e-01, 4.45917755e-01, 4.49606776e-01, 4.53125089e-01, + 4.56475437e-01, 4.59661037e-01, 4.62685496e-01, 4.65552896e-01, + 4.68267679e-01, 4.70834643e-01, 4.73258942e-01, 4.75546002e-01, + 4.77701575e-01, 4.79731590e-01, 4.81642276e-01, 4.83440012e-01, + 4.85131353e-01, 4.86723036e-01, 4.88221824e-01, 4.89634633e-01, + 4.90968436e-01, 4.92230296e-01, 4.93427187e-01, 4.94566232e-01, + 4.95654404e-01, 4.96698737e-01, 4.97706175e-01, 4.98683631e-01, + 4.99637932e-01, 5.00575840e-01, 5.01503944e-01, 5.02428830e-01, + 5.03356874e-01, 5.04294455e-01, 5.05247772e-01, 5.06222844e-01, + 5.07225573e-01, 5.08261740e-01, 5.09337008e-01, 5.10456860e-01, + 5.11626601e-01, 5.12851536e-01, 5.14136553e-01, 5.15486538e-01, + 5.16906321e-01, 5.18400311e-01, 5.19972920e-01, 5.21628320e-01, + 5.23370624e-01, 5.25203526e-01, 5.27130723e-01, 5.29155731e-01, + 5.31281710e-01, 5.33511758e-01, 5.35848677e-01, 5.38295090e-01, + 5.40853441e-01, 5.43525815e-01, 5.46314240e-01, 5.49220264e-01, + 5.52245498e-01, 5.55391014e-01, 5.58657765e-01, 5.62046468e-01, + 5.65557480e-01, 5.69190919e-01, 5.72946727e-01, 5.76824427e-01, + 5.80823362e-01, 5.84942579e-01, 5.89180827e-01, 5.93536615e-01, + 5.98008096e-01, 6.02593303e-01, 6.07289851e-01, 6.12095237e-01, + 6.17006540e-01, 6.22020781e-01, 6.27134562e-01, 6.32344365e-01, + 6.37646437e-01, 6.43036783e-01, 6.48511291e-01, 6.54065490e-01, + 6.59694970e-01, 6.65394902e-01, 6.71160460e-01, 6.76986754e-01, + 6.82868540e-01, 6.88800693e-01, 6.94777906e-01, 7.00794756e-01, + 7.06845820e-01, 7.12925553e-01, 7.19028473e-01, 7.25149035e-01, + 7.31281698e-01, 7.37420917e-01, 7.43561149e-01, 7.49696970e-01, + 7.55823016e-01, 7.61933863e-01, 7.68024206e-01, 7.74088979e-01, + 7.80123055e-01, 7.86121488e-01, 7.92079389e-01, 7.97992110e-01, + 8.03855121e-01, 8.09663892e-01, 8.15414310e-01, 8.21102202e-01, + 8.26723635e-01, 8.32274854e-01, 8.37752342e-01, 8.43152702e-01, + 8.48472714e-01, 8.53709280e-01, 8.58859718e-01, 8.63921225e-01, + 8.68891478e-01, 8.73768151e-01, 8.78549099e-01, 8.83232594e-01, + 8.87816727e-01, 8.92300129e-01, 8.96681368e-01, 9.00959313e-01, + 9.05132890e-01, 9.09201384e-01, 9.13164079e-01, 9.17020440e-01, + 9.20770228e-01, 9.24413145e-01, 9.27949250e-01, 9.31378603e-01, + 9.34701502e-01, 9.37918305e-01, 9.41029668e-01, 9.44036126e-01, + 9.46938515e-01, 9.49737847e-01, 9.52435017e-01, 9.55031335e-01, + 9.57527936e-01, 9.59926248e-01, 9.62227762e-01, 9.64434028e-01, + 9.66546714e-01, 9.68567610e-01, 9.70498502e-01, 9.72341299e-01, + 9.74098027e-01, 9.75770652e-01, 9.77361381e-01, 9.78872299e-01, + 9.80305672e-01, 9.81663704e-01, 9.82948720e-01, 9.84162986e-01, + 9.85308945e-01, 9.86388862e-01, 9.87405181e-01, 9.88360226e-01, + 9.89256442e-01, 9.90096152e-01, 9.90881741e-01, 9.91615593e-01, + 9.92299914e-01, 9.92937148e-01, 9.93529499e-01, 9.94079232e-01, + 9.94588435e-01, 9.95059371e-01, 9.95494127e-01, 9.95894730e-01, + 9.96263146e-01, 9.96601343e-01, 9.96911168e-01, 9.97194529e-01, + 9.97453094e-01, 9.97688591e-01, 9.97902572e-01, 9.98096704e-01, + 9.98272479e-01, 9.98431206e-01, 9.98574317e-01, 9.98703122e-01, + 9.98818815e-01, 9.98922586e-01, 9.99015450e-01, 9.99098480e-01, + 9.99172688e-01, 9.99238908e-01, 9.99298036e-01, 9.99350786e-01, + 9.99397993e-01, 9.99440193e-01, 9.99478102e-01, 9.99512255e-01, + 9.99543130e-01, 9.99571264e-01, 9.99597073e-01, 9.99620855e-01, + 9.99643087e-01, 9.99663949e-01, 9.99683797e-01, 9.99702871e-01, + 9.99721289e-01, 9.99739230e-01, 9.99756932e-01, 9.99774456e-01, + 9.99791920e-01, 9.99809384e-01, 9.99826908e-01, 9.99844551e-01, + 9.99862373e-01, 9.99880314e-01, 9.99898374e-01, 9.99916673e-01, + 9.99935031e-01, 9.99953508e-01, 9.99972105e-01, 9.99990702e-01, + 1.00000930e+00, 1.00002778e+00, 1.00004625e+00, 1.00006461e+00, + 1.00008273e+00, 1.00010061e+00, 1.00011826e+00, 1.00013554e+00, + 1.00015235e+00, 1.00016880e+00, 1.00018466e+00, 1.00020003e+00, + 1.00021482e+00, 1.00022900e+00, 1.00024247e+00, 1.00025523e+00, + 1.00026727e+00, 1.00027859e+00, 1.00028908e+00, 1.00029874e+00, + 1.00030744e+00, 1.00031543e+00, 1.00032246e+00, 1.00032854e+00, + 1.00033379e+00, 1.00033808e+00, 1.00034130e+00, 1.00034368e+00, + 1.00034511e+00, 1.00034559e+00, 1.00034511e+00, 1.00034368e+00, + 1.00034142e+00, 1.00033808e+00, 1.00033391e+00, 1.00032878e+00, + 1.00032282e+00, 1.00031602e+00, 1.00030828e+00, 1.00029981e+00, + 1.00029051e+00, 1.00028050e+00, 1.00026977e+00, 1.00025833e+00, + 1.00024617e+00, 1.00023329e+00, 1.00021994e+00, 1.00020599e+00, + 1.00019157e+00, 1.00017655e+00, 1.00016105e+00, 1.00014532e+00, + 1.00012910e+00, 1.00011253e+00, 1.00009573e+00, 1.00007868e+00, + 1.00006139e+00, 1.00004399e+00, 1.00002646e+00, 1.00000882e+00, + 9.99991179e-01, 9.99973595e-01, 9.99956071e-01, 9.99938667e-01, + 9.99921381e-01, 9.99904335e-01, 9.99887526e-01, 9.99870956e-01, + 9.99854743e-01, 9.99838948e-01, 9.99823511e-01, 9.99808550e-01, + 9.99794066e-01, 9.99780118e-01, 9.99766707e-01, 9.99753952e-01, + 9.99741793e-01, 9.99730289e-01, 9.99719560e-01, 9.99709487e-01, + 9.99700248e-01, 9.99691784e-01, 9.99684095e-01, 9.99677300e-01, + 9.99671280e-01, 9.99666214e-01, 9.99662042e-01, 9.99658763e-01, + 9.99656379e-01, 9.99655008e-01, 9.99654531e-01, 9.99654949e-01, + 9.99656379e-01, 9.99658763e-01, 9.99662101e-01, 9.99666333e-01, + 9.99671519e-01, 9.99677658e-01, 9.99684691e-01, 9.99692619e-01, + 9.99701381e-01, 9.99711037e-01, 9.99721527e-01, 9.99732792e-01, + 9.99744833e-01, 9.99757588e-01, 9.99771118e-01, 9.99785244e-01, + 9.99800026e-01, 9.99815404e-01, 9.99831259e-01, 9.99847651e-01, + 9.99864519e-01, 9.99881744e-01, 9.99899328e-01, 9.99917269e-01, + 9.99935389e-01, 9.99953687e-01, 9.99972165e-01, 9.99990702e-01, + 1.00000930e+00, 1.00002778e+00, 1.00004625e+00, 1.00006461e+00, + 1.00008273e+00, 1.00010061e+00, 1.00011826e+00, 1.00013554e+00, + 1.00015235e+00, 1.00016880e+00, 1.00018466e+00, 1.00020003e+00, + 1.00021482e+00, 1.00022900e+00, 1.00024247e+00, 1.00025523e+00, + 1.00026727e+00, 1.00027859e+00, 1.00028908e+00, 1.00029874e+00, + 1.00030744e+00, 1.00031543e+00, 1.00032246e+00, 1.00032854e+00, + 1.00033379e+00, 1.00033808e+00, 1.00034130e+00, 1.00034368e+00, + 1.00034511e+00, 1.00034559e+00, 1.00034511e+00, 1.00034368e+00, + 1.00034142e+00, 1.00033808e+00, 1.00033391e+00, 1.00032878e+00, + 1.00032282e+00, 1.00031602e+00, 1.00030828e+00, 1.00029981e+00, + 1.00029051e+00, 1.00028050e+00, 1.00026977e+00, 1.00025833e+00, + 1.00024617e+00, 1.00023329e+00, 1.00021994e+00, 1.00020599e+00, + 1.00019157e+00, 1.00017655e+00, 1.00016105e+00, 1.00014532e+00, + 1.00012910e+00, 1.00011253e+00, 1.00009573e+00, 1.00007868e+00, + 1.00006139e+00, 1.00004399e+00, 1.00002646e+00, 1.00000882e+00, + 9.99991179e-01, 9.99973595e-01, 9.99956071e-01, 9.99938667e-01, + 9.99921381e-01, 9.99904335e-01, 9.99887526e-01, 9.99870956e-01, + 9.99854743e-01, 9.99838948e-01, 9.99823511e-01, 9.99808550e-01, + 9.99794066e-01, 9.99780118e-01, 9.99766707e-01, 9.99753952e-01, + 9.99741793e-01, 9.99730289e-01, 9.99719560e-01, 9.99709487e-01, + 9.99700248e-01, 9.99691784e-01, 9.99684095e-01, 9.99677300e-01, + 9.99671280e-01, 9.99666214e-01, 9.99662042e-01, 9.99658763e-01, + 9.99656379e-01, 9.99655008e-01, 9.99654531e-01, 9.99654949e-01, + 9.99656379e-01, 9.99658763e-01, 9.99662101e-01, 9.99666333e-01, + 9.99671519e-01, 9.99677658e-01, 9.99684691e-01, 9.99692619e-01, + 9.99701381e-01, 9.99711037e-01, 9.99721527e-01, 9.99732792e-01, + 9.99744833e-01, 9.99757588e-01, 9.99771118e-01, 9.99785244e-01, + 9.99800026e-01, 9.99815404e-01, 9.99831259e-01, 9.99847651e-01, + 9.99864519e-01, 9.99881744e-01, 9.99899328e-01, 9.99917269e-01, + 9.99935389e-01, 9.99953687e-01, 9.99972165e-01, 9.99990702e-01, + 1.00000930e+00, 1.00002778e+00, 1.00004613e+00, 1.00006425e+00, + 1.00008214e+00, 1.00009966e+00, 1.00011683e+00, 1.00013340e+00, + 1.00014925e+00, 1.00016439e+00, 1.00017869e+00, 1.00019193e+00, + 1.00020397e+00, 1.00021482e+00, 1.00022411e+00, 1.00023162e+00, + 1.00023735e+00, 1.00024080e+00, 1.00024199e+00, 1.00024033e+00, + 1.00023568e+00, 1.00022769e+00, 1.00021589e+00, 1.00020003e+00, + 1.00017941e+00, 1.00015378e+00, 1.00012243e+00, 1.00008476e+00, + 1.00004041e+00, 9.99988317e-01, 9.99928057e-01, 9.99858677e-01, + 9.99779403e-01, 9.99689281e-01, 9.99587417e-01, 9.99472737e-01, + 9.99344110e-01, 9.99200404e-01, 9.99040425e-01, 9.98862803e-01, + 9.98666167e-01, 9.98449087e-01, 9.98209953e-01, 9.97947097e-01, + 9.97658968e-01, 9.97343540e-01, 9.96999085e-01, 9.96623516e-01, + 9.96214747e-01, 9.95770633e-01, 9.95288789e-01, 9.94766831e-01, + 9.94202256e-01, 9.93592501e-01, 9.92934704e-01, 9.92226064e-01, + 9.91463542e-01, 9.90644097e-01, 9.89764392e-01, 9.88821149e-01, + 9.87810850e-01, 9.86729801e-01, 9.85574305e-01, 9.84340370e-01, + 9.83024001e-01, 9.81621027e-01, 9.80127096e-01, 9.78537738e-01, + 9.76848423e-01, 9.75054383e-01, 9.73150730e-01, 9.71132576e-01, + 9.68994796e-01, 9.66732204e-01, 9.64339435e-01, 9.61811244e-01, + 9.59142029e-01, 9.56326306e-01, 9.53358531e-01, 9.50233042e-01, + 9.46944118e-01, 9.43486214e-01, 9.39853668e-01, 9.36040819e-01, + 9.32042122e-01, 9.27852154e-01, 9.23465431e-01, 9.18876767e-01, + 9.14081097e-01, 9.09073353e-01, 9.03848886e-01, 8.98403168e-01, + 8.92731845e-01, 8.86831045e-01, 8.80696952e-01, 8.74326289e-01, + 8.67715955e-01, 8.60863328e-01, 8.53766203e-01, 8.46422672e-01, + 8.38831365e-01, 8.30991328e-01, 8.22902203e-01, 8.14563930e-01, + 8.05977046e-01, 7.97142744e-01, 7.88062632e-01, 7.78738797e-01, + 7.69173980e-01, 7.59371519e-01, 7.49335289e-01, 7.39069760e-01, + 7.28579819e-01, 7.17871130e-01, 7.06949770e-01, 6.95822597e-01, + 6.84496701e-01, 6.72980070e-01, 6.61280870e-01, 6.49408042e-01, + 6.37370944e-01, 6.25179410e-01, 6.12843752e-01, 6.00374699e-01, + 5.87783396e-01, 5.75081468e-01, 5.62280834e-01, 5.49393654e-01, + 5.36432624e-01, 5.23410499e-01, 5.10340393e-01, 4.97235566e-01, + 4.84109521e-01, 4.70975846e-01, 4.57848251e-01, 4.44740474e-01, + 4.31666315e-01, 4.18639511e-01, 4.05673832e-01, 3.92782807e-01, + 3.79979968e-01, 3.67278606e-01, 3.54691803e-01, 3.42232376e-01, + 3.29912812e-01, 3.17745358e-01, 3.05741847e-01, 2.93913603e-01, + 2.82271683e-01, 2.70826548e-01, 2.59588152e-01, 2.48565957e-01, + 2.37768814e-01, 2.27205008e-01, 2.16882199e-01, 2.06807390e-01, + 1.96986943e-01, 1.87426537e-01, 1.78131178e-01, 1.69105172e-01, + 1.60352126e-01, 1.51874945e-01, 1.43675804e-01, 1.35756254e-01, + 1.28117070e-01, 1.20758407e-01, 1.13679729e-01, 1.06879868e-01, + 1.00357018e-01, 9.41087753e-02, 8.81321430e-02, 8.24235976e-02, + 7.69790635e-02, 7.17940032e-02, 6.68634027e-02, 6.21818379e-02, + 5.77434972e-02, 5.35422154e-02, 4.95715141e-02, 4.58246432e-02, + 4.22946103e-02, 3.89742292e-02, 3.58561426e-02, 3.29328589e-02, + 3.01968064e-02, 2.76403390e-02, 2.52557844e-02, 2.30354760e-02, + 2.09717732e-02, 1.90570969e-02, 1.72839500e-02, 1.56449396e-02, + 1.41328052e-02, 1.27404351e-02, 1.14608845e-02, 1.02873892e-02, + 9.21338331e-03, 8.23251065e-03, 7.33863330e-03, 6.52584061e-03, + 5.78845851e-03, 5.12105133e-03, 4.51842742e-03, 3.97564145e-03, + 3.48799396e-03, 3.05103138e-03, 2.66054412e-03, 2.31256452e-03, + 2.00336217e-03, 1.72943878e-03, 1.48752402e-03, 1.27456791e-03, + 1.08773448e-03, 9.24394117e-04, 7.82115792e-04, 6.58658682e-04, + 5.51963516e-04, 4.60143900e-04, 3.81477352e-04, 3.14396282e-04, + 2.57478940e-04, 2.09440448e-04, 1.69123945e-04, 1.35491777e-04, + 1.07617016e-04, 8.46750627e-05, 6.59356156e-05, 5.07548866e-05, + 3.85681342e-05, 2.88825358e-05, 2.12704090e-05, 1.53627971e-05, + 1.08434460e-05, 7.44312956e-06, 4.93438165e-06, 3.12659085e-06, + 1.86147406e-06, 1.00890213e-06, 4.63012810e-07, 1.37904777e-07, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, +]) + ### LC3 - 3.7.3 ### W_7M5_8K = np.array([ @@ -1899,6 +2509,732 @@ W_10M_48K = np.array([ 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, ]) +W_10M_48K_HR = np.array([ + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 9.42341174e-08, 6.19838374e-07, 1.82603810e-06, 4.22741550e-06, + 8.56822135e-06, 1.59013834e-05, 2.76738483e-05, 4.58246141e-05, + 7.28956657e-05, 1.12155336e-04, 1.67733029e-04, 2.44763592e-04, + 3.49539070e-04, 4.89664846e-04, 6.74216484e-04, 9.13893222e-04, + 1.22116262e-03, 1.61039189e-03, 2.09795963e-03, 2.70234118e-03, + 3.44416290e-03, 4.34621749e-03, 5.43343695e-03, 6.73281262e-03, + 8.27326626e-03, 1.00854570e-02, 1.22015327e-02, 1.46548180e-02, + 1.74794346e-02, 2.07098722e-02, 2.43804958e-02, 2.85249949e-02, + 3.31758074e-02, 3.83635014e-02, 4.41161096e-02, 5.04585020e-02, + 5.74117042e-02, 6.49922863e-02, 7.32117295e-02, 8.20759088e-02, + 9.15845558e-02, 1.01730898e-01, 1.12501279e-01, 1.23875007e-01, + 1.35824218e-01, 1.48313895e-01, 1.61302090e-01, 1.74740151e-01, + 1.88573152e-01, 2.02740535e-01, 2.17176691e-01, 2.31811777e-01, + 2.46572644e-01, 2.61383832e-01, 2.76168495e-01, 2.90849626e-01, + 3.05351138e-01, 3.19598824e-01, 3.33521664e-01, 3.47052664e-01, + 3.60129982e-01, 3.72697920e-01, 3.84707332e-01, 3.96116525e-01, + 4.06891733e-01, 4.17007536e-01, 4.26446915e-01, 4.35201406e-01, + 4.43271041e-01, 4.50664014e-01, 4.57396388e-01, 4.63491529e-01, + 4.68979478e-01, 4.73896384e-01, 4.78283674e-01, 4.82187212e-01, + 4.85656589e-01, 4.88744229e-01, 4.91504699e-01, 4.93993789e-01, + 4.96267974e-01, 4.98383760e-01, 5.00396967e-01, 5.02362430e-01, + 5.04333496e-01, 5.06361604e-01, 5.08496106e-01, 5.10783911e-01, + 5.13269365e-01, 5.15994072e-01, 5.18996596e-01, 5.22312462e-01, + 5.25973916e-01, 5.30009925e-01, 5.34445822e-01, 5.39303243e-01, + 5.44600070e-01, 5.50350249e-01, 5.56563497e-01, 5.63245535e-01, + 5.70397854e-01, 5.78017771e-01, 5.86098313e-01, 5.94628513e-01, + 6.03593290e-01, 6.12973869e-01, 6.22747838e-01, 6.32889450e-01, + 6.43370092e-01, 6.54158235e-01, 6.65220201e-01, 6.76520288e-01, + 6.88021243e-01, 6.99684739e-01, 7.11471498e-01, 7.23342001e-01, + 7.35256732e-01, 7.47176409e-01, 7.59062469e-01, 7.70877421e-01, + 7.82584906e-01, 7.94150114e-01, 8.05540025e-01, 8.16723466e-01, + 8.27671409e-01, 8.38356972e-01, 8.48755658e-01, 8.58845115e-01, + 8.68605733e-01, 8.78019989e-01, 8.87072980e-01, 8.95752132e-01, + 9.04047191e-01, 9.11950290e-01, 9.19455826e-01, 9.26560223e-01, + 9.33262229e-01, 9.39562619e-01, 9.45464134e-01, 9.50971425e-01, + 9.56090987e-01, 9.60831106e-01, 9.65201676e-01, 9.69214201e-01, + 9.72881556e-01, 9.76217866e-01, 9.79238510e-01, 9.81959701e-01, + 9.84398544e-01, 9.86572623e-01, 9.88499999e-01, 9.90198970e-01, + 9.91687655e-01, 9.92984235e-01, 9.94106293e-01, 9.95071113e-01, + 9.95895147e-01, 9.96594131e-01, 9.97182965e-01, 9.97675478e-01, + 9.98084545e-01, 9.98421967e-01, 9.98698533e-01, 9.98923838e-01, + 9.99106586e-01, 9.99254227e-01, 9.99373496e-01, 9.99470055e-01, + 9.99548733e-01, 9.99613643e-01, 9.99668002e-01, 9.99714673e-01, + 9.99755740e-01, 9.99792874e-01, 9.99827385e-01, 9.99860168e-01, + 9.99891937e-01, 9.99923110e-01, 9.99953985e-01, 9.99984682e-01, + 1.00001526e+00, 1.00004578e+00, 1.00007617e+00, 1.00010622e+00, + 1.00013602e+00, 1.00016546e+00, 1.00019431e+00, 1.00022256e+00, + 1.00025010e+00, 1.00027692e+00, 1.00030291e+00, 1.00032794e+00, + 1.00035203e+00, 1.00037491e+00, 1.00039685e+00, 1.00041747e+00, + 1.00043690e+00, 1.00045502e+00, 1.00047183e+00, 1.00048721e+00, + 1.00050116e+00, 1.00051367e+00, 1.00052476e+00, 1.00053418e+00, + 1.00054228e+00, 1.00054872e+00, 1.00055361e+00, 1.00055695e+00, + 1.00055885e+00, 1.00055909e+00, 1.00055790e+00, 1.00055504e+00, + 1.00055087e+00, 1.00054502e+00, 1.00053787e+00, 1.00052929e+00, + 1.00051928e+00, 1.00050783e+00, 1.00049520e+00, 1.00048113e+00, + 1.00046599e+00, 1.00044954e+00, 1.00043201e+00, 1.00041330e+00, + 1.00039363e+00, 1.00037301e+00, 1.00035143e+00, 1.00032890e+00, + 1.00030565e+00, 1.00028157e+00, 1.00025690e+00, 1.00023150e+00, + 1.00020564e+00, 1.00017929e+00, 1.00015235e+00, 1.00012517e+00, + 1.00009763e+00, 1.00006998e+00, 1.00004208e+00, 1.00001407e+00, + 9.99985993e-01, 9.99957979e-01, 9.99930084e-01, 9.99902308e-01, + 9.99874830e-01, 9.99847591e-01, 9.99820769e-01, 9.99794364e-01, + 9.99768496e-01, 9.99743164e-01, 9.99718428e-01, 9.99694467e-01, + 9.99671161e-01, 9.99648750e-01, 9.99627173e-01, 9.99606490e-01, + 9.99586821e-01, 9.99568224e-01, 9.99550641e-01, 9.99534249e-01, + 9.99519050e-01, 9.99505103e-01, 9.99492407e-01, 9.99481022e-01, + 9.99471009e-01, 9.99462426e-01, 9.99455214e-01, 9.99449492e-01, + 9.99445200e-01, 9.99442458e-01, 9.99441206e-01, 9.99441504e-01, + 9.99443293e-01, 9.99446690e-01, 9.99451578e-01, 9.99458075e-01, + 9.99466062e-01, 9.99475598e-01, 9.99486566e-01, 9.99499083e-01, + 9.99513030e-01, 9.99528408e-01, 9.99545157e-01, 9.99563277e-01, + 9.99582708e-01, 9.99603331e-01, 9.99625206e-01, 9.99648154e-01, + 9.99672174e-01, 9.99697208e-01, 9.99723136e-01, 9.99749959e-01, + 9.99777496e-01, 9.99805748e-01, 9.99834597e-01, 9.99863982e-01, + 9.99893785e-01, 9.99923885e-01, 9.99954224e-01, 9.99984741e-01, + 1.00001526e+00, 1.00004578e+00, 1.00007617e+00, 1.00010622e+00, + 1.00013602e+00, 1.00016546e+00, 1.00019431e+00, 1.00022256e+00, + 1.00025010e+00, 1.00027692e+00, 1.00030291e+00, 1.00032794e+00, + 1.00035203e+00, 1.00037491e+00, 1.00039685e+00, 1.00041747e+00, + 1.00043690e+00, 1.00045502e+00, 1.00047183e+00, 1.00048721e+00, + 1.00050116e+00, 1.00051367e+00, 1.00052476e+00, 1.00053418e+00, + 1.00054228e+00, 1.00054872e+00, 1.00055361e+00, 1.00055695e+00, + 1.00055885e+00, 1.00055909e+00, 1.00055790e+00, 1.00055504e+00, + 1.00055087e+00, 1.00054502e+00, 1.00053787e+00, 1.00052929e+00, + 1.00051928e+00, 1.00050783e+00, 1.00049520e+00, 1.00048113e+00, + 1.00046599e+00, 1.00044954e+00, 1.00043201e+00, 1.00041330e+00, + 1.00039363e+00, 1.00037301e+00, 1.00035143e+00, 1.00032890e+00, + 1.00030565e+00, 1.00028157e+00, 1.00025690e+00, 1.00023150e+00, + 1.00020564e+00, 1.00017929e+00, 1.00015235e+00, 1.00012517e+00, + 1.00009763e+00, 1.00006998e+00, 1.00004208e+00, 1.00001407e+00, + 9.99985993e-01, 9.99957979e-01, 9.99930084e-01, 9.99902308e-01, + 9.99874830e-01, 9.99847591e-01, 9.99820769e-01, 9.99794364e-01, + 9.99768496e-01, 9.99743164e-01, 9.99718428e-01, 9.99694467e-01, + 9.99671161e-01, 9.99648750e-01, 9.99627173e-01, 9.99606490e-01, + 9.99586821e-01, 9.99568224e-01, 9.99550641e-01, 9.99534249e-01, + 9.99519050e-01, 9.99505103e-01, 9.99492407e-01, 9.99481022e-01, + 9.99471009e-01, 9.99462426e-01, 9.99455214e-01, 9.99449492e-01, + 9.99445200e-01, 9.99442458e-01, 9.99441206e-01, 9.99441504e-01, + 9.99443293e-01, 9.99446690e-01, 9.99451578e-01, 9.99458075e-01, + 9.99466062e-01, 9.99475598e-01, 9.99486566e-01, 9.99499083e-01, + 9.99513030e-01, 9.99528408e-01, 9.99545157e-01, 9.99563277e-01, + 9.99582708e-01, 9.99603331e-01, 9.99625206e-01, 9.99648154e-01, + 9.99672174e-01, 9.99697208e-01, 9.99723136e-01, 9.99749959e-01, + 9.99777496e-01, 9.99805748e-01, 9.99834597e-01, 9.99863982e-01, + 9.99893785e-01, 9.99923885e-01, 9.99954224e-01, 9.99984741e-01, + 1.00001526e+00, 1.00004578e+00, 1.00007617e+00, 1.00010622e+00, + 1.00013602e+00, 1.00016546e+00, 1.00019431e+00, 1.00022256e+00, + 1.00025010e+00, 1.00027692e+00, 1.00030291e+00, 1.00032794e+00, + 1.00035203e+00, 1.00037491e+00, 1.00039685e+00, 1.00041747e+00, + 1.00043690e+00, 1.00045502e+00, 1.00047183e+00, 1.00048721e+00, + 1.00050116e+00, 1.00051367e+00, 1.00052476e+00, 1.00053418e+00, + 1.00054228e+00, 1.00054872e+00, 1.00055361e+00, 1.00055695e+00, + 1.00055885e+00, 1.00055909e+00, 1.00055790e+00, 1.00055504e+00, + 1.00055087e+00, 1.00054502e+00, 1.00053787e+00, 1.00052929e+00, + 1.00051928e+00, 1.00050783e+00, 1.00049520e+00, 1.00048113e+00, + 1.00046599e+00, 1.00044954e+00, 1.00043201e+00, 1.00041330e+00, + 1.00039363e+00, 1.00037301e+00, 1.00035143e+00, 1.00032890e+00, + 1.00030565e+00, 1.00028157e+00, 1.00025690e+00, 1.00023150e+00, + 1.00020564e+00, 1.00017929e+00, 1.00015235e+00, 1.00012517e+00, + 1.00009763e+00, 1.00006998e+00, 1.00004208e+00, 1.00001407e+00, + 9.99985993e-01, 9.99957979e-01, 9.99930084e-01, 9.99902308e-01, + 9.99874830e-01, 9.99847591e-01, 9.99820769e-01, 9.99794364e-01, + 9.99768496e-01, 9.99743164e-01, 9.99718428e-01, 9.99694467e-01, + 9.99671161e-01, 9.99648750e-01, 9.99627173e-01, 9.99606490e-01, + 9.99586821e-01, 9.99568224e-01, 9.99550641e-01, 9.99534249e-01, + 9.99519050e-01, 9.99505103e-01, 9.99492407e-01, 9.99481022e-01, + 9.99471009e-01, 9.99462426e-01, 9.99455214e-01, 9.99449492e-01, + 9.99445200e-01, 9.99442458e-01, 9.99441206e-01, 9.99441504e-01, + 9.99443293e-01, 9.99446690e-01, 9.99451578e-01, 9.99458075e-01, + 9.99466062e-01, 9.99475598e-01, 9.99486566e-01, 9.99499083e-01, + 9.99513030e-01, 9.99528408e-01, 9.99545157e-01, 9.99563277e-01, + 9.99582708e-01, 9.99603331e-01, 9.99625206e-01, 9.99648154e-01, + 9.99672174e-01, 9.99697208e-01, 9.99723136e-01, 9.99749959e-01, + 9.99777496e-01, 9.99805748e-01, 9.99834597e-01, 9.99863982e-01, + 9.99893785e-01, 9.99923885e-01, 9.99954224e-01, 9.99984741e-01, + 1.00001526e+00, 1.00004554e+00, 1.00007534e+00, 1.00010443e+00, + 1.00013220e+00, 1.00015819e+00, 1.00018132e+00, 1.00020075e+00, + 1.00021482e+00, 1.00022173e+00, 1.00021923e+00, 1.00020432e+00, + 1.00017369e+00, 1.00012279e+00, 1.00004685e+00, 9.99939978e-01, + 9.99795198e-01, 9.99604583e-01, 9.99359250e-01, 9.99048889e-01, + 9.98662114e-01, 9.98186171e-01, 9.97606814e-01, 9.96908367e-01, + 9.96073723e-01, 9.95083988e-01, 9.93918717e-01, 9.92555678e-01, + 9.90970671e-01, 9.89137888e-01, 9.87029374e-01, 9.84615326e-01, + 9.81863916e-01, 9.78741586e-01, 9.75212753e-01, 9.71240282e-01, + 9.66785491e-01, 9.61808383e-01, 9.56268132e-01, 9.50123310e-01, + 9.43332374e-01, 9.35854316e-01, 9.27648962e-01, 9.18677926e-01, + 9.08904910e-01, 8.98296535e-01, 8.86823177e-01, 8.74459147e-01, + 8.61183822e-01, 8.46981943e-01, 8.31844091e-01, 8.15767467e-01, + 7.98755884e-01, 7.80820429e-01, 7.61979520e-01, 7.42259145e-01, + 7.21692860e-01, 7.00321794e-01, 6.78194642e-01, 6.55367255e-01, + 6.31902635e-01, 6.07870460e-01, 5.83346546e-01, 5.58412433e-01, + 5.33154905e-01, 5.07664979e-01, 4.82037485e-01, 4.56370175e-01, + 4.30762708e-01, 4.05315757e-01, 3.80130053e-01, 3.55305195e-01, + 3.30938727e-01, 3.07124883e-01, 2.83953428e-01, 2.61508703e-01, + 2.39868388e-01, 2.19102606e-01, 1.99272946e-01, 1.80431694e-01, + 1.62621215e-01, 1.45873442e-01, 1.30209655e-01, 1.15640387e-01, + 1.02165572e-01, 8.97749513e-02, 7.84486011e-02, 6.81576878e-02, + 5.88653944e-02, 5.05279638e-02, 4.30957973e-02, 3.65146622e-02, + 3.07268873e-02, 2.56725382e-02, 2.12905537e-02, 1.75197981e-02, + 1.43000064e-02, 1.15726292e-02, 9.28153656e-03, 7.37359654e-03, + 5.79912262e-03, 4.51218896e-03, 3.47083295e-03, 2.63714185e-03, + 1.97724649e-03, 1.46123092e-03, 1.06297329e-03, 7.59930001e-04, + 5.32880833e-04, 3.65644053e-04, 2.44775380e-04, 1.59260671e-04, + 1.00211051e-04, 6.05685127e-05, 3.48275607e-05, 1.87775731e-05, + 9.26902067e-06, 4.00523413e-06, 1.35989160e-06, 2.06769442e-07, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, +]) + +W_10M_96K_HR = np.array([ + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 6.66310811e-08, 2.23723916e-07, 4.87541854e-07, 8.99672727e-07, + 1.51141830e-06, 2.38590815e-06, 3.60002150e-06, 5.24645884e-06, + 7.43599958e-06, 1.02999529e-05, 1.39928125e-05, 1.86951092e-05, + 2.46164800e-05, 3.19989194e-05, 4.11202636e-05, 5.22978444e-05, + 6.58923600e-05, 8.23118899e-05, 1.02016144e-04, 1.25520819e-04, + 1.53402099e-04, 1.86301360e-04, 2.24929841e-04, 2.70073535e-04, + 3.22598062e-04, 3.83453589e-04, 4.53679706e-04, 5.34410414e-04, + 6.26878755e-04, 7.32421642e-04, 8.52484489e-04, 9.88625223e-04, + 1.14251883e-03, 1.31596089e-03, 1.51087111e-03, 1.72929652e-03, + 1.97341433e-03, 2.24553375e-03, 2.54809810e-03, 2.88368552e-03, + 3.25501012e-03, 3.66492104e-03, 4.11640201e-03, 4.61257016e-03, + 5.15667303e-03, 5.75208431e-03, 6.40230207e-03, 7.11094262e-03, + 7.88173359e-03, 8.71850923e-03, 9.62519925e-03, 1.06058242e-02, + 1.16644828e-02, 1.28053408e-02, 1.40326228e-02, 1.53505951e-02, + 1.67635549e-02, 1.82758160e-02, 1.98916886e-02, 2.16154736e-02, + 2.34514344e-02, 2.54037846e-02, 2.74766665e-02, 2.96741407e-02, + 3.20001543e-02, 3.44585292e-02, 3.70529443e-02, 3.97869013e-02, + 4.26637232e-02, 4.56865206e-02, 4.88581695e-02, 5.21813035e-02, + 5.56582808e-02, 5.92911765e-02, 6.30817562e-02, 6.70314580e-02, + 7.11413696e-02, 7.54122287e-02, 7.98443928e-02, 8.44378322e-02, + 8.91921073e-02, 9.41063836e-02, 9.91793722e-02, 1.04409374e-01, + 1.09794252e-01, 1.15331404e-01, 1.21017799e-01, 1.26849949e-01, + 1.32823929e-01, 1.38935357e-01, 1.45179421e-01, 1.51550874e-01, + 1.58044025e-01, 1.64652810e-01, 1.71370730e-01, 1.78190947e-01, + 1.85106188e-01, 1.92108899e-01, 1.99191183e-01, 2.06344813e-01, + 2.13561311e-01, 2.20831960e-01, 2.28147790e-01, 2.35499650e-01, + 2.42878228e-01, 2.50274092e-01, 2.57677704e-01, 2.65079439e-01, + 2.72469670e-01, 2.79838771e-01, 2.87177145e-01, 2.94475257e-01, + 3.01723719e-01, 3.08913231e-01, 3.16034675e-01, 3.23079228e-01, + 3.30038190e-01, 3.36903185e-01, 3.43666196e-01, 3.50319386e-01, + 3.56855512e-01, 3.63267571e-01, 3.69548947e-01, 3.75693500e-01, + 3.81695598e-01, 3.87549996e-01, 3.93251985e-01, 3.98797333e-01, + 4.04182315e-01, 4.09403801e-01, 4.14459109e-01, 4.19346124e-01, + 4.24063236e-01, 4.28609401e-01, 4.32984143e-01, 4.37187403e-01, + 4.41219747e-01, 4.45082188e-01, 4.48776275e-01, 4.52303976e-01, + 4.55667824e-01, 4.58870709e-01, 4.61916000e-01, 4.64807451e-01, + 4.67549264e-01, 4.70145911e-01, 4.72602278e-01, 4.74923581e-01, + 4.77115244e-01, 4.79183048e-01, 4.81132984e-01, 4.82971221e-01, + 4.84704226e-01, 4.86338496e-01, 4.87880766e-01, 4.89337832e-01, + 4.90716666e-01, 4.92024213e-01, 4.93267536e-01, 4.94453669e-01, + 4.95589703e-01, 4.96682733e-01, 4.97739762e-01, 4.98767793e-01, + 4.99773741e-01, 5.00764489e-01, 5.01746774e-01, 5.02727270e-01, + 5.03712595e-01, 5.04709125e-01, 5.05723178e-01, 5.06760955e-01, + 5.07828474e-01, 5.08931518e-01, 5.10075927e-01, 5.11267185e-01, + 5.12510598e-01, 5.13811469e-01, 5.15174806e-01, 5.16605377e-01, + 5.18107831e-01, 5.19686580e-01, 5.21345973e-01, 5.23089945e-01, + 5.24922311e-01, 5.26846766e-01, 5.28866649e-01, 5.30985177e-01, + 5.33205211e-01, 5.35529494e-01, 5.37960529e-01, 5.40500462e-01, + 5.43151379e-01, 5.45914948e-01, 5.48792660e-01, 5.51785827e-01, + 5.54895282e-01, 5.58121800e-01, 5.61465800e-01, 5.64927518e-01, + 5.68506777e-01, 5.72203338e-01, 5.76016545e-01, 5.79945564e-01, + 5.83989203e-01, 5.88146091e-01, 5.92414677e-01, 5.96792936e-01, + 6.01278901e-01, 6.05870068e-01, 6.10563993e-01, 6.15357757e-01, + 6.20248437e-01, 6.25232756e-01, 6.30307317e-01, 6.35468543e-01, + 6.40712619e-01, 6.46035612e-01, 6.51433527e-01, 6.56902015e-01, + 6.62436843e-01, 6.68033481e-01, 6.73687398e-01, 6.79393888e-01, + 6.85148239e-01, 6.90945625e-01, 6.96781278e-01, 7.02650130e-01, + 7.08547413e-01, 7.14468122e-01, 7.20407307e-01, 7.26359963e-01, + 7.32321203e-01, 7.38286138e-01, 7.44249880e-01, 7.50207603e-01, + 7.56154597e-01, 7.62086034e-01, 7.67997444e-01, 7.73884177e-01, + 7.79741824e-01, 7.85566032e-01, 7.91352570e-01, 7.97097266e-01, + 8.02796185e-01, 8.08445334e-01, 8.14041018e-01, 8.19579542e-01, + 8.25057447e-01, 8.30471396e-01, 8.35818112e-01, 8.41094613e-01, + 8.46297920e-01, 8.51425231e-01, 8.56473923e-01, 8.61441612e-01, + 8.66325855e-01, 8.71124566e-01, 8.75835657e-01, 8.80457282e-01, + 8.84987772e-01, 8.89425457e-01, 8.93768966e-01, 8.98017049e-01, + 9.02168512e-01, 9.06222403e-01, 9.10177886e-01, 9.14034188e-01, + 9.17790771e-01, 9.21447217e-01, 9.25003231e-01, 9.28458691e-01, + 9.31813419e-01, 9.35067594e-01, 9.38221455e-01, 9.41275299e-01, + 9.44229603e-01, 9.47084904e-01, 9.49841976e-01, 9.52501595e-01, + 9.55064654e-01, 9.57532167e-01, 9.59905326e-01, 9.62185323e-01, + 9.64373529e-01, 9.66471374e-01, 9.68480289e-01, 9.70402002e-01, + 9.72238123e-01, 9.73990440e-01, 9.75660801e-01, 9.77251112e-01, + 9.78763342e-01, 9.80199575e-01, 9.81561780e-01, 9.82852161e-01, + 9.84072864e-01, 9.85226095e-01, 9.86314118e-01, 9.87339139e-01, + 9.88303483e-01, 9.89209354e-01, 9.90059078e-01, 9.90854919e-01, + 9.91599143e-01, 9.92294014e-01, 9.92941797e-01, 9.93544638e-01, + 9.94104803e-01, 9.94624376e-01, 9.95105505e-01, 9.95550215e-01, + 9.95960534e-01, 9.96338427e-01, 9.96685863e-01, 9.97004628e-01, + 9.97296572e-01, 9.97563362e-01, 9.97806728e-01, 9.98028338e-01, + 9.98229563e-01, 9.98412073e-01, 9.98577118e-01, 9.98726189e-01, + 9.98860478e-01, 9.98981178e-01, 9.99089479e-01, 9.99186397e-01, + 9.99273062e-01, 9.99350369e-01, 9.99419153e-01, 9.99480307e-01, + 9.99534547e-01, 9.99582708e-01, 9.99625325e-01, 9.99663055e-01, + 9.99696434e-01, 9.99726057e-01, 9.99752283e-01, 9.99775589e-01, + 9.99796331e-01, 9.99814928e-01, 9.99831557e-01, 9.99846578e-01, + 9.99860287e-01, 9.99872804e-01, 9.99884307e-01, 9.99895036e-01, + 9.99905109e-01, 9.99914587e-01, 9.99923646e-01, 9.99932408e-01, + 9.99940872e-01, 9.99949098e-01, 9.99957144e-01, 9.99965072e-01, + 9.99972939e-01, 9.99980748e-01, 9.99988437e-01, 9.99996126e-01, + 1.00000381e+00, 1.00001144e+00, 1.00001907e+00, 1.00002670e+00, + 1.00003433e+00, 1.00004184e+00, 1.00004935e+00, 1.00005686e+00, + 1.00006437e+00, 1.00007176e+00, 1.00007904e+00, 1.00008631e+00, + 1.00009358e+00, 1.00010073e+00, 1.00010777e+00, 1.00011480e+00, + 1.00012159e+00, 1.00012839e+00, 1.00013518e+00, 1.00014174e+00, + 1.00014830e+00, 1.00015461e+00, 1.00016093e+00, 1.00016701e+00, + 1.00017309e+00, 1.00017893e+00, 1.00018466e+00, 1.00019026e+00, + 1.00019574e+00, 1.00020099e+00, 1.00020623e+00, 1.00021124e+00, + 1.00021613e+00, 1.00022078e+00, 1.00022531e+00, 1.00022972e+00, + 1.00023389e+00, 1.00023794e+00, 1.00024176e+00, 1.00024545e+00, + 1.00024891e+00, 1.00025225e+00, 1.00025535e+00, 1.00025833e+00, + 1.00026107e+00, 1.00026357e+00, 1.00026596e+00, 1.00026822e+00, + 1.00027013e+00, 1.00027204e+00, 1.00027359e+00, 1.00027502e+00, + 1.00027621e+00, 1.00027728e+00, 1.00027812e+00, 1.00027883e+00, + 1.00027919e+00, 1.00027955e+00, 1.00027955e+00, 1.00027943e+00, + 1.00027919e+00, 1.00027859e+00, 1.00027800e+00, 1.00027704e+00, + 1.00027597e+00, 1.00027478e+00, 1.00027335e+00, 1.00027168e+00, + 1.00026989e+00, 1.00026786e+00, 1.00026572e+00, 1.00026345e+00, + 1.00026095e+00, 1.00025821e+00, 1.00025535e+00, 1.00025237e+00, + 1.00024927e+00, 1.00024593e+00, 1.00024235e+00, 1.00023878e+00, + 1.00023496e+00, 1.00023091e+00, 1.00022686e+00, 1.00022256e+00, + 1.00021827e+00, 1.00021374e+00, 1.00020909e+00, 1.00020421e+00, + 1.00019932e+00, 1.00019431e+00, 1.00018907e+00, 1.00018382e+00, + 1.00017846e+00, 1.00017297e+00, 1.00016737e+00, 1.00016165e+00, + 1.00015581e+00, 1.00014985e+00, 1.00014389e+00, 1.00013781e+00, + 1.00013161e+00, 1.00012529e+00, 1.00011897e+00, 1.00011253e+00, + 1.00010610e+00, 1.00009954e+00, 1.00009298e+00, 1.00008631e+00, + 1.00007963e+00, 1.00007284e+00, 1.00006604e+00, 1.00005913e+00, + 1.00005233e+00, 1.00004542e+00, 1.00003850e+00, 1.00003147e+00, + 1.00002456e+00, 1.00001752e+00, 1.00001049e+00, 1.00000346e+00, + 9.99996483e-01, 9.99989510e-01, 9.99982476e-01, 9.99975502e-01, + 9.99968529e-01, 9.99961555e-01, 9.99954641e-01, 9.99947727e-01, + 9.99940813e-01, 9.99933958e-01, 9.99927163e-01, 9.99920428e-01, + 9.99913692e-01, 9.99907076e-01, 9.99900460e-01, 9.99893904e-01, + 9.99887466e-01, 9.99881029e-01, 9.99874711e-01, 9.99868453e-01, + 9.99862254e-01, 9.99856174e-01, 9.99850154e-01, 9.99844253e-01, + 9.99838412e-01, 9.99832690e-01, 9.99827087e-01, 9.99821603e-01, + 9.99816179e-01, 9.99810934e-01, 9.99805748e-01, 9.99800682e-01, + 9.99795794e-01, 9.99791026e-01, 9.99786317e-01, 9.99781847e-01, + 9.99777436e-01, 9.99773204e-01, 9.99769092e-01, 9.99765158e-01, + 9.99761343e-01, 9.99757707e-01, 9.99754190e-01, 9.99750853e-01, + 9.99747694e-01, 9.99744654e-01, 9.99741852e-01, 9.99739170e-01, + 9.99736667e-01, 9.99734342e-01, 9.99732137e-01, 9.99730170e-01, + 9.99728382e-01, 9.99726772e-01, 9.99725342e-01, 9.99724090e-01, + 9.99723017e-01, 9.99722123e-01, 9.99721408e-01, 9.99720931e-01, + 9.99720633e-01, 9.99720514e-01, 9.99720573e-01, 9.99720812e-01, + 9.99721289e-01, 9.99721944e-01, 9.99722779e-01, 9.99723792e-01, + 9.99725044e-01, 9.99726474e-01, 9.99728084e-01, 9.99729872e-01, + 9.99731898e-01, 9.99734104e-01, 9.99736488e-01, 9.99739051e-01, + 9.99741793e-01, 9.99744713e-01, 9.99747872e-01, 9.99751151e-01, + 9.99754667e-01, 9.99758303e-01, 9.99762177e-01, 9.99766171e-01, + 9.99770403e-01, 9.99774754e-01, 9.99779284e-01, 9.99783993e-01, + 9.99788821e-01, 9.99793828e-01, 9.99799013e-01, 9.99804318e-01, + 9.99809742e-01, 9.99815404e-01, 9.99821126e-01, 9.99826968e-01, + 9.99832988e-01, 9.99839127e-01, 9.99845386e-01, 9.99851763e-01, + 9.99858260e-01, 9.99864876e-01, 9.99871552e-01, 9.99878347e-01, + 9.99885261e-01, 9.99892235e-01, 9.99899328e-01, 9.99906480e-01, + 9.99913692e-01, 9.99920964e-01, 9.99928296e-01, 9.99935687e-01, + 9.99943137e-01, 9.99950647e-01, 9.99958158e-01, 9.99965727e-01, + 9.99973297e-01, 9.99980927e-01, 9.99988556e-01, 9.99996185e-01, + 1.00000381e+00, 1.00001144e+00, 1.00001907e+00, 1.00002670e+00, + 1.00003433e+00, 1.00004184e+00, 1.00004935e+00, 1.00005686e+00, + 1.00006437e+00, 1.00007176e+00, 1.00007904e+00, 1.00008631e+00, + 1.00009358e+00, 1.00010073e+00, 1.00010777e+00, 1.00011480e+00, + 1.00012159e+00, 1.00012839e+00, 1.00013518e+00, 1.00014174e+00, + 1.00014830e+00, 1.00015461e+00, 1.00016093e+00, 1.00016701e+00, + 1.00017309e+00, 1.00017893e+00, 1.00018466e+00, 1.00019026e+00, + 1.00019574e+00, 1.00020099e+00, 1.00020623e+00, 1.00021124e+00, + 1.00021613e+00, 1.00022078e+00, 1.00022531e+00, 1.00022972e+00, + 1.00023389e+00, 1.00023794e+00, 1.00024176e+00, 1.00024545e+00, + 1.00024891e+00, 1.00025225e+00, 1.00025535e+00, 1.00025833e+00, + 1.00026107e+00, 1.00026357e+00, 1.00026596e+00, 1.00026822e+00, + 1.00027013e+00, 1.00027204e+00, 1.00027359e+00, 1.00027502e+00, + 1.00027621e+00, 1.00027728e+00, 1.00027812e+00, 1.00027883e+00, + 1.00027919e+00, 1.00027955e+00, 1.00027955e+00, 1.00027943e+00, + 1.00027919e+00, 1.00027859e+00, 1.00027800e+00, 1.00027704e+00, + 1.00027597e+00, 1.00027478e+00, 1.00027335e+00, 1.00027168e+00, + 1.00026989e+00, 1.00026786e+00, 1.00026572e+00, 1.00026345e+00, + 1.00026095e+00, 1.00025821e+00, 1.00025535e+00, 1.00025237e+00, + 1.00024927e+00, 1.00024593e+00, 1.00024235e+00, 1.00023878e+00, + 1.00023496e+00, 1.00023091e+00, 1.00022686e+00, 1.00022256e+00, + 1.00021827e+00, 1.00021374e+00, 1.00020909e+00, 1.00020421e+00, + 1.00019932e+00, 1.00019431e+00, 1.00018907e+00, 1.00018382e+00, + 1.00017846e+00, 1.00017297e+00, 1.00016737e+00, 1.00016165e+00, + 1.00015581e+00, 1.00014985e+00, 1.00014389e+00, 1.00013781e+00, + 1.00013161e+00, 1.00012529e+00, 1.00011897e+00, 1.00011253e+00, + 1.00010610e+00, 1.00009954e+00, 1.00009298e+00, 1.00008631e+00, + 1.00007963e+00, 1.00007284e+00, 1.00006604e+00, 1.00005913e+00, + 1.00005233e+00, 1.00004542e+00, 1.00003850e+00, 1.00003147e+00, + 1.00002456e+00, 1.00001752e+00, 1.00001049e+00, 1.00000346e+00, + 9.99996483e-01, 9.99989510e-01, 9.99982476e-01, 9.99975502e-01, + 9.99968529e-01, 9.99961555e-01, 9.99954641e-01, 9.99947727e-01, + 9.99940813e-01, 9.99933958e-01, 9.99927163e-01, 9.99920428e-01, + 9.99913692e-01, 9.99907076e-01, 9.99900460e-01, 9.99893904e-01, + 9.99887466e-01, 9.99881029e-01, 9.99874711e-01, 9.99868453e-01, + 9.99862254e-01, 9.99856174e-01, 9.99850154e-01, 9.99844253e-01, + 9.99838412e-01, 9.99832690e-01, 9.99827087e-01, 9.99821603e-01, + 9.99816179e-01, 9.99810934e-01, 9.99805748e-01, 9.99800682e-01, + 9.99795794e-01, 9.99791026e-01, 9.99786317e-01, 9.99781847e-01, + 9.99777436e-01, 9.99773204e-01, 9.99769092e-01, 9.99765158e-01, + 9.99761343e-01, 9.99757707e-01, 9.99754190e-01, 9.99750853e-01, + 9.99747694e-01, 9.99744654e-01, 9.99741852e-01, 9.99739170e-01, + 9.99736667e-01, 9.99734342e-01, 9.99732137e-01, 9.99730170e-01, + 9.99728382e-01, 9.99726772e-01, 9.99725342e-01, 9.99724090e-01, + 9.99723017e-01, 9.99722123e-01, 9.99721408e-01, 9.99720931e-01, + 9.99720633e-01, 9.99720514e-01, 9.99720573e-01, 9.99720812e-01, + 9.99721289e-01, 9.99721944e-01, 9.99722779e-01, 9.99723792e-01, + 9.99725044e-01, 9.99726474e-01, 9.99728084e-01, 9.99729872e-01, + 9.99731898e-01, 9.99734104e-01, 9.99736488e-01, 9.99739051e-01, + 9.99741793e-01, 9.99744713e-01, 9.99747872e-01, 9.99751151e-01, + 9.99754667e-01, 9.99758303e-01, 9.99762177e-01, 9.99766171e-01, + 9.99770403e-01, 9.99774754e-01, 9.99779284e-01, 9.99783993e-01, + 9.99788821e-01, 9.99793828e-01, 9.99799013e-01, 9.99804318e-01, + 9.99809742e-01, 9.99815404e-01, 9.99821126e-01, 9.99826968e-01, + 9.99832988e-01, 9.99839127e-01, 9.99845386e-01, 9.99851763e-01, + 9.99858260e-01, 9.99864876e-01, 9.99871552e-01, 9.99878347e-01, + 9.99885261e-01, 9.99892235e-01, 9.99899328e-01, 9.99906480e-01, + 9.99913692e-01, 9.99920964e-01, 9.99928296e-01, 9.99935687e-01, + 9.99943137e-01, 9.99950647e-01, 9.99958158e-01, 9.99965727e-01, + 9.99973297e-01, 9.99980927e-01, 9.99988556e-01, 9.99996185e-01, + 1.00000381e+00, 1.00001144e+00, 1.00001907e+00, 1.00002670e+00, + 1.00003433e+00, 1.00004184e+00, 1.00004935e+00, 1.00005686e+00, + 1.00006437e+00, 1.00007176e+00, 1.00007904e+00, 1.00008631e+00, + 1.00009358e+00, 1.00010073e+00, 1.00010777e+00, 1.00011480e+00, + 1.00012159e+00, 1.00012839e+00, 1.00013518e+00, 1.00014174e+00, + 1.00014830e+00, 1.00015461e+00, 1.00016093e+00, 1.00016701e+00, + 1.00017309e+00, 1.00017893e+00, 1.00018466e+00, 1.00019026e+00, + 1.00019574e+00, 1.00020099e+00, 1.00020623e+00, 1.00021124e+00, + 1.00021613e+00, 1.00022078e+00, 1.00022531e+00, 1.00022972e+00, + 1.00023389e+00, 1.00023794e+00, 1.00024176e+00, 1.00024545e+00, + 1.00024891e+00, 1.00025225e+00, 1.00025535e+00, 1.00025833e+00, + 1.00026107e+00, 1.00026357e+00, 1.00026596e+00, 1.00026822e+00, + 1.00027013e+00, 1.00027204e+00, 1.00027359e+00, 1.00027502e+00, + 1.00027621e+00, 1.00027728e+00, 1.00027812e+00, 1.00027883e+00, + 1.00027919e+00, 1.00027955e+00, 1.00027955e+00, 1.00027943e+00, + 1.00027919e+00, 1.00027859e+00, 1.00027800e+00, 1.00027704e+00, + 1.00027597e+00, 1.00027478e+00, 1.00027335e+00, 1.00027168e+00, + 1.00026989e+00, 1.00026786e+00, 1.00026572e+00, 1.00026345e+00, + 1.00026095e+00, 1.00025821e+00, 1.00025535e+00, 1.00025237e+00, + 1.00024927e+00, 1.00024593e+00, 1.00024235e+00, 1.00023878e+00, + 1.00023496e+00, 1.00023091e+00, 1.00022686e+00, 1.00022256e+00, + 1.00021827e+00, 1.00021374e+00, 1.00020909e+00, 1.00020421e+00, + 1.00019932e+00, 1.00019431e+00, 1.00018907e+00, 1.00018382e+00, + 1.00017846e+00, 1.00017297e+00, 1.00016737e+00, 1.00016165e+00, + 1.00015581e+00, 1.00014985e+00, 1.00014389e+00, 1.00013781e+00, + 1.00013161e+00, 1.00012529e+00, 1.00011897e+00, 1.00011253e+00, + 1.00010610e+00, 1.00009954e+00, 1.00009298e+00, 1.00008631e+00, + 1.00007963e+00, 1.00007284e+00, 1.00006604e+00, 1.00005913e+00, + 1.00005233e+00, 1.00004542e+00, 1.00003850e+00, 1.00003147e+00, + 1.00002456e+00, 1.00001752e+00, 1.00001049e+00, 1.00000346e+00, + 9.99996483e-01, 9.99989510e-01, 9.99982476e-01, 9.99975502e-01, + 9.99968529e-01, 9.99961555e-01, 9.99954641e-01, 9.99947727e-01, + 9.99940813e-01, 9.99933958e-01, 9.99927163e-01, 9.99920428e-01, + 9.99913692e-01, 9.99907076e-01, 9.99900460e-01, 9.99893904e-01, + 9.99887466e-01, 9.99881029e-01, 9.99874711e-01, 9.99868453e-01, + 9.99862254e-01, 9.99856174e-01, 9.99850154e-01, 9.99844253e-01, + 9.99838412e-01, 9.99832690e-01, 9.99827087e-01, 9.99821603e-01, + 9.99816179e-01, 9.99810934e-01, 9.99805748e-01, 9.99800682e-01, + 9.99795794e-01, 9.99791026e-01, 9.99786317e-01, 9.99781847e-01, + 9.99777436e-01, 9.99773204e-01, 9.99769092e-01, 9.99765158e-01, + 9.99761343e-01, 9.99757707e-01, 9.99754190e-01, 9.99750853e-01, + 9.99747694e-01, 9.99744654e-01, 9.99741852e-01, 9.99739170e-01, + 9.99736667e-01, 9.99734342e-01, 9.99732137e-01, 9.99730170e-01, + 9.99728382e-01, 9.99726772e-01, 9.99725342e-01, 9.99724090e-01, + 9.99723017e-01, 9.99722123e-01, 9.99721408e-01, 9.99720931e-01, + 9.99720633e-01, 9.99720514e-01, 9.99720573e-01, 9.99720812e-01, + 9.99721289e-01, 9.99721944e-01, 9.99722779e-01, 9.99723792e-01, + 9.99725044e-01, 9.99726474e-01, 9.99728084e-01, 9.99729872e-01, + 9.99731898e-01, 9.99734104e-01, 9.99736488e-01, 9.99739051e-01, + 9.99741793e-01, 9.99744713e-01, 9.99747872e-01, 9.99751151e-01, + 9.99754667e-01, 9.99758303e-01, 9.99762177e-01, 9.99766171e-01, + 9.99770403e-01, 9.99774754e-01, 9.99779284e-01, 9.99783993e-01, + 9.99788821e-01, 9.99793828e-01, 9.99799013e-01, 9.99804318e-01, + 9.99809742e-01, 9.99815404e-01, 9.99821126e-01, 9.99826968e-01, + 9.99832988e-01, 9.99839127e-01, 9.99845386e-01, 9.99851763e-01, + 9.99858260e-01, 9.99864876e-01, 9.99871552e-01, 9.99878347e-01, + 9.99885261e-01, 9.99892235e-01, 9.99899328e-01, 9.99906480e-01, + 9.99913692e-01, 9.99920964e-01, 9.99928296e-01, 9.99935687e-01, + 9.99943137e-01, 9.99950647e-01, 9.99958158e-01, 9.99965727e-01, + 9.99973297e-01, 9.99980927e-01, 9.99988556e-01, 9.99996185e-01, + 1.00000381e+00, 1.00001132e+00, 1.00001884e+00, 1.00002635e+00, + 1.00003362e+00, 1.00004077e+00, 1.00004780e+00, 1.00005460e+00, + 1.00006104e+00, 1.00006711e+00, 1.00007272e+00, 1.00007772e+00, + 1.00008214e+00, 1.00008571e+00, 1.00008833e+00, 1.00008976e+00, + 1.00008988e+00, 1.00008845e+00, 1.00008512e+00, 1.00007975e+00, + 1.00007200e+00, 1.00006139e+00, 1.00004768e+00, 1.00003028e+00, + 1.00000894e+00, 9.99982893e-01, 9.99951661e-01, 9.99914646e-01, + 9.99871135e-01, 9.99820411e-01, 9.99761701e-01, 9.99694109e-01, + 9.99616742e-01, 9.99528646e-01, 9.99428689e-01, 9.99315858e-01, + 9.99188840e-01, 9.99046445e-01, 9.98887360e-01, 9.98710036e-01, + 9.98513043e-01, 9.98294711e-01, 9.98053491e-01, 9.97787535e-01, + 9.97494996e-01, 9.97173846e-01, 9.96822178e-01, 9.96437728e-01, + 9.96018291e-01, 9.95561540e-01, 9.95064974e-01, 9.94526088e-01, + 9.93942142e-01, 9.93310452e-01, 9.92628038e-01, 9.91891921e-01, + 9.91099000e-01, 9.90245998e-01, 9.89329517e-01, 9.88346159e-01, + 9.87292290e-01, 9.86164153e-01, 9.84957933e-01, 9.83669639e-01, + 9.82295156e-01, 9.80830312e-01, 9.79270697e-01, 9.77612019e-01, + 9.75849628e-01, 9.73978817e-01, 9.71994996e-01, 9.69893157e-01, + 9.67668533e-01, 9.65315938e-01, 9.62830484e-01, 9.60206985e-01, + 9.57440197e-01, 9.54525113e-01, 9.51456368e-01, 9.48228836e-01, + 9.44837391e-01, 9.41276729e-01, 9.37541902e-01, 9.33627844e-01, + 9.29529607e-01, 9.25242424e-01, 9.20761466e-01, 9.16082382e-01, + 9.11200643e-01, 9.06112134e-01, 9.00812864e-01, 8.95299196e-01, + 8.89567554e-01, 8.83614719e-01, 8.77437830e-01, 8.71034324e-01, + 8.64401877e-01, 8.57538521e-01, 8.50442827e-01, 8.43113542e-01, + 8.35549891e-01, 8.27751517e-01, 8.19718421e-01, 8.11451137e-01, + 8.02950621e-01, 7.94218183e-01, 7.85255671e-01, 7.76065350e-01, + 7.66650081e-01, 7.57013023e-01, 7.47157931e-01, 7.37088978e-01, + 7.26810873e-01, 7.16328681e-01, 7.05648124e-01, 6.94775164e-01, + 6.83716357e-01, 6.72478795e-01, 6.61069810e-01, 6.49497330e-01, + 6.37769580e-01, 6.25895321e-01, 6.13883674e-01, 6.01744056e-01, + 5.89486361e-01, 5.77120781e-01, 5.64657867e-01, 5.52108407e-01, + 5.39483547e-01, 5.26794672e-01, 5.14053404e-01, 5.01271665e-01, + 4.88461435e-01, 4.75634992e-01, 4.62804615e-01, 4.49982822e-01, + 4.37182158e-01, 4.24415171e-01, 4.11694527e-01, 3.99032772e-01, + 3.86442453e-01, 3.73936087e-01, 3.61525953e-01, 3.49224269e-01, + 3.37043047e-01, 3.24994087e-01, 3.13088894e-01, 3.01338732e-01, + 2.89754450e-01, 2.78346658e-01, 2.67125458e-01, 2.56100595e-01, + 2.45281324e-01, 2.34676436e-01, 2.24294156e-01, 2.14142203e-01, + 2.04227716e-01, 1.94557235e-01, 1.85136691e-01, 1.75971389e-01, + 1.67065978e-01, 1.58424467e-01, 1.50050193e-01, 1.41945809e-01, + 1.34113312e-01, 1.26554012e-01, 1.19268581e-01, 1.12257004e-01, + 1.05518632e-01, 9.90521908e-02, 9.28557739e-02, 8.69268849e-02, + 8.12624842e-02, 7.58589506e-02, 7.07121640e-02, 6.58175275e-02, + 6.11699894e-02, 5.67640625e-02, 5.25939018e-02, 4.86532971e-02, + 4.49357443e-02, 4.14344519e-02, 3.81424055e-02, 3.50523964e-02, + 3.21570449e-02, 2.94488575e-02, 2.69202497e-02, 2.45635863e-02, + 2.23712083e-02, 2.03354694e-02, 1.84487645e-02, 1.67035554e-02, + 1.50924018e-02, 1.36079816e-02, 1.22431125e-02, 1.09907771e-02, + 9.84413363e-03, 8.79654102e-03, 7.84156192e-03, 6.97298534e-03, + 6.18482940e-03, 5.47135156e-03, 4.82705561e-03, 4.24669450e-03, + 3.72527563e-03, 3.25805834e-03, 2.84055714e-03, 2.46853800e-03, + 2.13801605e-03, 1.84525200e-03, 1.58674677e-03, 1.35923503e-03, + 1.15967961e-03, 9.85263032e-04, 8.33379803e-04, 7.01628160e-04, + 5.87800692e-04, 4.89875500e-04, 4.06006613e-04, 3.34514218e-04, + 2.73875427e-04, 2.22714254e-04, 1.79792376e-04, 1.43999539e-04, + 1.14344395e-04, 8.99455481e-05, 7.00227974e-05, 5.38887325e-05, + 4.09407221e-05, 3.06531692e-05, 2.25702297e-05, 1.62988836e-05, + 1.15024377e-05, 7.89443584e-06, 5.23298331e-06, 3.31548563e-06, + 1.97379018e-06, 1.06971811e-06, 4.90905393e-07, 1.46209757e-07, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, +]) + ### 3.7.4 ### diff --git a/test/tns.py b/test/tns.py index 92bbe1d..01f1f6f 100644 --- a/test/tns.py +++ b/test/tns.py @@ -22,24 +22,15 @@ import tables as T, appendix_c as C ### ------------------------------------------------------------------------ ### class Tns: + SUB_LIM_2M5_NB = [ [ 3, 10, 20 ] ] + SUB_LIM_2M5_WB = [ [ 3, 20, 40 ] ] + SUB_LIM_2M5_SSWB = [ [ 3, 30, 60 ] ] + SUB_LIM_2M5_SWB = [ [ 3, 40, 80 ] ] + SUB_LIM_2M5_FB = [ [ 3, 50, 100 ] ] - SUB_LIM_10M_NB = [ [ 12, 34, 57, 80 ] ] - SUB_LIM_10M_WB = [ [ 12, 61, 110, 160 ] ] - SUB_LIM_10M_SSWB = [ [ 12, 88, 164, 240 ] ] - SUB_LIM_10M_SWB = [ [ 12, 61, 110, 160 ], [ 160, 213, 266, 320 ] ] - SUB_LIM_10M_FB = [ [ 12, 74, 137, 200 ], [ 200, 266, 333, 400 ] ] - - SUB_LIM_10M = [ SUB_LIM_10M_NB, SUB_LIM_10M_WB, - SUB_LIM_10M_SSWB, SUB_LIM_10M_SWB, SUB_LIM_10M_FB ] - - SUB_LIM_7M5_NB = [ [ 9, 26, 43, 60 ] ] - SUB_LIM_7M5_WB = [ [ 9, 46, 83, 120 ] ] - SUB_LIM_7M5_SSWB = [ [ 9, 66, 123, 180 ] ] - SUB_LIM_7M5_SWB = [ [ 9, 46, 82, 120 ], [ 120, 159, 200, 240 ] ] - SUB_LIM_7M5_FB = [ [ 9, 56, 103, 150 ], [ 150, 200, 250, 300 ] ] - - SUB_LIM_7M5 = [ SUB_LIM_7M5_NB, SUB_LIM_7M5_WB, - SUB_LIM_7M5_SSWB, SUB_LIM_7M5_SWB, SUB_LIM_7M5_FB ] + SUB_LIM_2M5 = [ + SUB_LIM_2M5_NB , SUB_LIM_2M5_WB, SUB_LIM_2M5_SSWB, + SUB_LIM_2M5_SWB, SUB_LIM_2M5_FB, SUB_LIM_2M5_FB, SUB_LIM_2M5_FB ] SUB_LIM_5M_NB = [ [ 6, 23, 40 ] ] SUB_LIM_5M_WB = [ [ 6, 43, 80 ] ] @@ -47,46 +38,32 @@ class Tns: SUB_LIM_5M_SWB = [ [ 6, 43, 80 ], [ 80, 120, 160 ] ] SUB_LIM_5M_FB = [ [ 6, 53, 100 ], [ 100, 150, 200 ] ] - SUB_LIM_5M = [ SUB_LIM_5M_NB, SUB_LIM_5M_WB, - SUB_LIM_5M_SSWB, SUB_LIM_5M_SWB, SUB_LIM_5M_FB ] + SUB_LIM_5M = [ + SUB_LIM_5M_NB , SUB_LIM_5M_WB, SUB_LIM_5M_SSWB, + SUB_LIM_5M_SWB, SUB_LIM_5M_FB, SUB_LIM_5M_FB, SUB_LIM_5M_FB ] - SUB_LIM_2M5_NB = [ [ 3, 10, 20 ] ] - SUB_LIM_2M5_WB = [ [ 3, 20, 40 ] ] - SUB_LIM_2M5_SSWB = [ [ 3, 30, 60 ] ] - SUB_LIM_2M5_SWB = [ [ 3, 40, 80 ] ] - SUB_LIM_2M5_FB = [ [ 3, 50, 100 ] ] + SUB_LIM_7M5_NB = [ [ 9, 26, 43, 60 ] ] + SUB_LIM_7M5_WB = [ [ 9, 46, 83, 120 ] ] + SUB_LIM_7M5_SSWB = [ [ 9, 66, 123, 180 ] ] + SUB_LIM_7M5_SWB = [ [ 9, 46, 82, 120 ], [ 120, 159, 200, 240 ] ] + SUB_LIM_7M5_FB = [ [ 9, 56, 103, 150 ], [ 150, 200, 250, 300 ] ] - SUB_LIM_2M5 = [ SUB_LIM_2M5_NB, SUB_LIM_2M5_WB, - SUB_LIM_2M5_SSWB, SUB_LIM_2M5_SWB, SUB_LIM_2M5_FB ] + SUB_LIM_7M5 = [ + SUB_LIM_7M5_NB , SUB_LIM_7M5_WB, SUB_LIM_7M5_SSWB, + SUB_LIM_7M5_SWB, SUB_LIM_7M5_FB, None, None ] + + SUB_LIM_10M_NB = [ [ 12, 34, 57, 80 ] ] + SUB_LIM_10M_WB = [ [ 12, 61, 110, 160 ] ] + SUB_LIM_10M_SSWB = [ [ 12, 88, 164, 240 ] ] + SUB_LIM_10M_SWB = [ [ 12, 61, 110, 160 ], [ 160, 213, 266, 320 ] ] + SUB_LIM_10M_FB = [ [ 12, 74, 137, 200 ], [ 200, 266, 333, 400 ] ] + + SUB_LIM_10M = [ + SUB_LIM_10M_NB , SUB_LIM_10M_WB, SUB_LIM_10M_SSWB, + SUB_LIM_10M_SWB, SUB_LIM_10M_FB, SUB_LIM_10M_FB, SUB_LIM_10M_FB ] SUB_LIM = [ SUB_LIM_2M5, SUB_LIM_5M, SUB_LIM_7M5, SUB_LIM_10M ] - FREQ_LIM_10M_NB = [ 12, 80 ] - FREQ_LIM_10M_WB = [ 12, 160 ] - FREQ_LIM_10M_SSWB = [ 12, 240 ] - FREQ_LIM_10M_SWB = [ 12, 160, 320 ] - FREQ_LIM_10M_FB = [ 12, 200, 400 ] - - FREQ_LIM_10M = [ FREQ_LIM_10M_NB, FREQ_LIM_10M_WB, - FREQ_LIM_10M_SSWB, FREQ_LIM_10M_SWB, FREQ_LIM_10M_FB ] - - FREQ_LIM_7M5_NB = [ 9, 60 ] - FREQ_LIM_7M5_WB = [ 9, 120 ] - FREQ_LIM_7M5_SSWB = [ 9, 180 ] - FREQ_LIM_7M5_SWB = [ 9, 120, 240 ] - FREQ_LIM_7M5_FB = [ 9, 150, 300 ] - - FREQ_LIM_7M5 = [ FREQ_LIM_7M5_NB, FREQ_LIM_7M5_WB, - FREQ_LIM_7M5_SSWB, FREQ_LIM_7M5_SWB, FREQ_LIM_7M5_FB ] - - FREQ_LIM_5M_NB = [ 6, 40 ] - FREQ_LIM_5M_WB = [ 6, 80 ] - FREQ_LIM_5M_SSWB = [ 6, 120 ] - FREQ_LIM_5M_SWB = [ 6, 80, 160 ] - FREQ_LIM_5M_FB = [ 6, 100, 200 ] - - FREQ_LIM_5M = [ FREQ_LIM_5M_NB, FREQ_LIM_5M_WB, - FREQ_LIM_5M_SSWB, FREQ_LIM_5M_SWB, FREQ_LIM_5M_FB ] FREQ_LIM_2M5_NB = [ 3, 20 ] FREQ_LIM_2M5_WB = [ 3, 40 ] @@ -94,11 +71,43 @@ class Tns: FREQ_LIM_2M5_SWB = [ 3, 80 ] FREQ_LIM_2M5_FB = [ 3, 100 ] - FREQ_LIM_2M5 = [ FREQ_LIM_2M5_NB, FREQ_LIM_2M5_WB, - FREQ_LIM_2M5_SSWB, FREQ_LIM_2M5_SWB, FREQ_LIM_2M5_FB ] + FREQ_LIM_2M5 = [ + FREQ_LIM_2M5_NB , FREQ_LIM_2M5_WB, FREQ_LIM_2M5_SSWB, + FREQ_LIM_2M5_SWB, FREQ_LIM_2M5_FB, FREQ_LIM_2M5_FB, FREQ_LIM_2M5_FB ] + + FREQ_LIM_5M_NB = [ 6, 40 ] + FREQ_LIM_5M_WB = [ 6, 80 ] + FREQ_LIM_5M_SSWB = [ 6, 120 ] + FREQ_LIM_5M_SWB = [ 6, 80, 160 ] + FREQ_LIM_5M_FB = [ 6, 100, 200 ] + + FREQ_LIM_5M = [ + FREQ_LIM_5M_NB , FREQ_LIM_5M_WB, FREQ_LIM_5M_SSWB, + FREQ_LIM_5M_SWB, FREQ_LIM_5M_FB, FREQ_LIM_5M_FB, FREQ_LIM_5M_FB ] + + FREQ_LIM_7M5_NB = [ 9, 60 ] + FREQ_LIM_7M5_WB = [ 9, 120 ] + FREQ_LIM_7M5_SSWB = [ 9, 180 ] + FREQ_LIM_7M5_SWB = [ 9, 120, 240 ] + FREQ_LIM_7M5_FB = [ 9, 150, 300 ] + + FREQ_LIM_7M5 = [ + FREQ_LIM_7M5_NB , FREQ_LIM_7M5_WB, FREQ_LIM_7M5_SSWB, + FREQ_LIM_7M5_SWB, FREQ_LIM_7M5_FB, None, None ] + + FREQ_LIM_10M_NB = [ 12, 80 ] + FREQ_LIM_10M_WB = [ 12, 160 ] + FREQ_LIM_10M_SSWB = [ 12, 240 ] + FREQ_LIM_10M_SWB = [ 12, 160, 320 ] + FREQ_LIM_10M_FB = [ 12, 200, 400 ] + + FREQ_LIM_10M = [ + FREQ_LIM_10M_NB , FREQ_LIM_10M_WB, FREQ_LIM_10M_SSWB, + FREQ_LIM_10M_SWB, FREQ_LIM_10M_FB, FREQ_LIM_10M_FB, FREQ_LIM_10M_FB ] FREQ_LIM = [ FREQ_LIM_2M5, FREQ_LIM_5M, FREQ_LIM_7M5, FREQ_LIM_10M ] + def __init__(self, dt): self.dt = dt @@ -349,8 +358,9 @@ def check_analysis(rng, dt, bw): nbytes_lim = int((48 * T.DT_MS[dt]) // 8) for i in range(10): - x = rng.random(T.NE[dt][bw]) * 1e2 - x = pow(x, .5 + i/5) + ne = T.I[dt][bw][-1] + x = rng.random(ne) * 1e2 + x = pow(x, .5 + i/5) for nn_flag in (True, False): for nbytes in (nbytes_lim, nbytes_lim + 1): @@ -379,7 +389,8 @@ def check_synthesis(rng, dt, bw): for i in range(100): - x = rng.random(T.NE[dt][bw]) * 1e2 + ne = T.I[dt][bw][-1] + x = rng.random(ne) * 1e2 maxorder = [ 4, 8 ][dt > T.DT_5M] synthesis.nfilters = 1 + int(dt >= T.DT_5M and bw >= T.SRATE_32K) @@ -473,11 +484,15 @@ def check(): ok = True for dt in range(T.NUM_DT): - for sr in range(T.NUM_SRATE): + for sr in range(T.SRATE_8K, T.SRATE_48K + 1): ok = ok and check_analysis(rng, dt, sr) ok = ok and check_synthesis(rng, dt, sr) - for dt in range(T.DT_7M5, T.NUM_DT): + for dt in ( T.DT_2M5, T.DT_5M, T.DT_10M ): + for sr in ( T.SRATE_48K_HR, T.SRATE_96K_HR ): + ok = ok and check_analysis(rng, dt, sr) + + for dt in ( T.DT_7M5, T.DT_10M ): check_analysis_appendix_c(dt) check_synthesis_appendix_c(dt) diff --git a/test/tns_py.c b/test/tns_py.c index 516bb71..04752cc 100644 --- a/test/tns_py.c +++ b/test/tns_py.c @@ -32,10 +32,10 @@ static PyObject *compute_lpc_coeffs_py(PyObject *m, PyObject *args) if (!PyArg_ParseTuple(args, "IIO", &dt, &bw, &x_obj)) return NULL; - CTYPES_CHECK("dt", (unsigned)dt < LC3_NUM_DT); - CTYPES_CHECK("sr", (unsigned)bw < LC3_NUM_BANDWIDTH); + CTYPES_CHECK("dt", dt < LC3_NUM_DT); + CTYPES_CHECK("sr", bw < LC3_NUM_BANDWIDTH); - int ne = LC3_NE(dt, bw); + int ne = lc3_ne(dt, bw); int maxorder = dt <= LC3_DT_5M ? 4 : 8; CTYPES_CHECK("x", to_1d_ptr(x_obj, NPY_FLOAT, ne, &x)); @@ -57,7 +57,7 @@ static PyObject *lpc_reflection_py(PyObject *m, PyObject *args) if (!PyArg_ParseTuple(args, "IO", &dt, &a_obj)) return NULL; - CTYPES_CHECK("dt", (unsigned)dt < LC3_NUM_DT); + CTYPES_CHECK("dt", dt < LC3_NUM_DT); int maxorder = dt <= LC3_DT_5M ? 4 : 8; @@ -76,10 +76,10 @@ static PyObject *quantize_rc_py(PyObject *m, PyObject *args) float *rc; int rc_order, *rc_q; - if (!PyArg_ParseTuple(args, "IO", &dt, &rc_obj)) + if (!PyArg_ParseTuple(args, "iO", &dt, &rc_obj)) return NULL; - CTYPES_CHECK("dt", (unsigned)dt < LC3_NUM_DT); + CTYPES_CHECK("dt", dt < LC3_NUM_DT); int maxorder = dt <= LC3_DT_5M ? 4 : 8; @@ -115,17 +115,17 @@ static PyObject *analyze_py(PyObject *m, PyObject *args) PyObject *x_obj; struct lc3_tns_data data = { 0 }; unsigned dt, bw; - int nn_flag; - unsigned nbytes; + int nn_flag, nbytes; float *x; - if (!PyArg_ParseTuple(args, "IIpIO", &dt, &bw, &nn_flag, &nbytes, &x_obj)) + if (!PyArg_ParseTuple(args, "IIpiO", + &dt, &bw, &nn_flag, &nbytes, &x_obj)) return NULL; - CTYPES_CHECK("dt", (unsigned)dt < LC3_NUM_DT); - CTYPES_CHECK("bw", (unsigned)bw < LC3_NUM_BANDWIDTH); + CTYPES_CHECK("dt", dt < LC3_NUM_DT); + CTYPES_CHECK("bw", bw < LC3_NUM_BANDWIDTH); - int ne = LC3_NE(dt, bw); + int ne = lc3_ne(dt, bw); CTYPES_CHECK("x", x_obj = to_1d_ptr(x_obj, NPY_FLOAT, ne, &x)); @@ -144,11 +144,11 @@ static PyObject *synthesize_py(PyObject *m, PyObject *args) if (!PyArg_ParseTuple(args, "IIOO", &dt, &bw, &data_obj, &x_obj)) return NULL; - CTYPES_CHECK("dt", (unsigned)dt < LC3_NUM_DT); - CTYPES_CHECK("bw", (unsigned)bw < LC3_NUM_BANDWIDTH); + CTYPES_CHECK("dt", dt < LC3_NUM_DT); + CTYPES_CHECK("bw", bw < LC3_NUM_BANDWIDTH); CTYPES_CHECK(NULL, data_obj = to_tns_data(data_obj, &data)); - int ne = LC3_NE(dt, bw); + int ne = lc3_ne(dt, bw); CTYPES_CHECK("x", x_obj = to_1d_ptr(x_obj, NPY_FLOAT, ne, &x)); diff --git a/tools/dlc3.c b/tools/dlc3.c index 109615b..69760be 100644 --- a/tools/dlc3.c +++ b/tools/dlc3.c @@ -153,17 +153,16 @@ int main(int argc, char *argv[]) if (p.fname_out && (fp_out = fopen(p.fname_out, "wb")) == NULL) error(errno, "%s", p.fname_out); - if (p.srate_hz && !LC3_CHECK_SR_HZ(p.srate_hz)) - error(EINVAL, "Samplerate %d Hz", p.srate_hz); - if (p.bitdepth && p.bitdepth != 16 && p.bitdepth != 24) error(EINVAL, "Bitdepth %d", p.bitdepth); /* --- Check parameters --- */ int frame_us, srate_hz, nch, nsamples; + bool hrmode; - if (lc3bin_read_header(fp_in, &frame_us, &srate_hz, &nch, &nsamples) < 0) + if (lc3bin_read_header(fp_in, + &frame_us, &srate_hz, &hrmode, &nch, &nsamples) < 0) error(EINVAL, "LC3 binary input file"); if (nch < 1 || nch > 2) @@ -172,9 +171,13 @@ int main(int argc, char *argv[]) if (!LC3_CHECK_DT_US(frame_us)) error(EINVAL, "Frame duration"); - if (!LC3_CHECK_SR_HZ(srate_hz) || (p.srate_hz && p.srate_hz < srate_hz)) + if (!LC3_CHECK_HR_SR_HZ(hrmode, srate_hz)) error(EINVAL, "Samplerate %d Hz", srate_hz); + if (p.srate_hz && (!LC3_CHECK_HR_SR_HZ(hrmode, p.srate_hz) || + p.srate_hz < srate_hz )) + error(EINVAL, "Output samplerate %d Hz", p.srate_hz); + int pcm_sbits = p.bitdepth; int pcm_sbytes = pcm_sbits / 8; @@ -187,19 +190,24 @@ int main(int argc, char *argv[]) /* --- Setup decoding --- */ - uint8_t in[2 * LC3_MAX_FRAME_BYTES]; - int8_t alignas(int32_t) pcm[2 * LC3_MAX_FRAME_SAMPLES*4]; + uint8_t in[2 * LC3_MAX_HR_FRAME_BYTES]; + int8_t alignas(int32_t) pcm[2 * LC3_MAX_HR_FRAME_SAMPLES*4]; lc3_decoder_t dec[2]; - int frame_samples = lc3_frame_samples(frame_us, pcm_srate_hz); + int frame_samples = lc3_hr_frame_samples(hrmode, frame_us, pcm_srate_hz); int encode_samples = pcm_samples + - lc3_delay_samples(frame_us, pcm_srate_hz); + lc3_hr_delay_samples(hrmode, frame_us, pcm_srate_hz); enum lc3_pcm_format pcm_fmt = pcm_sbits == 24 ? LC3_PCM_FORMAT_S24_3LE : LC3_PCM_FORMAT_S16; - for (int ich = 0; ich < nch; ich++) - dec[ich] = lc3_setup_decoder(frame_us, srate_hz, p.srate_hz, - malloc(lc3_decoder_size(frame_us, pcm_srate_hz))); + for (int ich = 0; ich < nch; ich++) { + dec[ich] = lc3_hr_setup_decoder( + hrmode, frame_us, srate_hz, p.srate_hz, + malloc(lc3_hr_decoder_size(hrmode, frame_us, pcm_srate_hz))); + + if (!dec[ich]) + error(EINVAL, "Decoder initialization failed"); + } /* --- Decoding loop --- */ diff --git a/tools/elc3.c b/tools/elc3.c index 654fa7f..af7dfbc 100644 --- a/tools/elc3.c +++ b/tools/elc3.c @@ -60,6 +60,7 @@ struct parameters { const char *fname_out; float frame_ms; int srate_hz; + bool hrmode; int bitrate; }; @@ -76,6 +77,7 @@ static struct parameters parse_args(int argc, char *argv[]) "\t-b\t" "Bitrate in bps (mandatory)\n" "\t-m\t" "Frame duration in ms (default 10)\n" "\t-r\t" "Encoder samplerate (default is input samplerate)\n" + "\t-H\t" "Enable high-resolution mode\n" "\n"; struct parameters p = { .frame_ms = 10 }; @@ -102,6 +104,7 @@ static struct parameters parse_args(int argc, char *argv[]) case 'b': p.bitrate = atoi(optarg); break; case 'm': p.frame_ms = atof(optarg); break; case 'r': p.srate_hz = atoi(optarg); break; + case 'H': p.hrmode = true; break; default: error(EINVAL, "Option %s", arg); } @@ -152,9 +155,6 @@ int main(int argc, char *argv[]) if (p.fname_out && (fp_out = fopen(p.fname_out, "wb")) == NULL) error(errno, "%s", p.fname_out); - if (p.srate_hz && !LC3_CHECK_SR_HZ(p.srate_hz)) - error(EINVAL, "Samplerate %d Hz", p.srate_hz); - /* --- Check parameters --- */ int frame_us = p.frame_ms * 1000; @@ -171,7 +171,7 @@ int main(int argc, char *argv[]) if (!LC3_CHECK_DT_US(frame_us)) error(EINVAL, "Frame duration"); - if (!LC3_CHECK_SR_HZ(srate_hz) || (p.srate_hz && p.srate_hz > srate_hz)) + if (!LC3_CHECK_HR_SR_HZ(p.hrmode, srate_hz)) error(EINVAL, "Samplerate %d Hz", srate_hz); if (pcm_sbits != 16 && pcm_sbits != 24) @@ -184,29 +184,42 @@ int main(int argc, char *argv[]) if (nch < 1 || nch > 2) error(EINVAL, "Number of channels %d", nch); + if (p.srate_hz && (!LC3_CHECK_HR_SR_HZ(p.hrmode, p.srate_hz) || + p.srate_hz > srate_hz )) + error(EINVAL, "Encoder samplerate %d Hz", p.srate_hz); + int enc_srate_hz = !p.srate_hz ? srate_hz : p.srate_hz; int enc_samples = !p.srate_hz ? nsamples : ((int64_t)nsamples * enc_srate_hz) / srate_hz; lc3bin_write_header(fp_out, - frame_us, enc_srate_hz, p.bitrate, nch, enc_samples); + frame_us, enc_srate_hz, p.hrmode, + p.bitrate, nch, enc_samples); /* --- Setup encoding --- */ - int8_t alignas(int32_t) pcm[2 * LC3_MAX_FRAME_SAMPLES*4]; - uint8_t out[2 * LC3_MAX_FRAME_BYTES]; + int8_t alignas(int32_t) pcm[2 * LC3_MAX_HR_FRAME_SAMPLES*4]; + uint8_t out[2 * LC3_MAX_HR_FRAME_BYTES]; lc3_encoder_t enc[2]; - int frame_bytes = lc3_frame_bytes(frame_us, p.bitrate / nch); - int frame_samples = lc3_frame_samples(frame_us, srate_hz); - int encode_samples = nsamples + lc3_delay_samples(frame_us, srate_hz); + int frame_bytes = lc3_hr_frame_bytes( + p.hrmode, frame_us, srate_hz, p.bitrate / nch); + int frame_samples = lc3_hr_frame_samples( + p.hrmode, frame_us, srate_hz); + int encode_samples = nsamples + lc3_hr_delay_samples( + p.hrmode, frame_us, srate_hz); enum lc3_pcm_format pcm_fmt = pcm_sbytes == 32/8 ? LC3_PCM_FORMAT_S24 : pcm_sbytes == 24/8 ? LC3_PCM_FORMAT_S24_3LE : LC3_PCM_FORMAT_S16; - for (int ich = 0; ich < nch; ich++) - enc[ich] = lc3_setup_encoder(frame_us, enc_srate_hz, srate_hz, - malloc(lc3_encoder_size(frame_us, srate_hz))); + for (int ich = 0; ich < nch; ich++) { + enc[ich] = lc3_hr_setup_encoder( + p.hrmode, frame_us, enc_srate_hz, srate_hz, + malloc(lc3_hr_encoder_size(p.hrmode, frame_us, srate_hz))); + + if (!enc[ich]) + error(EINVAL, "Encoder initialization failed"); + } /* --- Encoding loop --- */ diff --git a/tools/lc3bin.c b/tools/lc3bin.c index fd59447..576cab5 100644 --- a/tools/lc3bin.c +++ b/tools/lc3bin.c @@ -43,10 +43,10 @@ struct lc3bin_header { * Read LC3 binary header */ int lc3bin_read_header(FILE *fp, - int *frame_us, int *srate_hz, int *nchannels, int *nsamples) + int *frame_us, int *srate_hz, bool *hrmode, int *nchannels, int *nsamples) { struct lc3bin_header hdr; - uint16_t hrmode = 0; + uint16_t hdr_hrmode = 0; if (fread(&hdr, sizeof(hdr), 1, fp) != 1 || hdr.file_id != LC3_FILE_ID @@ -55,15 +55,16 @@ int lc3bin_read_header(FILE *fp, int num_extended_params = (hdr.header_size - sizeof(hdr)) / sizeof(uint16_t); if (num_extended_params >= 1 && - fread(&hrmode, sizeof(hrmode), 1, fp) != 1) + fread(&hdr_hrmode, sizeof(hdr_hrmode), 1, fp) != 1) return -1; *nchannels = hdr.channels; *frame_us = hdr.frame_10us * 10; *srate_hz = hdr.srate_100hz * 100; *nsamples = hdr.nsamples_low | (hdr.nsamples_high << 16); + *hrmode = hdr_hrmode != 0; - if (hdr.epmode || hrmode) + if (hdr.epmode) return -1; fseek(fp, hdr.header_size, SEEK_SET); @@ -91,11 +92,15 @@ int lc3bin_read_data(FILE *fp, int nchannels, void *buffer) * Write LC3 binary header */ void lc3bin_write_header(FILE *fp, - int frame_us, int srate_hz, int bitrate, int nchannels, int nsamples) + int frame_us, int srate_hz, bool hrmode, + int bitrate, int nchannels, int nsamples) { + uint16_t hdr_hrmode = (hrmode != 0); + struct lc3bin_header hdr = { .file_id = LC3_FILE_ID, - .header_size = sizeof(struct lc3bin_header), + .header_size = sizeof(struct lc3bin_header) + + (hrmode ? sizeof(hdr_hrmode) : 0), .srate_100hz = srate_hz / 100, .bitrate_100bps = bitrate / 100, .channels = nchannels, @@ -105,6 +110,9 @@ void lc3bin_write_header(FILE *fp, }; fwrite(&hdr, sizeof(hdr), 1, fp); + + if (hrmode) + fwrite(&hdr_hrmode, sizeof(hdr_hrmode), 1, fp); } /** diff --git a/tools/lc3bin.h b/tools/lc3bin.h index b2d70e6..378511b 100644 --- a/tools/lc3bin.h +++ b/tools/lc3bin.h @@ -29,12 +29,14 @@ * fp Opened file, moved after header on return * frame_us Return frame duration, in us * srate_hz Return samplerate, in Hz + * hrmode Return true when high-resolution mode enabled * nchannels Return number of channels * nsamples Return count of source samples by channels * return 0: Ok -1: Bad LC3 File */ int lc3bin_read_header(FILE *fp, - int *frame_us, int *srate_hz, int *nchannels, int *nsamples); + int *frame_us, int *srate_hz, bool *hrmode, + int *nchannels, int *nsamples); /** * Read LC3 block of data @@ -50,12 +52,14 @@ int lc3bin_read_data(FILE *fp, int nchannels, void *buffer); * fp Opened file, moved after header on return * frame_us Frame duration, in us * srate_hz Samplerate, in Hz + * hrmode True when high-resolution mode enabled * bitrate Bitrate indication of the stream, in bps * nchannels Number of channels * nsamples Count of source samples by channels */ void lc3bin_write_header(FILE *fp, - int frame_us, int srate_hz, int bitrate, int nchannels, int nsamples); + int frame_us, int srate_hz, bool hrmode, + int bitrate, int nchannels, int nsamples); /** * Write LC3 block of data diff --git a/tools/wave.c b/tools/wave.c index 3478e11..126f913 100644 --- a/tools/wave.c +++ b/tools/wave.c @@ -49,7 +49,7 @@ struct wave_file { * Audio format statement * | id WAVE_FORMAT_ID * | size Size of the block - 8 bytes (= 16 bytes) - * | format WAVE_FORMAT_PCM + * | format WAVE_FORMAT_PCM or WAVE_FORMAT_EXT * | channels Number of channels * | samplerate Sampling rate * | byterate Bytes per secondes = `samplerate * framesize` @@ -58,7 +58,8 @@ struct wave_file { */ #define WAVE_FORMAT_ID __WAVE_ID("fmt ") -#define WAVE_FORMAT_PCM 1 +#define WAVE_FORMAT_PCM 0x0001 +#define WAVE_FORMAT_EXT 0xfffe struct wave_format { uint32_t id; @@ -103,7 +104,8 @@ int wave_read_header(FILE *fp, int *bitdepth, int *samplesize, if (fread(&format, sizeof(format), 1, fp) != 1 || format.id != WAVE_FORMAT_ID - || format.fmt != WAVE_FORMAT_PCM + || ( format.fmt != WAVE_FORMAT_PCM && + format.fmt != WAVE_FORMAT_EXT ) || format.channels <= 0 || format.samplerate <= 0 || format.framesize <= 0