From 30325d24d107dbf133da39f7c96d1510fd1c9449 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Fri, 15 Aug 2025 12:42:40 +0200 Subject: Bump to codec2 version 1.2.0 --- Makefile | 9 +- _kiss_fft_guts.h | 234 ++-- bpf.h | 120 +- bpfb.h | 119 +- codebook.c | 82 +- codebookd.c | 82 +- codebookge.c | 10 +- codebookjmv.c | 1591 ++++++++++++++++++++++ codebookjvm.c | 1579 ---------------------- codebooklspmelvq.c | 247 ---- codebookmel.c | 145 -- codebooknewamp1.c | 16 +- codebooknewamp1_energy.c | 8 +- codebooknewamp2.c | 2 +- codec2.c | 3331 ++++++++++++++++++---------------------------- codec2.h | 102 +- codec2_fft.c | 112 +- codec2_fft.h | 111 +- codec2_internal.h | 129 +- comp_prim.h | 109 +- defines.h | 89 +- interp.c | 247 ++-- interp.h | 16 +- kiss_fft.c | 714 +++++----- kiss_fft.h | 60 +- kiss_fftr.c | 272 ++-- kiss_fftr.h | 25 +- lpc.c | 223 ++-- lpc.h | 8 +- lsp.c | 354 +++-- lsp.h | 2 +- machdep.h | 12 +- main.c | 2 + mbest.c | 194 +-- mbest.h | 23 +- newamp1.c | 770 +++++------ newamp1.h | 86 +- newamp2.c | 570 -------- newamp2.h | 89 -- nlp.c | 609 ++++----- nlp.h | 5 +- os.h | 82 +- pack.c | 104 +- phase.c | 242 ++-- phase.h | 6 +- postfilter.c | 58 +- postfilter.h | 2 + quantise.c | 1992 ++++++++------------------- quantise.h | 116 +- sine.c | 591 ++++---- sine.h | 13 +- stripdown.sh | 17 +- version.h | 8 +- 53 files changed, 6375 insertions(+), 9364 deletions(-) create mode 100644 codebookjmv.c delete mode 100644 codebookjvm.c delete mode 100644 codebooklspmelvq.c delete mode 100644 codebookmel.c delete mode 100644 newamp2.c delete mode 100644 newamp2.h diff --git a/Makefile b/Makefile index a716871..2cc38c4 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,10 @@ -CFLAGS = -Wall -Wno-strict-overflow -std=gnu11 -fPIC -g -O2 -I. +CFLAGS = -Wall -Wno-strict-overflow -std=gnu11 -fPIC -g -O2 -I. -lm CFLAGS += -DHORUS_L2_RX -DINTERLEAVER -DRUN_TIME_TABLES -DSCRAMBLER -Dcodec2_EXPORTS CFLAGS += -Wno-incompatible-pointer-types-discards-qualifiers -LIBSRC=codebook.c codebookd.c codebookge.c codebookmel.c codebooklspmelvq.c codebookjvm.c \ - codebooknewamp1.c codebooknewamp1_energy.c codebooknewamp2.c codebooknewamp2_energy.c \ - codec2.c codec2_fft.c interp.c kiss_fft.c kiss_fftr.c lpc.c lsp.c mbest.c \ - newamp1.c newamp2.c nlp.c pack.c phase.c postfilter.c quantise.c sine.c +LIBSRC=codebook.c codebookd.c codebookge.c codebookjmv.c codebooknewamp1_energy.c \ + codebooknewamp1.c codec2.c codec2_fft.c interp.c kiss_fft.c kiss_fftr.c \ + lpc.c lsp.c mbest.c newamp1.c nlp.c pack.c phase.c postfilter.c quantise.c sine.c all: main diff --git a/_kiss_fft_guts.h b/_kiss_fft_guts.h index 1c62a34..16305af 100644 --- a/_kiss_fft_guts.h +++ b/_kiss_fft_guts.h @@ -3,33 +3,49 @@ Copyright (c) 2003-2010, Mark Borgerding All rights reserved. -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation and/or +other materials provided with the distribution. + * Neither the author nor the names of any contributors may be used to +endorse or promote products derived from this software without specific prior +written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* kiss_fft.h defines kiss_fft_scalar as either short or a float type and defines typedef struct { kiss_fft_scalar r; kiss_fft_scalar i; }kiss_fft_cpx; */ -#include "kiss_fft.h" #include +#include "kiss_fft.h" + #define MAXFACTORS 32 /* e.g. an fft of length 128 has 4 factors as far as kissfft is concerned 4*4*4*2 */ -struct kiss_fft_state{ - int nfft; - int inverse; - int factors[2*MAXFACTORS]; - kiss_fft_cpx twiddles[1]; +struct kiss_fft_state { + int nfft; + int inverse; + int factors[2 * MAXFACTORS]; + kiss_fft_cpx twiddles[1]; }; /* @@ -42,123 +58,137 @@ struct kiss_fft_state{ C_ADDTO( res , a) : res += a * */ #ifdef FIXED_POINT -#if (FIXED_POINT==32) -# define FRACBITS 31 -# define SAMPPROD int64_t +#if (FIXED_POINT == 32) +#define FRACBITS 31 +#define SAMPPROD int64_t #define SAMP_MAX 2147483647 #else -# define FRACBITS 15 -# define SAMPPROD int32_t +#define FRACBITS 15 +#define SAMPPROD int32_t #define SAMP_MAX 32767 #endif #define SAMP_MIN -SAMP_MAX #if defined(CHECK_OVERFLOW) -# define CHECK_OVERFLOW_OP(a,op,b) \ - if ( (SAMPPROD)(a) op (SAMPPROD)(b) > SAMP_MAX || (SAMPPROD)(a) op (SAMPPROD)(b) < SAMP_MIN ) { \ - fprintf(stderr,"WARNING:overflow @ " __FILE__ "(%d): (%d " #op" %d) = %ld\n",__LINE__,(a),(b),(SAMPPROD)(a) op (SAMPPROD)(b) ); } +#define CHECK_OVERFLOW_OP(a, op, b) \ + if ((SAMPPROD)(a)op(SAMPPROD)(b) > SAMP_MAX || \ + (SAMPPROD)(a)op(SAMPPROD)(b) < SAMP_MIN) { \ + fprintf(stderr, \ + "WARNING:overflow @ " __FILE__ "(%d): (%d " #op " %d) = %ld\n", \ + __LINE__, (a), (b), (SAMPPROD)(a)op(SAMPPROD)(b)); \ + } #endif - -# define smul(a,b) ( (SAMPPROD)(a)*(b) ) -# define sround( x ) (kiss_fft_scalar)( ( (x) + (1<<(FRACBITS-1)) ) >> FRACBITS ) - -# define S_MUL(a,b) sround( smul(a,b) ) - -# define C_MUL(m,a,b) \ - do{ (m).r = sround( smul((a).r,(b).r) - smul((a).i,(b).i) ); \ - (m).i = sround( smul((a).r,(b).i) + smul((a).i,(b).r) ); }while(0) - -# define DIVSCALAR(x,k) \ - (x) = sround( smul( x, SAMP_MAX/k ) ) - -# define C_FIXDIV(c,div) \ - do { DIVSCALAR( (c).r , div); \ - DIVSCALAR( (c).i , div); }while (0) - -# define C_MULBYSCALAR( c, s ) \ - do{ (c).r = sround( smul( (c).r , s ) ) ;\ - (c).i = sround( smul( (c).i , s ) ) ; }while(0) - -#else /* not FIXED_POINT*/ - -# define S_MUL(a,b) ( (a)*(b) ) -#define C_MUL(m,a,b) \ - do{ (m).r = (a).r*(b).r - (a).i*(b).i;\ - (m).i = (a).r*(b).i + (a).i*(b).r; }while(0) -# define C_FIXDIV(c,div) /* NOOP */ -# define C_MULBYSCALAR( c, s ) \ - do{ (c).r *= (s);\ - (c).i *= (s); }while(0) +#define smul(a, b) ((SAMPPROD)(a) * (b)) +#define sround(x) (kiss_fft_scalar)(((x) + (1 << (FRACBITS - 1))) >> FRACBITS) + +#define S_MUL(a, b) sround(smul(a, b)) + +#define C_MUL(m, a, b) \ + do { \ + (m).r = sround(smul((a).r, (b).r) - smul((a).i, (b).i)); \ + (m).i = sround(smul((a).r, (b).i) + smul((a).i, (b).r)); \ + } while (0) + +#define DIVSCALAR(x, k) (x) = sround(smul(x, SAMP_MAX / k)) + +#define C_FIXDIV(c, div) \ + do { \ + DIVSCALAR((c).r, div); \ + DIVSCALAR((c).i, div); \ + } while (0) + +#define C_MULBYSCALAR(c, s) \ + do { \ + (c).r = sround(smul((c).r, s)); \ + (c).i = sround(smul((c).i, s)); \ + } while (0) + +#else /* not FIXED_POINT*/ + +#define S_MUL(a, b) ((a) * (b)) +#define C_MUL(m, a, b) \ + do { \ + (m).r = (a).r * (b).r - (a).i * (b).i; \ + (m).i = (a).r * (b).i + (a).i * (b).r; \ + } while (0) +#define C_FIXDIV(c, div) /* NOOP */ +#define C_MULBYSCALAR(c, s) \ + do { \ + (c).r *= (s); \ + (c).i *= (s); \ + } while (0) #endif #ifndef CHECK_OVERFLOW_OP -# define CHECK_OVERFLOW_OP(a,op,b) /* noop */ +#define CHECK_OVERFLOW_OP(a, op, b) /* noop */ #endif -#define C_ADD( res, a,b)\ - do { \ - CHECK_OVERFLOW_OP((a).r,+,(b).r)\ - CHECK_OVERFLOW_OP((a).i,+,(b).i)\ - (res).r=(a).r+(b).r; (res).i=(a).i+(b).i; \ - }while(0) -#define C_SUB( res, a,b)\ - do { \ - CHECK_OVERFLOW_OP((a).r,-,(b).r)\ - CHECK_OVERFLOW_OP((a).i,-,(b).i)\ - (res).r=(a).r-(b).r; (res).i=(a).i-(b).i; \ - }while(0) -#define C_ADDTO( res , a)\ - do { \ - CHECK_OVERFLOW_OP((res).r,+,(a).r)\ - CHECK_OVERFLOW_OP((res).i,+,(a).i)\ - (res).r += (a).r; (res).i += (a).i;\ - }while(0) - -#define C_SUBFROM( res , a)\ - do {\ - CHECK_OVERFLOW_OP((res).r,-,(a).r)\ - CHECK_OVERFLOW_OP((res).i,-,(a).i)\ - (res).r -= (a).r; (res).i -= (a).i; \ - }while(0) - +#define C_ADD(res, a, b) \ + do { \ + CHECK_OVERFLOW_OP((a).r, +, (b).r) \ + CHECK_OVERFLOW_OP((a).i, +, (b).i) \ + (res).r = (a).r + (b).r; \ + (res).i = (a).i + (b).i; \ + } while (0) +#define C_SUB(res, a, b) \ + do { \ + CHECK_OVERFLOW_OP((a).r, -, (b).r) \ + CHECK_OVERFLOW_OP((a).i, -, (b).i) \ + (res).r = (a).r - (b).r; \ + (res).i = (a).i - (b).i; \ + } while (0) +#define C_ADDTO(res, a) \ + do { \ + CHECK_OVERFLOW_OP((res).r, +, (a).r) \ + CHECK_OVERFLOW_OP((res).i, +, (a).i) \ + (res).r += (a).r; \ + (res).i += (a).i; \ + } while (0) + +#define C_SUBFROM(res, a) \ + do { \ + CHECK_OVERFLOW_OP((res).r, -, (a).r) \ + CHECK_OVERFLOW_OP((res).i, -, (a).i) \ + (res).r -= (a).r; \ + (res).i -= (a).i; \ + } while (0) #ifdef FIXED_POINT -# define KISS_FFT_COS(phase) floorf(.5+SAMP_MAX * cosf (phase)) -# define KISS_FFT_SIN(phase) floorf(.5+SAMP_MAX * sinf (phase)) -# define HALF_OF(x) ((x)>>1) +#define KISS_FFT_COS(phase) floorf(.5 + SAMP_MAX * cosf(phase)) +#define KISS_FFT_SIN(phase) floorf(.5 + SAMP_MAX * sinf(phase)) +#define HALF_OF(x) ((x) >> 1) #elif defined(USE_SIMD) -# define KISS_FFT_COS(phase) _mm_set1_ps( cosf(phase) ) -# define KISS_FFT_SIN(phase) _mm_set1_ps( sinf(phase) ) -# define HALF_OF(x) ((x)*_mm_set1_ps(.5)) +#define KISS_FFT_COS(phase) _mm_set1_ps(cosf(phase)) +#define KISS_FFT_SIN(phase) _mm_set1_ps(sinf(phase)) +#define HALF_OF(x) ((x)*_mm_set1_ps(.5)) #else -# define KISS_FFT_COS(phase) (kiss_fft_scalar) cosf(phase) -# define KISS_FFT_SIN(phase) (kiss_fft_scalar) sinf(phase) -# define HALF_OF(x) ((x)*.5) +#define KISS_FFT_COS(phase) (kiss_fft_scalar) cosf(phase) +#define KISS_FFT_SIN(phase) (kiss_fft_scalar) sinf(phase) +#define HALF_OF(x) ((x)*.5) #endif -#define kf_cexp(x,phase) \ - do{ \ - (x)->r = KISS_FFT_COS(phase);\ - (x)->i = KISS_FFT_SIN(phase);\ - }while(0) - +#define kf_cexp(x, phase) \ + do { \ + (x)->r = KISS_FFT_COS(phase); \ + (x)->i = KISS_FFT_SIN(phase); \ + } while (0) /* a debugging function */ -#define pcpx(c)\ - fprintf(stderr,"%g + %gi\n",(double)((c)->r),(double)((c)->i) ) - +#define pcpx(c) \ + fprintf(stderr, "%g + %gi\n", (double)((c)->r), (double)((c)->i)) #ifdef KISS_FFT_USE_ALLOCA // define this to allow use of alloca instead of malloc for temporary buffers // Temporary buffers are used in two case: // 1. FFT sizes that have "bad" factors. i.e. not 2,3 and 5 -// 2. "in-place" FFTs. Notice the quotes, since kissfft does not really do an in-place transform. +// 2. "in-place" FFTs. Notice the quotes, since kissfft does not really do an +// in-place transform. #include -#define KISS_FFT_TMP_ALLOC(nbytes) alloca(nbytes) -#define KISS_FFT_TMP_FREE(ptr) +#define KISS_FFT_TMP_ALLOC(nbytes) alloca(nbytes) +#define KISS_FFT_TMP_FREE(ptr) #else -#define KISS_FFT_TMP_ALLOC(nbytes) KISS_FFT_MALLOC(nbytes) -#define KISS_FFT_TMP_FREE(ptr) KISS_FFT_FREE(ptr) +#define KISS_FFT_TMP_ALLOC(nbytes) KISS_FFT_MALLOC(nbytes) +#define KISS_FFT_TMP_FREE(ptr) KISS_FFT_FREE(ptr) #endif diff --git a/bpf.h b/bpf.h index 0b0a6e2..d74e059 100644 --- a/bpf.h +++ b/bpf.h @@ -1,106 +1,18 @@ #define BPF_N 101 -float bpf[]={ - 0.002174, - 0.003245, - 0.002147, - 0.001866, - 0.002764, - 0.000567, - -0.001641, - -0.000565, - -0.002415, - -0.005837, - -0.003620, - -0.002828, - -0.006268, - -0.002787, - 0.001963, - -0.001234, - 0.001446, - 0.009200, - 0.005331, - 0.003521, - 0.011821, - 0.006951, - -0.002015, - 0.005137, - 0.001828, - -0.013390, - -0.007058, - -0.003273, - -0.020458, - -0.014321, - 0.001751, - -0.012891, - -0.009730, - 0.018993, - 0.008544, - 0.000534, - 0.035755, - 0.029074, - -0.001192, - 0.030852, - 0.030983, - -0.029834, - -0.009550, - 0.011945, - -0.081971, - -0.082875, - 0.000423, - -0.133526, - -0.211778, - 0.182628, - 0.514906, - 0.182628, - -0.211778, - -0.133526, - 0.000423, - -0.082875, - -0.081971, - 0.011945, - -0.009550, - -0.029834, - 0.030983, - 0.030852, - -0.001192, - 0.029074, - 0.035755, - 0.000534, - 0.008544, - 0.018993, - -0.009730, - -0.012891, - 0.001751, - -0.014321, - -0.020458, - -0.003273, - -0.007058, - -0.013390, - 0.001828, - 0.005137, - -0.002015, - 0.006951, - 0.011821, - 0.003521, - 0.005331, - 0.009200, - 0.001446, - -0.001234, - 0.001963, - -0.002787, - -0.006268, - -0.002828, - -0.003620, - -0.005837, - -0.002415, - -0.000565, - -0.001641, - 0.000567, - 0.002764, - 0.001866, - 0.002147, - 0.003245, - 0.002174 -}; - +float bpf[] = { + 0.002174, 0.003245, 0.002147, 0.001866, 0.002764, 0.000567, -0.001641, + -0.000565, -0.002415, -0.005837, -0.003620, -0.002828, -0.006268, -0.002787, + 0.001963, -0.001234, 0.001446, 0.009200, 0.005331, 0.003521, 0.011821, + 0.006951, -0.002015, 0.005137, 0.001828, -0.013390, -0.007058, -0.003273, + -0.020458, -0.014321, 0.001751, -0.012891, -0.009730, 0.018993, 0.008544, + 0.000534, 0.035755, 0.029074, -0.001192, 0.030852, 0.030983, -0.029834, + -0.009550, 0.011945, -0.081971, -0.082875, 0.000423, -0.133526, -0.211778, + 0.182628, 0.514906, 0.182628, -0.211778, -0.133526, 0.000423, -0.082875, + -0.081971, 0.011945, -0.009550, -0.029834, 0.030983, 0.030852, -0.001192, + 0.029074, 0.035755, 0.000534, 0.008544, 0.018993, -0.009730, -0.012891, + 0.001751, -0.014321, -0.020458, -0.003273, -0.007058, -0.013390, 0.001828, + 0.005137, -0.002015, 0.006951, 0.011821, 0.003521, 0.005331, 0.009200, + 0.001446, -0.001234, 0.001963, -0.002787, -0.006268, -0.002828, -0.003620, + -0.005837, -0.002415, -0.000565, -0.001641, 0.000567, 0.002764, 0.001866, + 0.002147, 0.003245, 0.002174}; diff --git a/bpfb.h b/bpfb.h index 73b1a69..e3a958f 100644 --- a/bpfb.h +++ b/bpfb.h @@ -1,105 +1,18 @@ #define BPFB_N 101 -float bpfb[]={ - 0.003795, - 0.006827, - 0.002261, - 0.002523, - 0.005758, - -0.000264, - -0.000674, - 0.003113, - -0.004144, - -0.004923, - 0.000043, - -0.008017, - -0.008711, - -0.001802, - -0.010210, - -0.010428, - -0.000899, - -0.009413, - -0.009072, - 0.003469, - -0.005335, - -0.004828, - 0.010724, - 0.000941, - 0.000708, - 0.018957, - 0.007084, - 0.004825, - 0.025418, - 0.010147, - 0.004452, - 0.027434, - 0.007550, - -0.002861, - 0.023483, - -0.001944, - -0.018138, - 0.014122, - -0.017583, - -0.040768, - 0.002598, - -0.036604, - -0.069541, - -0.004273, - -0.054876, - -0.107289, - 0.010068, - -0.068052, - -0.200119, - 0.207287, - 0.597150, - 0.207287, - -0.200119, - -0.068052, - 0.010068, - -0.107289, - -0.054876, - -0.004273, - -0.069541, - -0.036604, - 0.002598, - -0.040768, - -0.017583, - 0.014122, - -0.018138, - -0.001944, - 0.023483, - -0.002861, - 0.007550, - 0.027434, - 0.004452, - 0.010147, - 0.025418, - 0.004825, - 0.007084, - 0.018957, - 0.000708, - 0.000941, - 0.010724, - -0.004828, - -0.005335, - 0.003469, - -0.009072, - -0.009413, - -0.000899, - -0.010428, - -0.010210, - -0.001802, - -0.008711, - -0.008017, - 0.000043, - -0.004923, - -0.004144, - 0.003113, - -0.000674, - -0.000264, - 0.005758, - 0.002523, - 0.002261, - 0.006827, - 0.003795 -}; \ No newline at end of file +float bpfb[] = { + 0.003795, 0.006827, 0.002261, 0.002523, 0.005758, -0.000264, -0.000674, + 0.003113, -0.004144, -0.004923, 0.000043, -0.008017, -0.008711, -0.001802, + -0.010210, -0.010428, -0.000899, -0.009413, -0.009072, 0.003469, -0.005335, + -0.004828, 0.010724, 0.000941, 0.000708, 0.018957, 0.007084, 0.004825, + 0.025418, 0.010147, 0.004452, 0.027434, 0.007550, -0.002861, 0.023483, + -0.001944, -0.018138, 0.014122, -0.017583, -0.040768, 0.002598, -0.036604, + -0.069541, -0.004273, -0.054876, -0.107289, 0.010068, -0.068052, -0.200119, + 0.207287, 0.597150, 0.207287, -0.200119, -0.068052, 0.010068, -0.107289, + -0.054876, -0.004273, -0.069541, -0.036604, 0.002598, -0.040768, -0.017583, + 0.014122, -0.018138, -0.001944, 0.023483, -0.002861, 0.007550, 0.027434, + 0.004452, 0.010147, 0.025418, 0.004825, 0.007084, 0.018957, 0.000708, + 0.000941, 0.010724, -0.004828, -0.005335, 0.003469, -0.009072, -0.009413, + -0.000899, -0.010428, -0.010210, -0.001802, -0.008711, -0.008017, 0.000043, + -0.004923, -0.004144, 0.003113, -0.000674, -0.000264, 0.005758, 0.002523, + 0.002261, 0.006827, 0.003795}; \ No newline at end of file diff --git a/codebook.c b/codebook.c index 0b491ee..50602b7 100644 --- a/codebook.c +++ b/codebook.c @@ -1,14 +1,18 @@ /* THIS IS A GENERATED FILE. Edit generate_codebook.c and its input */ /* - * This intermediary file and the files that used to create it are under + * This intermediary file and the files that used to create it are under * The LGPL. See the file COPYING. */ #include "defines.h" - /* codebook/lsp1.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/lsp1.txt */ +#ifdef __EMBEDDED__ static const float codes0[] = { +#else +static float codes0[] = { +#endif 225, 250, 275, @@ -26,8 +30,12 @@ static const float codes0[] = { 575, 600 }; - /* codebook/lsp2.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/lsp2.txt */ +#ifdef __EMBEDDED__ static const float codes1[] = { +#else +static float codes1[] = { +#endif 325, 350, 375, @@ -45,8 +53,12 @@ static const float codes1[] = { 675, 700 }; - /* codebook/lsp3.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/lsp3.txt */ +#ifdef __EMBEDDED__ static const float codes2[] = { +#else +static float codes2[] = { +#endif 500, 550, 600, @@ -64,8 +76,12 @@ static const float codes2[] = { 1200, 1250 }; - /* codebook/lsp4.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/lsp4.txt */ +#ifdef __EMBEDDED__ static const float codes3[] = { +#else +static float codes3[] = { +#endif 700, 800, 900, @@ -83,8 +99,12 @@ static const float codes3[] = { 2100, 2200 }; - /* codebook/lsp5.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/lsp5.txt */ +#ifdef __EMBEDDED__ static const float codes4[] = { +#else +static float codes4[] = { +#endif 950, 1050, 1150, @@ -102,8 +122,12 @@ static const float codes4[] = { 2350, 2450 }; - /* codebook/lsp6.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/lsp6.txt */ +#ifdef __EMBEDDED__ static const float codes5[] = { +#else +static float codes5[] = { +#endif 1100, 1200, 1300, @@ -121,8 +145,12 @@ static const float codes5[] = { 2500, 2600 }; - /* codebook/lsp7.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/lsp7.txt */ +#ifdef __EMBEDDED__ static const float codes6[] = { +#else +static float codes6[] = { +#endif 1500, 1600, 1700, @@ -140,8 +168,12 @@ static const float codes6[] = { 2900, 3000 }; - /* codebook/lsp8.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/lsp8.txt */ +#ifdef __EMBEDDED__ static const float codes7[] = { +#else +static float codes7[] = { +#endif 2300, 2400, 2500, @@ -151,8 +183,12 @@ static const float codes7[] = { 2900, 3000 }; - /* codebook/lsp9.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/lsp9.txt */ +#ifdef __EMBEDDED__ static const float codes8[] = { +#else +static float codes8[] = { +#endif 2500, 2600, 2700, @@ -162,8 +198,12 @@ static const float codes8[] = { 3100, 3200 }; - /* codebook/lsp10.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/lsp10.txt */ +#ifdef __EMBEDDED__ static const float codes9[] = { +#else +static float codes9[] = { +#endif 2900, 3100, 3300, @@ -171,70 +211,70 @@ static const float codes9[] = { }; const struct lsp_codebook lsp_cb[] = { - /* codebook/lsp1.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/lsp1.txt */ { 1, 4, 16, codes0 }, - /* codebook/lsp2.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/lsp2.txt */ { 1, 4, 16, codes1 }, - /* codebook/lsp3.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/lsp3.txt */ { 1, 4, 16, codes2 }, - /* codebook/lsp4.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/lsp4.txt */ { 1, 4, 16, codes3 }, - /* codebook/lsp5.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/lsp5.txt */ { 1, 4, 16, codes4 }, - /* codebook/lsp6.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/lsp6.txt */ { 1, 4, 16, codes5 }, - /* codebook/lsp7.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/lsp7.txt */ { 1, 4, 16, codes6 }, - /* codebook/lsp8.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/lsp8.txt */ { 1, 3, 8, codes7 }, - /* codebook/lsp9.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/lsp9.txt */ { 1, 3, 8, codes8 }, - /* codebook/lsp10.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/lsp10.txt */ { 1, 2, diff --git a/codebookd.c b/codebookd.c index 5816402..5ca8651 100644 --- a/codebookd.c +++ b/codebookd.c @@ -1,14 +1,18 @@ /* THIS IS A GENERATED FILE. Edit generate_codebook.c and its input */ /* - * This intermediary file and the files that used to create it are under + * This intermediary file and the files that used to create it are under * The LGPL. See the file COPYING. */ #include "defines.h" - /* codebook/dlsp1.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/dlsp1.txt */ +#ifdef __EMBEDDED__ static const float codes0[] = { +#else +static float codes0[] = { +#endif 25, 50, 75, @@ -42,8 +46,12 @@ static const float codes0[] = { 775, 800 }; - /* codebook/dlsp2.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/dlsp2.txt */ +#ifdef __EMBEDDED__ static const float codes1[] = { +#else +static float codes1[] = { +#endif 25, 50, 75, @@ -77,8 +85,12 @@ static const float codes1[] = { 775, 800 }; - /* codebook/dlsp3.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/dlsp3.txt */ +#ifdef __EMBEDDED__ static const float codes2[] = { +#else +static float codes2[] = { +#endif 25, 50, 75, @@ -112,8 +124,12 @@ static const float codes2[] = { 775, 800 }; - /* codebook/dlsp4.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/dlsp4.txt */ +#ifdef __EMBEDDED__ static const float codes3[] = { +#else +static float codes3[] = { +#endif 25, 50, 75, @@ -147,8 +163,12 @@ static const float codes3[] = { 1350, 1400 }; - /* codebook/dlsp5.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/dlsp5.txt */ +#ifdef __EMBEDDED__ static const float codes4[] = { +#else +static float codes4[] = { +#endif 25, 50, 75, @@ -182,8 +202,12 @@ static const float codes4[] = { 1350, 1400 }; - /* codebook/dlsp6.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/dlsp6.txt */ +#ifdef __EMBEDDED__ static const float codes5[] = { +#else +static float codes5[] = { +#endif 25, 50, 75, @@ -217,8 +241,12 @@ static const float codes5[] = { 1350, 1400 }; - /* codebook/dlsp7.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/dlsp7.txt */ +#ifdef __EMBEDDED__ static const float codes6[] = { +#else +static float codes6[] = { +#endif 25, 50, 75, @@ -252,8 +280,12 @@ static const float codes6[] = { 775, 800 }; - /* codebook/dlsp8.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/dlsp8.txt */ +#ifdef __EMBEDDED__ static const float codes7[] = { +#else +static float codes7[] = { +#endif 25, 50, 75, @@ -287,8 +319,12 @@ static const float codes7[] = { 775, 800 }; - /* codebook/dlsp9.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/dlsp9.txt */ +#ifdef __EMBEDDED__ static const float codes8[] = { +#else +static float codes8[] = { +#endif 25, 50, 75, @@ -322,8 +358,12 @@ static const float codes8[] = { 775, 800 }; - /* codebook/dlsp10.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/dlsp10.txt */ +#ifdef __EMBEDDED__ static const float codes9[] = { +#else +static float codes9[] = { +#endif 25, 50, 75, @@ -359,70 +399,70 @@ static const float codes9[] = { }; const struct lsp_codebook lsp_cbd[] = { - /* codebook/dlsp1.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/dlsp1.txt */ { 1, 5, 32, codes0 }, - /* codebook/dlsp2.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/dlsp2.txt */ { 1, 5, 32, codes1 }, - /* codebook/dlsp3.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/dlsp3.txt */ { 1, 5, 32, codes2 }, - /* codebook/dlsp4.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/dlsp4.txt */ { 1, 5, 32, codes3 }, - /* codebook/dlsp5.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/dlsp5.txt */ { 1, 5, 32, codes4 }, - /* codebook/dlsp6.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/dlsp6.txt */ { 1, 5, 32, codes5 }, - /* codebook/dlsp7.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/dlsp7.txt */ { 1, 5, 32, codes6 }, - /* codebook/dlsp8.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/dlsp8.txt */ { 1, 5, 32, codes7 }, - /* codebook/dlsp9.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/dlsp9.txt */ { 1, 5, 32, codes8 }, - /* codebook/dlsp10.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/dlsp10.txt */ { 1, 5, diff --git a/codebookge.c b/codebookge.c index 5bcb623..8bb0329 100644 --- a/codebookge.c +++ b/codebookge.c @@ -1,14 +1,18 @@ /* THIS IS A GENERATED FILE. Edit generate_codebook.c and its input */ /* - * This intermediary file and the files that used to create it are under + * This intermediary file and the files that used to create it are under * The LGPL. See the file COPYING. */ #include "defines.h" - /* codebook/gecb.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/gecb.txt */ +#ifdef __EMBEDDED__ static const float codes0[] = { +#else +static float codes0[] = { +#endif 2.71, 12.0184, 0.04675, -2.73881, 0.120993, 8.38895, @@ -268,7 +272,7 @@ static const float codes0[] = { }; const struct lsp_codebook ge_cb[] = { - /* codebook/gecb.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/gecb.txt */ { 2, 8, diff --git a/codebookjmv.c b/codebookjmv.c new file mode 100644 index 0000000..75af664 --- /dev/null +++ b/codebookjmv.c @@ -0,0 +1,1591 @@ +/* THIS IS A GENERATED FILE. Edit generate_codebook.c and its input */ + +/* + * This intermediary file and the files that used to create it are under + * The LGPL. See the file COPYING. + */ + +#include "defines.h" + + /* /Users/erdgeist/Coding/codec2/src/codebook/lspjmv1.txt */ +#ifdef __EMBEDDED__ +static const float codes0[] = { +#else +static float codes0[] = { +#endif + 0.435217, 0.668864, 1.0103, 1.22042, 1.50398, 1.78468, 2.13546, 2.35747, 2.61891, 2.73804, + 0.179285, 0.33316, 0.500638, 0.79695, 1.03999, 1.23497, 1.6523, 1.84823, 2.62556, 2.80497, + 0.268785, 0.356576, 0.595753, 1.04434, 1.24938, 1.42868, 1.68699, 1.86469, 2.33991, 2.5138, + 0.12007, 0.165585, 0.484694, 0.95916, 1.23753, 1.52915, 1.83751, 2.10773, 2.48749, 2.76685, + 0.150214, 0.229487, 0.62824, 0.961255, 1.33706, 1.59831, 1.91974, 2.21786, 2.53732, 2.75956, + 0.268624, 0.34598, 0.569637, 0.754737, 0.916538, 1.50854, 1.78635, 1.95442, 2.36953, 2.50182, + 0.246064, 0.468874, 0.662711, 0.890015, 1.14715, 1.51043, 1.78106, 2.09594, 2.65539, 2.80037, + 0.191631, 0.280628, 0.393229, 0.611761, 1.42017, 1.70774, 1.87303, 2.10155, 2.28035, 2.49949, + 0.361668, 0.507047, 0.789974, 1.04599, 1.50238, 1.67703, 1.90534, 2.16255, 2.43226, 2.59087, + 0.20816, 0.294285, 0.448634, 0.694229, 0.872517, 1.07032, 1.70335, 2.16874, 2.42619, 2.60366, + 0.316939, 0.513618, 0.705487, 0.917036, 1.17599, 1.31114, 1.6186, 2.03784, 2.45052, 2.5794, + 0.241068, 0.377728, 0.521595, 0.717203, 1.31041, 1.53999, 1.73643, 2.09893, 2.29792, 2.58735, + 0.234937, 0.281875, 0.780422, 1.44073, 1.60943, 1.75643, 1.97721, 2.14861, 2.60203, 2.7225, + 0.178679, 0.242672, 0.416988, 0.708348, 0.95562, 1.17667, 1.7818, 2.05449, 2.28159, 2.44811, + 0.345036, 0.42108, 0.740887, 1.16544, 1.32494, 1.4888, 1.76346, 1.90617, 2.39505, 2.64916, + 0.249586, 0.357494, 0.520747, 0.847195, 1.42841, 1.59778, 1.77819, 2.1785, 2.41344, 2.56466, + 0.295235, 0.574231, 1.2491, 1.4641, 1.72756, 1.92679, 2.09536, 2.28483, 2.56707, 2.72248, + 0.34193, 0.427307, 0.634001, 0.804212, 0.905629, 1.33337, 1.79033, 1.89276, 2.44582, 2.60283, + 0.363948, 0.508985, 0.667357, 0.946354, 1.43756, 1.62654, 1.81114, 2.03909, 2.29188, 2.43549, + 0.163514, 0.277407, 0.409207, 0.902065, 1.18907, 1.33964, 1.80241, 1.96077, 2.65293, 2.81899, + 0.302643, 0.359753, 0.651207, 1.20802, 1.4237, 1.54815, 1.88213, 2.01559, 2.26054, 2.5789, + 0.155928, 0.216908, 0.381812, 0.654803, 1.11237, 1.58993, 1.84756, 1.97672, 2.22408, 2.72534, + 0.274981, 0.347675, 0.572, 0.736046, 0.894248, 1.63237, 1.89139, 2.05689, 2.6029, 2.72178, + 0.154496, 0.243461, 0.348174, 0.689505, 1.57381, 1.70031, 1.94318, 2.10158, 2.56466, 2.77317, + 0.292612, 0.466612, 0.795936, 1.04747, 1.41369, 1.75085, 2.06289, 2.34007, 2.61361, 2.76949, + 0.242896, 0.3615, 0.555859, 0.793597, 0.932291, 1.40947, 1.86386, 2.00953, 2.4645, 2.67749, + 0.221646, 0.344724, 0.554564, 0.729403, 1.13657, 1.30177, 1.52918, 2.16359, 2.39582, 2.61081, + 0.160969, 0.224467, 0.371545, 0.626879, 1.16095, 1.44423, 1.67597, 1.87978, 2.47859, 2.67202, + 0.214172, 0.341585, 0.676575, 0.977397, 1.32543, 1.7201, 2.07259, 2.36954, 2.63528, 2.77879, + 0.203311, 0.289438, 0.458739, 0.914153, 1.12288, 1.30292, 1.58384, 1.88683, 2.18787, 2.42704, + 0.280383, 0.3716, 0.824827, 1.10025, 1.23623, 1.39892, 1.57804, 2.016, 2.36897, 2.50673, + 0.170627, 0.251778, 0.393686, 0.608347, 1.2876, 1.44667, 1.79328, 2.03655, 2.31015, 2.75244, + 0.18058, 0.288746, 0.987854, 1.43171, 1.67722, 1.91566, 2.12494, 2.28945, 2.58961, 2.75426, + 0.176335, 0.266263, 0.445421, 0.706403, 0.875402, 1.42292, 1.75867, 1.96091, 2.41068, 2.60175, + 0.216173, 0.287404, 0.480696, 1.00977, 1.2913, 1.47664, 1.89558, 2.06429, 2.28406, 2.48311, + 0.176523, 0.273934, 0.403407, 0.966139, 1.30472, 1.43661, 1.94473, 2.08484, 2.54446, 2.76242, + 0.311836, 0.550501, 0.879591, 1.09623, 1.27666, 1.47786, 1.81771, 2.15434, 2.56047, 2.77984, + 0.179765, 0.25056, 0.455939, 1.02389, 1.22513, 1.47566, 1.73462, 1.91871, 2.14734, 2.43824, + 0.271033, 0.457235, 0.599622, 0.821049, 0.940125, 1.20094, 1.84972, 1.98666, 2.54817, 2.75158, + 0.179326, 0.248002, 0.426405, 0.81706, 1.28589, 1.56502, 2.11736, 2.29871, 2.5724, 2.7527, + 0.374409, 0.535936, 0.897009, 1.18507, 1.59157, 1.7572, 1.96794, 2.17999, 2.45739, 2.62264, + 0.185472, 0.282752, 0.409439, 0.657499, 0.856446, 1.0294, 1.87993, 2.06932, 2.34474, 2.7531, + 0.375964, 0.578457, 0.758945, 0.929339, 1.12748, 1.25944, 1.70411, 2.12297, 2.33603, 2.4983, + 0.225641, 0.36103, 0.501679, 0.783379, 1.31485, 1.45262, 1.71415, 1.98716, 2.2257, 2.72436, + 0.144996, 0.252919, 0.632145, 1.22604, 1.57534, 1.90155, 2.17148, 2.39055, 2.68229, 2.80983, + 0.172022, 0.263338, 0.448634, 0.729435, 0.984007, 1.1716, 1.75705, 1.99023, 2.32131, 2.77121, + 0.235731, 0.351117, 0.796871, 1.05571, 1.30022, 1.59182, 1.89587, 2.12292, 2.41789, 2.59982, + 0.254053, 0.319371, 0.455623, 1.08614, 1.66467, 1.91588, 2.05908, 2.23342, 2.45204, 2.58679, + 0.375538, 0.742993, 1.13991, 1.33776, 1.73556, 2.01391, 2.31501, 2.48343, 2.65158, 2.75521, + 0.247245, 0.481131, 0.710366, 0.897602, 1.12109, 1.27171, 1.78735, 2.1995, 2.42966, 2.74067, + 0.226103, 0.311441, 0.501648, 0.844424, 1.36282, 1.53134, 1.77747, 1.98993, 2.18749, 2.3585, + 0.195862, 0.296224, 0.609554, 0.783241, 1.24347, 1.44548, 1.63703, 2.02264, 2.48356, 2.64614, + 0.233302, 0.299441, 0.472792, 1.24946, 1.45788, 1.60186, 1.83143, 1.99372, 2.59719, 2.75543, + 0.168096, 0.224183, 0.3827, 0.596214, 1.06059, 1.29442, 1.60576, 1.84849, 2.3577, 2.56919, + 0.33005, 0.445912, 0.661713, 0.874446, 1.00079, 1.45297, 1.94399, 2.07692, 2.42388, 2.61236, + 0.226382, 0.287303, 0.517631, 0.806229, 1.30901, 1.88528, 2.16051, 2.28641, 2.52638, 2.66082, + 0.20317, 0.499314, 0.887358, 1.23507, 1.46292, 1.69826, 1.99932, 2.22922, 2.57161, 2.76669, + 0.307531, 0.378353, 0.573606, 0.712218, 0.850169, 1.309, 2.05909, 2.26382, 2.49794, 2.67682, + 0.276203, 0.51025, 0.6868, 0.902844, 1.2052, 1.32798, 1.71889, 2.03895, 2.25639, 2.69715, + 0.161948, 0.229115, 0.393619, 0.683613, 1.13781, 1.32269, 1.78372, 1.96158, 2.38907, 2.63608, + 0.201334, 0.276773, 0.468994, 0.967017, 1.47597, 1.63242, 1.96577, 2.19728, 2.48059, 2.70155, + 0.214587, 0.315421, 0.469498, 0.733397, 1.146, 1.27791, 1.72784, 2.22713, 2.44026, 2.68112, + 0.255602, 0.394609, 0.743393, 0.977796, 1.19908, 1.40597, 1.91834, 2.22483, 2.47919, 2.66339, + 0.245989, 0.352625, 0.517055, 0.80283, 1.55871, 1.79565, 1.94405, 2.13364, 2.33327, 2.47998, + 0.337423, 0.480433, 0.869036, 1.13957, 1.63076, 1.82296, 2.07484, 2.29261, 2.47913, 2.62532, + 0.220974, 0.35885, 0.57164, 0.752791, 0.937013, 1.15172, 1.6744, 2.06247, 2.55872, 2.78484, + 0.267518, 0.331708, 0.541111, 1.11655, 1.41112, 1.53287, 1.79295, 1.93352, 2.24894, 2.62864, + 0.084613, 0.105083, 0.297424, 0.916949, 1.2563, 1.56703, 1.88539, 2.18987, 2.52279, 2.7921, + 0.205328, 0.287223, 0.724462, 1.0324, 1.45771, 1.64217, 1.92563, 2.17552, 2.42964, 2.60549, + 0.232554, 0.338724, 0.502115, 0.859975, 1.04409, 1.24565, 1.80656, 1.99964, 2.26116, 2.45998, + 0.291638, 0.379172, 0.626072, 0.792796, 0.959124, 1.50489, 1.73447, 1.91961, 2.61436, 2.72271, + 0.191554, 0.263114, 0.426797, 0.610628, 1.07741, 1.82954, 2.02195, 2.21057, 2.42765, 2.61383, + 0.389151, 0.679476, 0.915414, 1.03664, 1.25085, 1.58661, 2.04097, 2.2815, 2.56794, 2.71882, + 0.2032, 0.30128, 0.470357, 0.668716, 0.851737, 0.980327, 1.57086, 2.03762, 2.28907, 2.69388, + 0.304064, 0.405934, 0.710274, 0.962705, 1.12882, 1.34167, 1.63505, 1.84538, 2.07992, 2.50751, + 0.171777, 0.240705, 0.409371, 0.786432, 1.2232, 1.37569, 1.69176, 1.86608, 2.35041, 2.49394, + 0.231251, 0.277994, 0.557867, 1.32582, 1.66035, 1.77948, 2.00714, 2.17232, 2.44046, 2.65231, + 0.188101, 0.259494, 0.412543, 0.624843, 0.839549, 1.0337, 1.63413, 1.93194, 2.24608, 2.42577, + 0.361304, 0.419465, 0.795676, 1.18461, 1.2968, 1.57845, 1.84175, 1.99736, 2.54054, 2.68714, + 0.274372, 0.338938, 0.492443, 0.963516, 1.50951, 1.70638, 1.86988, 2.07717, 2.26128, 2.44418, + 0.41599, 0.652103, 1.03129, 1.26955, 1.57275, 1.77297, 2.00466, 2.17527, 2.43061, 2.59655, + 0.242045, 0.370942, 0.534392, 0.763529, 1.00117, 1.12976, 1.68219, 2.14464, 2.32448, 2.7157, + 0.377438, 0.588168, 0.765394, 0.976873, 1.35665, 1.49009, 1.73797, 2.00677, 2.21369, 2.38997, + 0.191625, 0.284123, 0.405342, 1.01678, 1.43273, 1.54759, 1.81393, 1.95832, 2.47077, 2.64926, + 0.272672, 0.349555, 0.633911, 1.15223, 1.30394, 1.54764, 1.9195, 2.0477, 2.56278, 2.73058, + 0.168423, 0.23633, 0.421468, 0.831345, 1.08354, 1.55345, 1.88073, 2.0647, 2.37086, 2.63295, + 0.219318, 0.301481, 0.513617, 0.765086, 1.02602, 1.51465, 2.0482, 2.24857, 2.49981, 2.65707, + 0.232695, 0.347947, 0.495203, 0.71883, 1.42301, 1.72249, 1.87958, 2.16504, 2.42025, 2.58966, + 0.270284, 0.336865, 0.684929, 1.15579, 1.69042, 1.87674, 2.02736, 2.22618, 2.44675, 2.582, + 0.149701, 0.193747, 0.352019, 0.520123, 0.823974, 1.43475, 1.68659, 1.96115, 2.37091, 2.69307, + 0.254818, 0.412303, 0.601514, 0.771438, 1.17545, 1.37657, 1.53903, 1.93704, 2.40858, 2.56362, + 0.233713, 0.355886, 0.593725, 0.76288, 1.27148, 1.5639, 1.79752, 2.09469, 2.53863, 2.71173, + 0.179028, 0.237103, 0.396818, 1.04202, 1.63354, 1.76268, 2.12393, 2.32239, 2.58819, 2.75134, + 0.182027, 0.251039, 0.434581, 0.714302, 0.950997, 1.4379, 1.81357, 1.9691, 2.14588, 2.35397, + 0.501538, 0.692148, 0.84886, 1.07131, 1.35054, 1.48948, 1.84164, 2.10428, 2.34154, 2.51529, + 0.27453, 0.38147, 0.526682, 0.922143, 1.44495, 1.5736, 1.85877, 2.06675, 2.2848, 2.62682, + 0.360617, 0.583131, 0.979491, 1.25408, 1.48835, 1.79756, 2.21952, 2.48218, 2.74237, 2.86203, + 0.140913, 0.220301, 0.619552, 0.818307, 1.05243, 1.33997, 1.83073, 2.13395, 2.53638, 2.75113, + 0.293514, 0.391691, 0.79008, 0.96274, 1.16032, 1.5266, 1.80549, 2.04146, 2.36162, 2.56496, + 0.199542, 0.290571, 0.452891, 0.689515, 1.25853, 1.40988, 1.88624, 2.22813, 2.46568, 2.72665, + 0.29692, 0.356356, 0.784287, 0.99654, 1.14618, 1.62387, 1.8155, 2.0383, 2.60063, 2.7057, + 0.206451, 0.276025, 0.537547, 0.802572, 1.22041, 1.64206, 1.86363, 2.00198, 2.21534, 2.58538, + 0.33365, 0.464751, 0.653772, 0.966306, 1.10387, 1.3402, 1.7847, 1.91459, 2.47017, 2.68692, + 0.181861, 0.24487, 0.376456, 0.554383, 1.3299, 1.81044, 2.04784, 2.20232, 2.66086, 2.81706, + 0.450565, 0.647291, 0.951172, 1.22943, 1.51964, 1.68681, 2.04911, 2.26717, 2.50128, 2.6506, + 0.219996, 0.320591, 0.427747, 0.601183, 0.753448, 0.929578, 1.74198, 2.28579, 2.47263, 2.74957, + 0.333848, 0.423373, 0.658791, 1.0313, 1.22263, 1.36577, 1.90189, 2.1211, 2.29031, 2.53118, + 0.166064, 0.233902, 0.383355, 0.661806, 1.22657, 1.39968, 1.77127, 1.97454, 2.17349, 2.56634, + 0.189286, 0.243602, 0.390584, 1.38793, 1.58872, 1.76324, 2.09112, 2.31631, 2.59353, 2.75508, + 0.158404, 0.224878, 0.385, 0.668463, 0.942954, 1.41197, 1.70031, 1.82807, 2.0594, 2.69255, + 0.325989, 0.461263, 0.851471, 1.04571, 1.28403, 1.5162, 1.79734, 2.08839, 2.43767, 2.62721, + 0.223709, 0.28919, 0.632812, 0.858738, 1.5419, 1.74677, 1.93574, 2.18482, 2.40433, 2.58301, + 0.545842, 0.95242, 1.34082, 1.51684, 1.83888, 2.01289, 2.24497, 2.40317, 2.59228, 2.69112, + 0.238526, 0.349079, 0.494582, 0.987665, 1.17075, 1.34823, 1.46864, 2.29696, 2.64416, 2.78738, + 0.270857, 0.442003, 0.655998, 0.881913, 1.25925, 1.42836, 1.76987, 1.99853, 2.39559, 2.65284, + 0.154384, 0.211806, 0.489481, 0.997257, 1.24982, 1.54123, 1.77886, 1.9494, 2.31914, 2.62339, + 0.268258, 0.312888, 0.589114, 1.25863, 1.57271, 1.67543, 1.91278, 2.07046, 2.27993, 2.56423, + 0.170715, 0.224965, 0.374011, 0.540197, 1.16189, 1.49907, 1.92587, 2.08257, 2.24662, 2.46972, + 0.324358, 0.391989, 0.706816, 0.833614, 1.01573, 1.56899, 1.73598, 2.12707, 2.55841, 2.65387, + 0.178059, 0.258575, 0.374125, 0.536831, 1.33483, 1.79863, 1.98698, 2.18925, 2.43227, 2.6267, + 0.198857, 0.420955, 0.817664, 1.17836, 1.46674, 1.8213, 2.20733, 2.47441, 2.73828, 2.85119, + 0.188344, 0.324302, 0.470468, 0.790033, 0.934101, 1.18872, 1.88717, 2.05283, 2.44832, 2.63024, + 0.201295, 0.365646, 0.526513, 0.758388, 1.1401, 1.26733, 1.65017, 1.87934, 2.10289, 2.60029, + 0.135058, 0.169428, 0.307348, 0.50316, 1.01808, 1.44795, 1.81098, 2.134, 2.48028, 2.75985, + 0.178006, 0.26661, 0.390327, 0.928681, 1.50161, 1.62133, 1.87136, 2.02586, 2.58044, 2.7708, + 0.246182, 0.42429, 0.644023, 0.801168, 1.11488, 1.27776, 1.50332, 2.07489, 2.2957, 2.50138, + 0.322996, 0.430355, 0.6316, 1.0477, 1.22184, 1.42673, 1.90308, 2.03222, 2.51673, 2.70845, + 0.292994, 0.430599, 0.619178, 0.794567, 1.28303, 1.65282, 1.84084, 2.06995, 2.38538, 2.52825, + 0.525494, 0.787797, 1.12182, 1.38748, 1.67457, 1.93622, 2.22404, 2.39062, 2.63428, 2.74323, + 0.299504, 0.409196, 0.602235, 0.892336, 1.05643, 1.25377, 1.48914, 1.63988, 2.42748, 2.65037, + 0.423758, 0.52048, 0.758987, 1.04126, 1.17366, 1.42368, 1.81824, 1.93641, 2.363, 2.62664, + 0.155042, 0.247496, 0.641445, 0.954509, 1.22497, 1.46585, 1.83784, 2.09046, 2.4515, 2.71616, + 0.251949, 0.421094, 0.706797, 0.975659, 1.25991, 1.52007, 1.81631, 2.12202, 2.47491, 2.71667, + 0.21522, 0.302248, 0.730598, 0.896343, 1.14557, 1.37019, 1.70069, 2.02256, 2.28327, 2.48922, + 0.28523, 0.453559, 0.66367, 0.861526, 1.0116, 1.24742, 1.65598, 1.86129, 2.57894, 2.73133, + 0.162067, 0.219409, 0.373433, 0.544669, 1.1033, 1.59718, 1.92104, 2.1434, 2.4065, 2.66048, + 0.342367, 0.511499, 0.93135, 1.16322, 1.39365, 1.61115, 1.97277, 2.19442, 2.47077, 2.64926, + 0.25101, 0.364125, 0.560956, 0.746545, 1.01984, 1.17072, 1.53295, 2.28867, 2.57709, 2.72307, + 0.315001, 0.489412, 0.720682, 0.877607, 1.09047, 1.25385, 1.44822, 1.92295, 2.25589, 2.40863, + 0.174666, 0.235793, 0.387644, 0.554402, 1.23109, 1.45614, 1.68803, 2.12745, 2.36703, 2.59727, + 0.215113, 0.341915, 1.04372, 1.32275, 1.49541, 1.74189, 1.96116, 2.23982, 2.5449, 2.70394, + 0.219852, 0.30177, 0.513912, 0.705474, 0.87754, 1.2959, 1.699, 1.98706, 2.28797, 2.49697, + 0.290638, 0.366442, 0.655155, 1.04499, 1.17215, 1.53254, 1.80079, 1.94893, 2.50968, 2.66005, + 0.232252, 0.31377, 0.658552, 0.941977, 1.46317, 1.66549, 1.86246, 2.02784, 2.53402, 2.70124, + 0.326539, 0.552681, 1.12173, 1.33138, 1.52007, 1.86708, 2.08286, 2.33247, 2.60604, 2.73709, + 0.190254, 0.340428, 0.492777, 0.739738, 0.895461, 1.07937, 1.64316, 1.79529, 2.49182, 2.72938, + 0.283586, 0.41844, 0.587306, 0.870866, 1.41855, 1.57703, 1.7995, 2.0694, 2.27448, 2.4381, + 0.235752, 0.35765, 0.502891, 1.01243, 1.25885, 1.40779, 1.82006, 1.95583, 2.5059, 2.73433, + 0.278412, 0.343137, 0.849977, 1.2329, 1.3505, 1.59063, 1.78752, 2.09158, 2.54136, 2.66386, + 0.162966, 0.243159, 0.439238, 0.684821, 0.887783, 1.4629, 1.88174, 2.04425, 2.28939, 2.705, + 0.235063, 0.371799, 0.57821, 0.752199, 1.00855, 1.47628, 1.80491, 2.2714, 2.65504, 2.78965, + 0.154939, 0.223696, 0.344718, 0.667555, 1.49566, 1.66944, 2.06988, 2.30721, 2.62769, 2.81134, + 0.239702, 0.335917, 0.716616, 1.1318, 1.45251, 1.63913, 2.10552, 2.27982, 2.50203, 2.66922, + 0.226818, 0.331261, 0.472705, 0.651974, 0.781639, 1.2198, 1.8229, 2.08273, 2.43933, 2.6109, + 0.223413, 0.359594, 0.534704, 0.741518, 1.22589, 1.38987, 1.61819, 2.00991, 2.207, 2.45984, + 0.171308, 0.268378, 0.383799, 0.858926, 1.37629, 1.51917, 1.7806, 1.92291, 2.62309, 2.8024, + 0.140134, 0.21232, 0.443224, 0.967457, 1.26424, 1.56215, 1.92915, 2.21739, 2.66834, 2.83075, + 0.221323, 0.322124, 0.485563, 0.818589, 1.01184, 1.19898, 1.42362, 1.6694, 2.15752, 2.36319, + 0.369687, 0.525655, 0.719213, 0.939654, 1.13763, 1.31222, 1.59994, 1.82681, 2.35522, 2.58068, + 0.211975, 0.314411, 0.489148, 0.739213, 1.3778, 1.5545, 1.82437, 2.15887, 2.35299, 2.72262, + 0.170698, 0.296368, 0.934285, 1.24313, 1.5559, 1.86654, 2.15994, 2.36344, 2.58503, 2.73853, + 0.189263, 0.305887, 0.439912, 0.78461, 1.22726, 1.34251, 1.58765, 1.75491, 2.43989, 2.72131, + 0.296339, 0.385169, 0.612012, 1.08132, 1.27636, 1.43718, 1.87147, 2.00172, 2.33909, 2.64022, + 0.229588, 0.320544, 0.517278, 0.969137, 1.14256, 1.62609, 1.87792, 2.11546, 2.54674, 2.70802, + 0.248869, 0.420193, 0.732388, 1.04902, 1.30341, 1.60146, 1.94921, 2.23946, 2.64822, 2.82261, + 0.2076, 0.29232, 0.496539, 0.857149, 1.18229, 1.39985, 1.71416, 1.86824, 2.02794, 2.20074, + 0.225558, 0.396897, 0.541783, 0.873366, 1.17897, 1.29958, 1.67719, 1.8496, 2.33048, 2.75272, + 0.176821, 0.231377, 0.372767, 0.508565, 1.15282, 1.80805, 2.11268, 2.25007, 2.57134, 2.74855, + 0.352149, 0.515765, 1.02324, 1.26022, 1.44357, 1.62207, 1.8728, 2.10018, 2.48928, 2.67104, + 0.166138, 0.263444, 0.370151, 0.590066, 0.754819, 0.940533, 1.76187, 1.94661, 2.44501, 2.75819, + 0.342082, 0.476411, 0.656223, 0.851774, 1.00399, 1.15337, 1.6944, 2.06562, 2.25564, 2.44015, + 0.227237, 0.376514, 0.514329, 0.894887, 1.14167, 1.28305, 1.83138, 1.9859, 2.33447, 2.78488, + 0.215891, 0.269548, 0.684111, 1.40566, 1.67481, 1.80093, 2.17209, 2.3394, 2.59157, 2.7301, + 0.23624, 0.400377, 0.533684, 0.750343, 0.910405, 1.08911, 1.73773, 1.91281, 2.19252, 2.68873, + 0.169242, 0.284879, 0.916252, 1.16977, 1.43368, 1.64438, 1.91912, 2.16162, 2.48266, 2.68259, + 0.270731, 0.336506, 0.477594, 1.04271, 1.60584, 1.79686, 1.94591, 2.16004, 2.35491, 2.52095, + 0.420586, 0.652563, 1.11716, 1.40601, 1.74754, 1.94742, 2.20309, 2.35997, 2.5479, 2.68217, + 0.281552, 0.395037, 0.640181, 0.944531, 1.19396, 1.33049, 1.71866, 2.18839, 2.44459, 2.57867, + 0.311824, 0.476892, 0.633431, 0.845825, 1.33252, 1.49166, 1.69361, 2.04108, 2.28932, 2.4394, + 0.133945, 0.20079, 0.647237, 0.927687, 1.18888, 1.36966, 1.69956, 1.97278, 2.29526, 2.67818, + 0.204796, 0.278215, 0.443465, 1.27048, 1.40521, 1.64092, 1.82425, 2.32709, 2.59964, 2.77253, + 0.18397, 0.244116, 0.410594, 0.639103, 1.22159, 1.40487, 1.62836, 1.90244, 2.16863, 2.3068, + 0.343622, 0.434735, 0.666599, 0.868069, 1.04894, 1.53278, 1.81983, 1.97188, 2.2887, 2.44875, + 0.238017, 0.320361, 0.657255, 0.917611, 1.30331, 1.72736, 1.98891, 2.18145, 2.44297, 2.61332, + 0.323613, 0.545056, 0.930173, 1.22606, 1.44018, 1.7723, 2.05689, 2.34781, 2.68938, 2.82062, + 0.28893, 0.401387, 0.617124, 0.836453, 0.990306, 1.26123, 1.91328, 2.11005, 2.32458, 2.55716, + 0.33267, 0.480804, 0.656147, 0.880536, 1.02957, 1.23049, 1.76906, 1.9323, 2.20037, 2.58521, + 0.185551, 0.265352, 0.409432, 0.608847, 1.0347, 1.22282, 1.87697, 2.17165, 2.4035, 2.66644, + 0.155026, 0.223348, 0.401684, 1.07914, 1.41579, 1.62002, 2.04552, 2.25851, 2.63162, 2.80229, + 0.183461, 0.263081, 0.425694, 0.635685, 1.18866, 1.35756, 1.57499, 2.08598, 2.28872, 2.51111, + 0.314738, 0.463011, 0.648733, 0.877651, 1.00289, 1.26581, 2.00541, 2.1981, 2.48153, 2.71418, + 0.244411, 0.318444, 0.546578, 0.793615, 1.32615, 1.73548, 1.9456, 2.11466, 2.31535, 2.47853, + 0.326237, 0.54354, 0.987361, 1.30441, 1.68493, 1.90215, 2.20717, 2.37427, 2.55753, 2.71622, + 0.157795, 0.283302, 0.430398, 0.660379, 0.81106, 1.14254, 1.4793, 1.71871, 2.67026, 2.84756, + 0.220856, 0.283872, 0.779935, 1.07494, 1.31221, 1.62633, 1.83761, 1.96888, 2.15599, 2.60238, + 0.140763, 0.205719, 0.406561, 0.762459, 1.04127, 1.48699, 1.83831, 2.11461, 2.55281, 2.77228, + 0.140451, 0.39592, 0.79211, 1.108, 1.40264, 1.62308, 1.94315, 2.22795, 2.54616, 2.774, + 0.229862, 0.336462, 0.54659, 0.81015, 1.20191, 1.34679, 1.82532, 2.09293, 2.28573, 2.47336, + 0.224913, 0.328246, 0.517269, 0.874793, 1.01259, 1.45218, 1.69578, 2.01493, 2.51145, 2.67257, + 0.247745, 0.335741, 0.546558, 0.710177, 1.17056, 1.72779, 1.97068, 2.15853, 2.48282, 2.62891, + 0.398252, 0.555087, 0.890367, 1.1212, 1.38153, 1.60123, 1.86665, 2.06661, 2.40516, 2.58802, + 0.198563, 0.288867, 0.478054, 0.658477, 0.851841, 1.0271, 1.53974, 2.02111, 2.57946, 2.78418, + 0.304271, 0.371642, 0.66159, 1.06898, 1.22425, 1.41193, 1.68052, 1.86977, 2.10007, 2.30855, + 0.188223, 0.257939, 0.432402, 0.73505, 1.31804, 1.48553, 1.82811, 2.04644, 2.30702, 2.45724, + 0.246723, 0.297276, 0.604475, 1.3109, 1.57044, 1.68885, 1.91366, 2.05133, 2.55601, 2.71497, + 0.158309, 0.234509, 0.435792, 0.6679, 0.957567, 1.23592, 1.59294, 1.81816, 2.30739, 2.76897, + 0.419843, 0.501412, 0.766892, 1.07317, 1.18937, 1.48022, 1.7666, 1.92215, 2.53794, 2.69477, + 0.27514, 0.335563, 0.678421, 1.08152, 1.59238, 1.77263, 1.93124, 2.1407, 2.3338, 2.49086, + 0.372056, 0.856814, 1.23954, 1.40999, 1.6903, 1.86302, 2.0727, 2.27355, 2.53266, 2.69052, + 0.321254, 0.422981, 0.604856, 0.793437, 0.912112, 1.12845, 1.79598, 2.17323, 2.36015, 2.53614, + 0.395214, 0.598779, 0.771997, 0.946713, 1.21378, 1.33043, 1.66033, 1.97715, 2.16506, 2.34402, + 0.225286, 0.317828, 0.464801, 1.11233, 1.36951, 1.512, 1.92195, 2.05341, 2.59352, 2.77729, + 0.330612, 0.407807, 0.730129, 1.25973, 1.45981, 1.60567, 1.98131, 2.13701, 2.46597, 2.67972, + 0.213145, 0.305305, 0.507016, 0.662299, 1.05685, 1.47986, 1.6719, 2.10271, 2.36987, 2.58199, + 0.219658, 0.296096, 0.443507, 0.610973, 0.799691, 1.67658, 1.96549, 2.15323, 2.50223, 2.693, + 0.174947, 0.257739, 0.373547, 0.552567, 1.40532, 1.61425, 1.84892, 2.11779, 2.31788, 2.7119, + 0.209667, 0.297529, 0.756195, 1.0953, 1.5642, 1.84477, 2.1037, 2.29266, 2.52005, 2.67949, + 0.170138, 0.24031, 0.452247, 0.684414, 0.880102, 1.36692, 1.74165, 2.13129, 2.50573, 2.73261, + 0.278164, 0.468635, 0.707518, 0.853693, 1.05478, 1.21046, 1.54094, 2.17456, 2.41066, 2.61214, + 0.155738, 0.23889, 0.352836, 0.621012, 1.44144, 1.6197, 1.82517, 1.97533, 2.52537, 2.74857, + 0.223776, 0.274424, 0.479048, 0.797871, 1.69419, 1.87813, 2.13528, 2.37373, 2.59542, 2.72979, + 0.151088, 0.198286, 0.326558, 0.536276, 0.845893, 1.14165, 1.46056, 1.76287, 2.02585, 2.1773, + 0.434445, 0.614208, 0.887657, 1.02845, 1.19136, 1.3922, 1.78689, 2.06248, 2.4234, 2.61936, + 0.180755, 0.275311, 0.397787, 0.859366, 1.40976, 1.52332, 1.90885, 2.08232, 2.38972, 2.74389, + 0.275975, 0.508416, 0.889894, 1.31893, 1.63331, 1.90473, 2.16901, 2.37466, 2.72697, 2.84767, + 0.156239, 0.262624, 0.406657, 0.739074, 1.04449, 1.20123, 1.81089, 2.0056, 2.5817, 2.80489, + 0.195391, 0.258771, 0.654924, 0.824371, 1.31526, 1.50073, 1.76594, 2.06399, 2.34118, 2.51366, + 0.178034, 0.301047, 0.46302, 0.716172, 1.19887, 1.34045, 1.83456, 2.02213, 2.40075, 2.77629, + 0.340368, 0.404236, 0.843747, 1.03924, 1.20211, 1.70805, 1.91495, 2.16951, 2.52152, 2.62335, + 0.218465, 0.289694, 0.528045, 0.817051, 1.13234, 1.58046, 1.83889, 1.98339, 2.14749, 2.34813, + 0.322509, 0.458058, 0.654679, 0.958976, 1.11821, 1.32157, 1.90139, 2.04641, 2.36093, 2.66422, + 0.191821, 0.252321, 0.389176, 0.581111, 1.52967, 1.93169, 2.08361, 2.27046, 2.56685, 2.71388, + 0.493961, 0.710827, 0.98226, 1.19627, 1.41933, 1.62091, 1.92801, 2.14565, 2.42977, 2.60197, + 0.213148, 0.311589, 0.424636, 0.602664, 0.736895, 1.02216, 1.99228, 2.21853, 2.61163, 2.85032, + 0.288129, 0.434441, 0.629313, 0.856153, 1.28967, 1.42452, 1.8758, 2.15024, 2.35181, 2.53684, + 0.160031, 0.230716, 0.406654, 0.870424, 1.15652, 1.39232, 1.8041, 1.95144, 2.21048, 2.73516, + 0.22934, 0.293962, 0.503222, 1.2421, 1.47582, 1.62465, 1.99868, 2.1445, 2.57855, 2.75327, + 0.15877, 0.220035, 0.363386, 0.577761, 0.96309, 1.17494, 1.73817, 1.9792, 2.16244, 2.66192, + 0.346062, 0.444816, 0.716985, 1.18072, 1.37058, 1.523, 1.89217, 2.06668, 2.3958, 2.62766, + 0.307495, 0.38933, 0.612607, 0.969283, 1.55771, 1.83994, 1.99674, 2.17238, 2.42063, 2.5392, + 0.437804, 0.726957, 1.29117, 1.5033, 1.76543, 1.96212, 2.16365, 2.33623, 2.57962, 2.70852, + 0.232184, 0.333678, 0.528368, 0.706749, 1.20328, 1.37902, 1.61116, 2.15468, 2.5929, 2.75032, + 0.272652, 0.46171, 0.625777, 0.839609, 1.34202, 1.49673, 1.71538, 2.13757, 2.37004, 2.59739, + 0.184908, 0.302324, 0.454883, 0.880307, 1.10438, 1.29253, 1.7772, 1.94336, 2.44417, 2.62273, + 0.265644, 0.341261, 0.553228, 1.13947, 1.42715, 1.56044, 1.93394, 2.08413, 2.39331, 2.65413, + 0.16792, 0.207301, 0.370331, 0.525538, 1.03089, 1.36816, 1.78247, 2.0624, 2.33276, 2.5263, + 0.343172, 0.433912, 0.717501, 0.889734, 1.05206, 1.69528, 2.05316, 2.20846, 2.60887, 2.71832, + 0.216527, 0.305247, 0.44589, 0.729271, 1.63974, 1.90328, 2.05335, 2.22125, 2.43225, 2.56802, + 0.110545, 0.209955, 0.844788, 1.1742, 1.4922, 1.81024, 2.17727, 2.4405, 2.69729, 2.83523, + 0.217384, 0.337412, 0.488999, 0.761842, 0.879715, 1.20953, 1.97075, 2.1208, 2.61165, 2.79176, + 0.190459, 0.296484, 0.469967, 0.800649, 1.10556, 1.27853, 1.51694, 1.69307, 2.11442, 2.71674, + 0.134814, 0.175978, 0.300425, 0.496817, 1.2443, 1.48531, 1.86172, 2.13123, 2.48505, 2.77388, + 0.210174, 0.278266, 0.435508, 0.927538, 1.60691, 1.7539, 1.95755, 2.16628, 2.39852, 2.74961, + 0.213766, 0.3153, 0.509924, 0.70993, 0.964724, 1.10678, 1.38261, 2.00107, 2.32321, 2.56531, + 0.400615, 0.524954, 0.798552, 1.01285, 1.13549, 1.47485, 1.98903, 2.13091, 2.50797, 2.67946, + 0.2494, 0.377023, 0.519635, 0.754227, 1.45956, 1.64276, 1.82896, 2.07788, 2.29823, 2.46753, + 0.473365, 0.683973, 1.05234, 1.37583, 1.54811, 1.74759, 2.1393, 2.31877, 2.60998, 2.73925, + 0.203877, 0.341791, 0.48518, 0.884069, 1.09759, 1.26953, 1.47992, 1.75788, 2.6484, 2.82239, + 0.273046, 0.404254, 0.555403, 0.954547, 1.29123, 1.39902, 1.72289, 1.90344, 2.17198, 2.64531, + 0.040369, 0.117266, 0.617136, 0.892043, 1.26033, 1.54165, 1.85938, 2.1531, 2.49823, 2.76189, + 0.132414, 0.211358, 0.742445, 1.06686, 1.33108, 1.57079, 1.86746, 2.13253, 2.47962, 2.73108, + 0.237329, 0.326529, 0.612538, 0.790663, 0.990133, 1.41374, 1.73823, 1.93691, 2.16773, 2.45163, + 0.27396, 0.405794, 0.57253, 0.933672, 1.05782, 1.39795, 1.85653, 1.99755, 2.59949, 2.76004, + 0.199334, 0.29838, 0.442931, 0.628638, 1.30321, 1.64014, 1.80402, 2.11302, 2.37545, 2.54895, + 0.350188, 0.50201, 0.821298, 1.03864, 1.36929, 1.5924, 1.91082, 2.15649, 2.46051, 2.65326, + 0.281558, 0.399892, 0.573105, 0.753299, 0.900613, 1.05457, 1.58199, 2.17844, 2.43035, 2.61604, + 0.344653, 0.543532, 0.703715, 0.862285, 1.19822, 1.33821, 1.57908, 2.06077, 2.30675, 2.48575, + 0.220701, 0.326795, 0.520618, 0.755133, 1.29555, 1.45189, 1.6905, 2.20005, 2.41427, 2.61591, + 0.279478, 0.332193, 0.801527, 1.34597, 1.48748, 1.6785, 1.9222, 2.10002, 2.58557, 2.71339, + 0.163502, 0.212169, 0.365096, 0.525464, 0.869846, 1.20881, 1.79399, 2.04031, 2.29718, 2.4698, + 0.285531, 0.341488, 0.754059, 1.17002, 1.30084, 1.5137, 1.69986, 1.88992, 2.58146, 2.70687, + 0.249595, 0.366997, 0.626427, 0.945219, 1.40704, 1.56056, 1.83166, 2.23115, 2.46635, 2.65452, + 0.271671, 0.443136, 1.15641, 1.40646, 1.67652, 1.85648, 2.06322, 2.2305, 2.47584, 2.63958, + 0.28662, 0.427806, 0.63732, 0.803409, 0.996161, 1.26638, 1.68175, 2.00397, 2.39465, 2.58855, + 0.314906, 0.440519, 0.612129, 0.896126, 1.47241, 1.71769, 1.88135, 2.09944, 2.36917, 2.49547, + 0.170277, 0.25127, 0.405477, 0.915641, 1.12689, 1.43663, 1.71477, 1.8932, 2.55299, 2.73852, + 0.27941, 0.337137, 0.734563, 1.28105, 1.4806, 1.61188, 1.85321, 1.99488, 2.41605, 2.65483, + 0.165776, 0.226083, 0.417544, 0.744574, 1.04447, 1.53489, 1.80849, 1.94495, 2.13849, 2.60179, + 0.264579, 0.336652, 0.542033, 0.71019, 0.913338, 1.65575, 1.81776, 2.23196, 2.52444, 2.65852, + 0.158194, 0.235588, 0.338347, 0.541657, 1.58338, 1.76629, 2.00914, 2.24334, 2.50394, 2.77516, + 0.332612, 0.50962, 0.822935, 1.07588, 1.45429, 1.65079, 1.97445, 2.25128, 2.53734, 2.74512, + 0.262817, 0.359709, 0.520893, 0.707667, 0.818364, 1.43885, 1.97125, 2.08767, 2.49701, 2.64644, + 0.2332, 0.399599, 0.612456, 0.775547, 1.19919, 1.35576, 1.6469, 2.13625, 2.34249, 2.69574, + 0.149687, 0.238538, 0.372248, 0.63452, 1.25581, 1.43379, 1.77004, 1.92875, 2.61191, 2.82493, + 0.137016, 0.210297, 0.591489, 1.12545, 1.37565, 1.6853, 2.08961, 2.39089, 2.70446, 2.84443, + 0.21349, 0.341024, 0.541716, 0.750061, 1.0882, 1.24458, 1.55534, 1.96557, 2.1879, 2.38371, + 0.300159, 0.489291, 0.825022, 1.0371, 1.19409, 1.34738, 1.68475, 2.02494, 2.46561, 2.74097, + 0.170029, 0.255033, 0.392758, 0.727117, 1.38207, 1.57968, 1.80091, 1.95907, 2.28234, 2.7288, + 0.175883, 0.365509, 1.11217, 1.38587, 1.72039, 1.97781, 2.2453, 2.42161, 2.62957, 2.754, + 0.16259, 0.248164, 0.45463, 0.763209, 0.966031, 1.28234, 1.73074, 1.93805, 2.47938, 2.66756, + 0.258043, 0.345866, 0.55652, 0.981312, 1.36153, 1.48238, 1.87224, 2.15823, 2.36227, 2.55503, + 0.234139, 0.348843, 0.528234, 0.987884, 1.19522, 1.42215, 1.96003, 2.12737, 2.60332, 2.793, + 0.179699, 0.559209, 0.867682, 1.08884, 1.31689, 1.5715, 1.9222, 2.19739, 2.50112, 2.72868, + 0.216784, 0.310791, 0.487492, 0.932903, 1.20195, 1.36655, 1.8004, 1.9775, 2.17426, 2.53707, + 0.186878, 0.400655, 0.580952, 0.846287, 1.10387, 1.26678, 1.84277, 2.01959, 2.488, 2.71722, + 0.164641, 0.248712, 0.389358, 0.772822, 1.21256, 1.36992, 2.02587, 2.27762, 2.61752, 2.80953, + 0.351899, 0.520326, 0.926597, 1.21965, 1.50984, 1.67684, 1.92174, 2.11125, 2.35638, 2.54593, + 0.242182, 0.365285, 0.506156, 0.71602, 0.865221, 1.01169, 1.78692, 2.12298, 2.35088, 2.76773, + 0.413776, 0.559566, 0.7358, 0.928997, 1.07912, 1.26718, 1.88007, 2.15249, 2.32483, 2.53986, + 0.210597, 0.329568, 0.469735, 0.78859, 1.21549, 1.31981, 1.71146, 2.05899, 2.24544, 2.65373, + 0.197937, 0.254148, 0.477985, 1.22709, 1.62992, 1.76743, 2.18698, 2.3851, 2.59487, 2.72554, + 0.205489, 0.333855, 0.523915, 0.706275, 1.10215, 1.24661, 1.6489, 2.02683, 2.28169, 2.75931, + 0.230328, 0.322431, 0.861834, 1.14561, 1.34721, 1.57611, 1.80728, 2.00482, 2.35437, 2.57225, + 0.224898, 0.282022, 0.506636, 1.1523, 1.62656, 1.75209, 2.02818, 2.21882, 2.48896, 2.67046, + 0.313732, 0.625469, 1.16447, 1.49908, 1.74961, 2.01853, 2.26223, 2.4296, 2.69216, 2.8225, + 0.375623, 0.575307, 0.7912, 0.93577, 1.09694, 1.34339, 1.80799, 2.18731, 2.51972, 2.6948, + 0.236981, 0.332412, 0.47927, 0.844461, 1.34764, 1.49073, 1.68394, 2.03914, 2.29762, 2.45843, + 0.129047, 0.20625, 0.636751, 0.865101, 1.13689, 1.35661, 1.7048, 1.91668, 2.51836, 2.75632, + 0.195171, 0.266517, 0.414793, 1.23956, 1.45291, 1.60836, 1.83305, 2.0478, 2.47352, 2.62199, + 0.165853, 0.21272, 0.372757, 0.536136, 1.01394, 1.33963, 1.55512, 1.94574, 2.23628, 2.44095, + 0.256981, 0.368868, 0.635878, 0.802543, 1.08476, 1.43912, 1.81473, 2.12052, 2.45815, 2.62146, + 0.214382, 0.297135, 0.445091, 0.70205, 1.3651, 1.85126, 2.06703, 2.2073, 2.47073, 2.61243, + 0.34071, 0.532103, 0.935278, 1.17102, 1.37789, 1.6386, 1.96527, 2.24616, 2.63127, 2.80634, + 0.310524, 0.412051, 0.582478, 0.768755, 0.871594, 1.11985, 1.92635, 2.20751, 2.40709, 2.63663, + 0.249349, 0.443517, 0.631532, 0.810096, 1.20513, 1.35721, 1.6074, 1.98416, 2.20802, 2.64511, + 0.14309, 0.185312, 0.325214, 0.504, 1.13447, 1.32791, 1.67365, 2.0069, 2.38928, 2.74609, + 0.226575, 0.298946, 0.453938, 0.998061, 1.3946, 1.59728, 2.06418, 2.22325, 2.42547, 2.56946, + 0.183924, 0.255181, 0.415834, 0.624247, 1.04234, 1.20308, 1.55524, 2.12531, 2.40035, 2.66192, + 0.27561, 0.365968, 0.654909, 0.990108, 1.1708, 1.45533, 2.07756, 2.25267, 2.50232, 2.68595, + 0.204334, 0.287844, 0.39481, 0.761295, 1.5012, 1.78471, 1.93557, 2.15283, 2.34926, 2.54564, + 0.342976, 0.527539, 0.917466, 1.16059, 1.49953, 1.76183, 2.09527, 2.30187, 2.54057, 2.69469, + 0.202374, 0.333367, 0.480179, 0.708677, 0.819505, 1.10529, 1.80664, 1.95335, 2.61084, 2.7975, + 0.307033, 0.368471, 0.602486, 1.10861, 1.41335, 1.52864, 1.79852, 1.98614, 2.16905, 2.43726, + 0.144073, 0.196932, 0.386988, 0.819061, 1.28977, 1.62507, 1.90192, 2.13611, 2.48302, 2.70797, + 0.17676, 0.268627, 0.662082, 1.05687, 1.54797, 1.71139, 1.97294, 2.24991, 2.54447, 2.76109, + 0.191409, 0.292985, 0.492193, 0.800526, 1.04184, 1.27855, 1.83663, 2.02868, 2.24939, 2.62778, + 0.324102, 0.399146, 0.687435, 0.868704, 1.02296, 1.58208, 1.85385, 1.98188, 2.55491, 2.67706, + 0.229172, 0.302836, 0.481418, 0.704363, 0.967567, 1.82827, 2.0973, 2.25847, 2.54911, 2.70465, + 0.467124, 0.696788, 0.9395, 1.09499, 1.27754, 1.4885, 1.89628, 2.15847, 2.47418, 2.65999, + 0.175418, 0.234039, 0.367674, 0.513586, 0.747619, 1.0084, 1.58316, 2.05311, 2.36329, 2.68115, + 0.410273, 0.561949, 0.736215, 0.956685, 1.13569, 1.28842, 1.75061, 1.93771, 2.15132, 2.48934, + 0.204541, 0.277613, 0.529607, 0.722971, 1.19998, 1.44734, 1.71563, 1.92105, 2.35778, 2.50749, + 0.253116, 0.311907, 0.696982, 1.32008, 1.57542, 1.70532, 2.00507, 2.16867, 2.46188, 2.66505, + 0.163657, 0.237902, 0.393374, 0.60949, 0.854272, 1.08998, 1.52639, 1.84234, 2.12625, 2.67905, + 0.448627, 0.530664, 0.812719, 1.0952, 1.20764, 1.57541, 1.88421, 2.0343, 2.55301, 2.68835, + 0.262717, 0.338748, 0.512685, 1.00354, 1.48018, 1.62208, 1.82852, 2.14242, 2.35646, 2.51153, + 0.417111, 0.636688, 1.03657, 1.31988, 1.67992, 1.87339, 2.07372, 2.2494, 2.50773, 2.65105, + 0.263698, 0.461151, 0.618737, 0.830471, 1.00404, 1.15887, 1.80157, 2.02022, 2.30656, 2.74304, + 0.387779, 0.575108, 0.729791, 0.932981, 1.36116, 1.50516, 1.75118, 2.06847, 2.33826, 2.48764, + 0.18151, 0.265666, 0.454631, 1.08238, 1.2873, 1.5792, 1.85118, 2.09696, 2.46724, 2.64693, + 0.277668, 0.345119, 0.602341, 1.1792, 1.37899, 1.54562, 1.81386, 1.96259, 2.4918, 2.66445, + 0.17932, 0.24808, 0.456925, 0.722589, 1.12693, 1.57945, 1.7994, 1.95067, 2.48412, 2.70724, + 0.314322, 0.381145, 0.608651, 0.727613, 0.890472, 1.61028, 2.13617, 2.25836, 2.59638, 2.70978, + 0.189539, 0.266068, 0.419729, 0.651693, 1.41016, 1.64311, 1.85481, 2.27558, 2.49205, 2.72201, + 0.254466, 0.313038, 0.594149, 1.01254, 1.68881, 1.93546, 2.11918, 2.28787, 2.53554, 2.66793, + 0.134691, 0.171906, 0.30274, 0.492936, 0.899551, 1.22919, 1.73394, 2.01288, 2.44634, 2.74276, + 0.231556, 0.365068, 0.680761, 0.889142, 1.11134, 1.2959, 1.54264, 1.97178, 2.42756, 2.63191, + 0.222525, 0.305606, 0.527193, 0.687519, 1.18138, 1.67176, 1.86368, 2.07202, 2.63452, 2.77927, + 0.17877, 0.237415, 0.37516, 0.856692, 1.67368, 1.81374, 2.01679, 2.27242, 2.5226, 2.73596, + 0.193532, 0.268731, 0.451328, 0.753471, 0.984854, 1.28535, 1.68565, 1.88412, 2.09168, 2.24342, + 0.476037, 0.65161, 0.801054, 1.01016, 1.24137, 1.35584, 1.77598, 2.08615, 2.27291, 2.45435, + 0.211657, 0.308331, 0.421366, 0.865966, 1.41877, 1.55674, 1.78615, 2.02033, 2.19859, 2.63198, + 0.203789, 0.490794, 1.01014, 1.27501, 1.47221, 1.81014, 2.17064, 2.43766, 2.66212, 2.78806, + 0.174355, 0.252095, 0.674715, 0.842194, 1.05509, 1.278, 1.69868, 2.07056, 2.39938, 2.65743, + 0.245109, 0.324049, 0.628822, 0.92791, 1.1236, 1.58007, 1.87864, 2.0546, 2.35872, 2.54684, + 0.182644, 0.253804, 0.386248, 0.614056, 1.36482, 1.54588, 2.04017, 2.21883, 2.41901, 2.62461, + 0.295605, 0.367794, 0.690701, 1.05516, 1.1866, 1.64445, 1.94415, 2.10144, 2.56212, 2.69127, + 0.220878, 0.289573, 0.640307, 0.822072, 1.14406, 1.5678, 1.76641, 1.90811, 2.10346, 2.56049, + 0.403453, 0.526298, 0.732204, 0.90115, 1.03587, 1.33938, 1.78399, 1.94196, 2.37103, 2.62665, + 0.212825, 0.25857, 0.471588, 0.685549, 1.26374, 1.82105, 2.16382, 2.2884, 2.62806, 2.78816, + 0.401181, 0.642053, 1.03247, 1.23611, 1.44445, 1.68668, 2.00672, 2.22851, 2.57211, 2.72396, + 0.239433, 0.341091, 0.492629, 0.70763, 0.881426, 1.03082, 1.71925, 2.34406, 2.57906, 2.75694, + 0.294093, 0.38277, 0.577412, 1.00928, 1.31304, 1.4193, 1.74467, 2.09423, 2.28904, 2.47584, + 0.169805, 0.236922, 0.403314, 0.638995, 1.17645, 1.35214, 1.66557, 1.90976, 2.15012, 2.71624, + 0.210447, 0.277913, 0.452474, 1.40269, 1.51343, 1.72094, 1.90394, 2.2785, 2.58376, 2.74318, + 0.159574, 0.225382, 0.374008, 0.714137, 1.01125, 1.37171, 1.69916, 1.87159, 2.02706, 2.49119, + 0.258602, 0.557253, 0.81972, 1.03886, 1.30147, 1.44536, 1.83061, 2.09817, 2.32081, 2.54107, + 0.232756, 0.282242, 0.631974, 0.898694, 1.53744, 1.86922, 2.06397, 2.23446, 2.49823, 2.63352, + 0.580133, 0.997946, 1.32096, 1.48187, 1.73161, 1.89858, 2.12071, 2.29013, 2.53009, 2.65166, + 0.21184, 0.307093, 0.45336, 0.945579, 1.25082, 1.49029, 1.72414, 2.2811, 2.5627, 2.7526, + 0.314276, 0.493555, 0.667782, 0.8965, 1.32301, 1.48262, 1.66749, 1.97441, 2.42735, 2.55568, + 0.182455, 0.261592, 0.418011, 1.05093, 1.26139, 1.44337, 1.66547, 1.93903, 2.44469, 2.63845, + 0.24157, 0.306934, 0.491293, 1.10595, 1.55483, 1.66652, 1.92392, 2.08765, 2.3676, 2.65489, + 0.190084, 0.25485, 0.454062, 0.724519, 1.08336, 1.39389, 1.89234, 2.08886, 2.32176, 2.4843, + 0.306497, 0.389831, 0.721793, 0.839714, 1.12475, 1.6524, 1.82292, 2.27331, 2.5692, 2.6696, + 0.1862, 0.27346, 0.383201, 0.564758, 1.51107, 1.84502, 1.99828, 2.1941, 2.38869, 2.58792, + 0.300722, 0.478218, 0.823364, 1.12749, 1.59114, 1.87135, 2.17472, 2.40318, 2.62478, 2.7824, + 0.228884, 0.358342, 0.504622, 0.795874, 1.00562, 1.15261, 1.90805, 2.12479, 2.37247, 2.79758, + 0.171885, 0.248234, 0.432842, 0.833143, 1.04089, 1.26929, 1.66164, 1.91863, 2.15896, 2.6534, + 0.140943, 0.193684, 0.343025, 0.562303, 1.06955, 1.54333, 1.82447, 1.96164, 2.46351, 2.77054, + 0.173053, 0.245656, 0.360656, 0.960618, 1.58953, 1.68991, 1.98414, 2.143, 2.58839, 2.7594, + 0.24018, 0.429951, 0.63744, 0.786596, 1.06915, 1.22657, 1.47088, 1.95205, 2.19506, 2.61597, + 0.367862, 0.471897, 0.730834, 1.08232, 1.22629, 1.46293, 1.92817, 2.05247, 2.40674, 2.66246, + 0.247175, 0.358209, 0.535946, 0.781876, 1.3637, 1.63524, 1.80723, 1.99378, 2.45277, 2.60104, + 0.445578, 0.687898, 1.11411, 1.30103, 1.5774, 1.88604, 2.2249, 2.43653, 2.65969, 2.76103, + 0.214389, 0.336025, 0.487794, 0.759534, 0.970518, 1.1411, 1.45733, 1.62464, 2.30692, 2.71527, + 0.3773, 0.466775, 0.716121, 1.08378, 1.25654, 1.41124, 1.78943, 1.93637, 2.20557, 2.56236, + 0.148362, 0.214593, 0.545023, 0.840437, 1.19333, 1.48066, 1.79187, 2.08342, 2.41054, 2.67613, + 0.150403, 0.278398, 0.792676, 0.97668, 1.21885, 1.40524, 1.77506, 2.16246, 2.54786, 2.74638, + 0.236301, 0.328633, 0.630867, 0.839915, 1.04235, 1.29887, 1.62775, 1.83949, 2.29893, 2.49396, + 0.337889, 0.49792, 0.711277, 0.85042, 0.992027, 1.24688, 1.71075, 2.08668, 2.52716, 2.70716, + 0.172215, 0.23654, 0.372897, 0.525146, 1.18258, 1.73573, 1.92703, 2.11462, 2.31917, 2.54278, + 0.415304, 0.624807, 0.906616, 1.11784, 1.44615, 1.66942, 1.94841, 2.17282, 2.50453, 2.67075, + 0.265417, 0.407241, 0.613894, 0.816534, 0.980063, 1.15606, 1.75675, 2.27485, 2.49719, 2.71224, + 0.27644, 0.468209, 0.649518, 0.816686, 1.19517, 1.35552, 1.54923, 1.93527, 2.21787, 2.42698, + 0.188925, 0.277012, 0.412665, 0.672627, 1.35481, 1.51452, 1.69999, 2.14455, 2.38219, 2.58608, + 0.24263, 0.352485, 0.912974, 1.34378, 1.60443, 1.80187, 2.01479, 2.19307, 2.46081, 2.632, + 0.190903, 0.285841, 0.44907, 0.760328, 0.954285, 1.18294, 1.69264, 1.87816, 2.27684, 2.46596, + 0.220659, 0.300374, 0.721694, 0.947306, 1.29833, 1.56298, 1.76062, 1.88825, 2.50644, 2.68968, + 0.213168, 0.290928, 0.695227, 0.918179, 1.37819, 1.63199, 1.84789, 2.00307, 2.35836, 2.61935, + 0.328586, 0.517244, 0.93732, 1.37624, 1.57484, 1.76435, 2.05863, 2.22433, 2.58444, 2.75665, + 0.248486, 0.367007, 0.562147, 0.750632, 0.902785, 1.14756, 1.63742, 1.91206, 2.41399, 2.6057, + 0.310691, 0.477895, 0.670796, 0.940507, 1.41829, 1.5635, 1.80514, 2.11408, 2.37636, 2.53516, + 0.256555, 0.41421, 0.559427, 0.981289, 1.19165, 1.37831, 1.6784, 1.84931, 2.5767, 2.75663, + 0.291424, 0.335003, 0.750149, 1.28965, 1.43721, 1.59999, 1.80318, 1.96741, 2.60175, 2.73376, + 0.195254, 0.279513, 0.451755, 0.649111, 0.828694, 1.60951, 1.91491, 2.09122, 2.31959, 2.5349, + 0.222304, 0.332624, 0.475678, 0.685205, 1.03033, 1.73722, 1.92098, 2.37829, 2.70672, 2.81773, + 0.164833, 0.240093, 0.359862, 0.801929, 1.51368, 1.64171, 2.04052, 2.24884, 2.48866, 2.71403, + 0.214777, 0.287322, 0.572644, 1.14507, 1.36711, 1.75269, 2.04242, 2.22207, 2.54305, 2.69789, + 0.226099, 0.330382, 0.474439, 0.687757, 0.799187, 1.31984, 1.94457, 2.0781, 2.3678, 2.50846, + 0.24454, 0.392163, 0.553692, 0.729765, 1.24786, 1.44838, 1.61759, 2.07464, 2.34005, 2.51806, + 0.175381, 0.314231, 0.446023, 0.797404, 1.32846, 1.43973, 1.79335, 1.93957, 2.4688, 2.72165, + 0.205808, 0.29367, 0.452447, 1.07427, 1.28823, 1.65563, 1.8575, 2.36469, 2.63981, 2.79814, + 0.253926, 0.392653, 0.587584, 0.800134, 0.97631, 1.18559, 1.57069, 1.82141, 2.09089, 2.34902, + 0.322461, 0.410912, 0.723569, 1.06064, 1.20152, 1.40036, 1.57919, 1.78876, 2.46024, 2.6166, + 0.211266, 0.304981, 0.436011, 0.771978, 1.49062, 1.67775, 1.88623, 2.1135, 2.32635, 2.72726, + 0.235012, 0.406911, 0.864785, 1.29148, 1.70829, 1.93855, 2.1799, 2.3524, 2.56379, 2.71145, + 0.176814, 0.26862, 0.445837, 0.823113, 1.02978, 1.27157, 1.62339, 1.81122, 2.40214, 2.61417, + 0.241865, 0.339268, 0.507509, 1.00368, 1.20435, 1.37256, 1.94079, 2.10137, 2.38561, 2.66998, + 0.230878, 0.334743, 0.50037, 0.879929, 1.02189, 1.53377, 1.97079, 2.12897, 2.56726, 2.71729, + 0.297505, 0.451574, 0.748848, 0.988527, 1.36624, 1.60667, 1.89466, 2.17448, 2.52143, 2.75917, + 0.199265, 0.271145, 0.49816, 0.854679, 1.1721, 1.36415, 1.76208, 1.96909, 2.17354, 2.31163, + 0.222173, 0.424864, 0.564942, 0.829809, 1.03817, 1.19405, 1.7206, 1.85809, 2.43176, 2.74146, + 0.181961, 0.226819, 0.390513, 0.556339, 1.0566, 1.55306, 2.12835, 2.25802, 2.6025, 2.80212, + 0.3576, 0.565047, 1.15301, 1.35031, 1.53358, 1.71854, 1.95789, 2.17535, 2.50565, 2.67849, + 0.162257, 0.236808, 0.374039, 0.570569, 0.748034, 1.17226, 1.82339, 2.05303, 2.51377, 2.77207, + 0.305794, 0.46587, 0.645121, 0.88265, 1.14129, 1.26686, 1.70158, 2.00288, 2.18412, 2.41125, + 0.231652, 0.380738, 0.549642, 0.83741, 1.22527, 1.33297, 1.85158, 2.11937, 2.31508, 2.73211, + 0.235449, 0.286771, 0.684809, 1.34666, 1.52663, 1.70348, 2.10149, 2.25455, 2.57718, 2.71899, + 0.23387, 0.446515, 0.60508, 0.814654, 1.05496, 1.1788, 1.63316, 1.84974, 2.13938, 2.73277, + 0.271706, 0.335152, 0.857227, 1.25374, 1.38719, 1.70217, 1.89677, 2.19111, 2.48, 2.60136, + 0.237386, 0.314549, 0.438339, 0.912164, 1.57776, 1.87779, 2.03279, 2.19704, 2.41232, 2.53648, + 0.361168, 0.574093, 1.02384, 1.46852, 1.69056, 1.91737, 2.18737, 2.33403, 2.6691, 2.80629, + 0.27848, 0.398742, 0.573342, 0.839212, 1.07389, 1.22209, 1.69168, 2.16526, 2.37741, 2.53688, + 0.286018, 0.447947, 0.61506, 0.849446, 1.31947, 1.46358, 1.76995, 2.00103, 2.18943, 2.45038, + 0.21944, 0.301601, 0.668534, 0.861094, 1.21, 1.49867, 1.74512, 1.87777, 2.31438, 2.6196, + 0.223591, 0.352153, 0.598841, 1.21789, 1.35908, 1.59174, 1.77109, 2.21386, 2.56154, 2.73542, + 0.176857, 0.236601, 0.395107, 0.634632, 1.13349, 1.33512, 1.77037, 1.98131, 2.20656, 2.33972, + 0.334735, 0.402265, 0.659168, 0.781639, 0.975228, 1.665, 1.87207, 2.04753, 2.47696, 2.57398, + 0.215968, 0.284755, 0.524241, 0.78146, 1.33481, 1.77238, 1.95388, 2.19421, 2.57825, 2.74194, + 0.298193, 0.489879, 0.812985, 1.18369, 1.49642, 1.67998, 2.10879, 2.31656, 2.67378, 2.85161, + 0.312989, 0.415446, 0.618011, 0.899096, 1.08368, 1.26338, 1.8874, 2.24306, 2.41945, 2.57048, + 0.244471, 0.431115, 0.601512, 0.813139, 1.10216, 1.22106, 1.69244, 2.03316, 2.2218, 2.61984, + 0.150949, 0.21906, 0.349217, 0.611327, 1.07711, 1.25055, 1.91552, 2.08398, 2.45, 2.79254, + 0.161611, 0.218964, 0.445377, 0.927863, 1.45115, 1.76846, 2.13001, 2.36672, 2.666, 2.81405, + 0.196, 0.297256, 0.497266, 0.6919, 1.08988, 1.27368, 1.51372, 2.00647, 2.27378, 2.57222, + 0.335268, 0.460795, 0.685187, 0.867664, 1.01381, 1.47955, 2.01199, 2.16848, 2.57264, 2.71756, + 0.257604, 0.340872, 0.499757, 0.843052, 1.39655, 1.83169, 2.03423, 2.17033, 2.42262, 2.5405, + 0.417663, 0.631718, 0.955424, 1.19732, 1.6598, 1.87988, 2.1688, 2.35905, 2.57809, 2.69825, + 0.162052, 0.251583, 0.4399, 0.660911, 0.903902, 1.3203, 1.62476, 1.77858, 2.53053, 2.79971, + 0.256861, 0.322803, 0.68537, 1.08644, 1.26328, 1.56988, 1.85165, 2.01495, 2.26471, 2.44701, + 0.125192, 0.176171, 0.336135, 0.7816, 1.20022, 1.43997, 1.80542, 2.07752, 2.46247, 2.73819, + 0.102286, 0.191322, 0.774556, 1.07615, 1.36946, 1.62715, 1.97301, 2.236, 2.60937, 2.81298, + 0.173442, 0.232622, 0.491622, 0.844157, 1.09524, 1.3708, 1.69697, 2.05141, 2.31606, 2.50205, + 0.257531, 0.343598, 0.654071, 0.838985, 1.0481, 1.48747, 1.72538, 1.89742, 2.43051, 2.586, + 0.1979, 0.276312, 0.440283, 0.705103, 1.26734, 1.7403, 1.93448, 2.15401, 2.4002, 2.62414, + 0.40959, 0.596785, 0.983751, 1.18177, 1.37115, 1.50238, 1.75828, 2.01857, 2.38005, 2.59215, + 0.231819, 0.33289, 0.483514, 0.644585, 0.816808, 0.926308, 1.4033, 2.23301, 2.46786, 2.67846, + 0.25861, 0.340064, 0.670485, 0.908467, 1.10761, 1.45624, 1.75958, 1.93218, 2.11312, 2.31013, + 0.184377, 0.249203, 0.410806, 0.587907, 1.3025, 1.51032, 1.72443, 1.98189, 2.2829, 2.42213, + 0.25411, 0.313328, 0.659859, 1.26582, 1.41295, 1.66593, 1.92715, 2.10198, 2.55145, 2.67303, + 0.161592, 0.23748, 0.376535, 0.637094, 0.823028, 1.13761, 1.69642, 1.87577, 2.40363, 2.63962, + 0.384501, 0.466812, 0.740791, 0.938093, 1.06235, 1.50928, 1.74914, 1.9178, 2.54816, 2.67151, + 0.333872, 0.419367, 0.638994, 1.09262, 1.52055, 1.64945, 1.86662, 2.14894, 2.34672, 2.50614, + 0.426216, 0.686997, 1.23588, 1.42885, 1.61159, 1.79286, 2.01759, 2.23372, 2.54777, 2.69661, + 0.262949, 0.367509, 0.530429, 0.741867, 0.872474, 1.0696, 1.74557, 2.06119, 2.28384, 2.49418, + 0.335782, 0.547236, 0.716211, 0.919077, 1.27569, 1.40844, 1.68512, 1.96739, 2.21764, 2.44668, + 0.227629, 0.330991, 0.486068, 1.11757, 1.30498, 1.51013, 1.75726, 1.94697, 2.62556, 2.7826, + 0.35985, 0.436633, 0.750634, 1.20151, 1.33757, 1.59484, 1.97027, 2.11384, 2.57381, 2.72996, + 0.211871, 0.304028, 0.512758, 0.663762, 1.08635, 1.63333, 1.81802, 2.12958, 2.39108, 2.60077, + 0.196092, 0.279726, 0.434488, 0.624802, 0.772358, 1.40438, 1.94878, 2.16092, 2.63, 2.77518, + 0.176304, 0.262521, 0.373719, 0.581101, 1.52011, 1.73617, 1.93323, 2.14017, 2.35813, 2.75352, + 0.254932, 0.381411, 0.806187, 1.10229, 1.53452, 1.75028, 1.9709, 2.15987, 2.45592, 2.65841, + 0.190385, 0.288656, 0.449066, 0.678174, 0.812376, 1.44933, 1.72866, 1.96632, 2.63881, 2.78955, + 0.251178, 0.386509, 0.609363, 0.797102, 1.02416, 1.18173, 1.45466, 2.01263, 2.49309, 2.69893, + 0.166654, 0.266226, 0.385171, 0.71199, 1.3979, 1.53235, 1.91597, 2.088, 2.56527, 2.78953, + 0.238453, 0.306036, 0.449309, 0.876277, 1.52144, 1.93398, 2.13442, 2.26799, 2.5376, 2.65825, + 0.161634, 0.219919, 0.353206, 0.524346, 0.961806, 1.20771, 1.68792, 1.91694, 2.16187, 2.32066, + 0.413612, 0.597095, 0.793763, 0.98629, 1.28179, 1.41266, 1.65246, 2.01609, 2.38416, 2.52858, + 0.228655, 0.341562, 0.480989, 0.988605, 1.371, 1.47742, 1.86103, 2.01585, 2.33975, 2.77315, + 0.259092, 0.597012, 0.985224, 1.32174, 1.64335, 1.95737, 2.28868, 2.49747, 2.71649, 2.84447, + 0.185652, 0.304664, 0.446232, 0.864434, 1.09179, 1.27377, 1.94257, 2.09554, 2.52465, 2.76824, + 0.176687, 0.256678, 0.745652, 0.934909, 1.28376, 1.44006, 1.76524, 2.12209, 2.3881, 2.59055, + 0.189805, 0.275637, 0.440995, 0.821356, 1.25602, 1.41098, 1.92978, 2.12014, 2.39603, 2.60464, + 0.266823, 0.337688, 0.819408, 1.13475, 1.2892, 1.77703, 1.98289, 2.22175, 2.59029, 2.6981, + 0.205348, 0.276512, 0.527305, 0.727412, 1.02465, 1.65398, 1.90418, 2.04661, 2.21792, 2.45566, + 0.293498, 0.424494, 0.613795, 0.95613, 1.13398, 1.3248, 1.80903, 1.95392, 2.29385, 2.57588, + 0.18312, 0.24965, 0.376204, 0.543914, 1.35083, 1.90722, 2.09255, 2.25571, 2.51439, 2.6879, + 0.541205, 0.789796, 1.05895, 1.26942, 1.5039, 1.70219, 1.97018, 2.17544, 2.49681, 2.65224, + 0.229326, 0.339475, 0.451881, 0.66121, 0.795832, 1.0738, 2.0271, 2.20637, 2.4789, 2.72678, + 0.330006, 0.506868, 0.673076, 0.887406, 1.22877, 1.34923, 1.78129, 2.08658, 2.27776, 2.48003, + 0.138389, 0.200001, 0.396259, 0.811975, 1.09071, 1.46041, 1.74549, 1.90427, 2.34825, 2.69989, + 0.176584, 0.242161, 0.37827, 1.17785, 1.56472, 1.67817, 1.95162, 2.12141, 2.58011, 2.73713, + 0.145852, 0.198423, 0.335644, 0.550505, 1.01973, 1.37119, 1.79763, 1.94383, 2.20749, 2.74647, + 0.385078, 0.503696, 0.703239, 1.06999, 1.36574, 1.47205, 1.82583, 2.15964, 2.37128, 2.52097, + 0.28495, 0.38805, 0.507352, 0.879125, 1.52353, 1.77624, 1.9296, 2.15756, 2.44799, 2.5864, + 0.491116, 0.756155, 1.2552, 1.52246, 1.77658, 2.02812, 2.28606, 2.42977, 2.67911, 2.77616, + 0.252477, 0.396081, 0.713022, 0.861502, 1.15222, 1.3708, 1.61401, 2.1448, 2.57407, 2.71253, + 0.282756, 0.438437, 0.613566, 0.847746, 1.26077, 1.37906, 1.6422, 2.13754, 2.36837, 2.52216, + 0.203971, 0.322195, 0.479842, 0.953133, 1.21128, 1.39763, 1.80081, 1.95452, 2.40348, 2.57371, + 0.264533, 0.358424, 0.628768, 1.11124, 1.34025, 1.50648, 1.99959, 2.19411, 2.46141, 2.66736, + 0.17773, 0.22368, 0.394553, 0.556177, 0.947415, 1.50064, 1.73353, 1.92605, 2.26147, 2.43605, + 0.314223, 0.363636, 0.727886, 0.85188, 1.05384, 1.79813, 1.97435, 2.1826, 2.538, 2.62968, + 0.201778, 0.2755, 0.404891, 0.747466, 1.50005, 1.84118, 1.99884, 2.22681, 2.48199, 2.66951, + 0.132164, 0.314955, 0.821473, 1.19604, 1.42659, 1.69993, 2.03686, 2.3235, 2.68547, 2.82896, + 0.223374, 0.347335, 0.50773, 0.773547, 0.967916, 1.13413, 1.9914, 2.30657, 2.52136, 2.78875, + 0.312742, 0.449784, 0.583287, 0.934234, 1.26857, 1.36506, 1.5693, 1.68705, 2.0773, 2.59502, + 0.124286, 0.162126, 0.29073, 0.654031, 1.23166, 1.53846, 1.89307, 2.18478, 2.56264, 2.79822, + 0.177049, 0.251654, 0.367891, 0.912504, 1.55758, 1.69305, 1.89899, 2.07214, 2.35016, 2.64604, + 0.240517, 0.378333, 0.547809, 0.754272, 0.973321, 1.10367, 1.57442, 2.02805, 2.21113, 2.56271, + 0.427795, 0.519003, 0.771284, 0.93724, 1.08662, 1.60988, 1.87875, 2.05279, 2.53412, 2.65715, + 0.22437, 0.317969, 0.439666, 0.812931, 1.3985, 1.62663, 1.79418, 2.114, 2.30916, 2.49684 +}; + /* /Users/erdgeist/Coding/codec2/src/codebook/lspjmv2.txt */ +#ifdef __EMBEDDED__ +static const float codes1[] = { +#else +static float codes1[] = { +#endif + 0.005167, -0.03731, -0.002159, 0.016849, 0.130396, + 0.039445, 0.03168, -0.074412, -0.031499, 0.060536, + 0.019479, -0.030564, -0.048137, -0.056279, -0.027829, + 0.020585, -0.01127, 0.023913, -0.005706, 0.011407, + -0.023217, 0.107455, -0.037777, 0.00407, -0.017279, + -0.090444, 0.007641, 0.099001, -0.047913, -0.017199, + 0.0227, -0.063865, 0.047213, 0.043843, -0.036225, + 0.001312, -0.123861, -0.038988, 0.058666, 0.074541, + 0.039508, 0.1103, 0.013954, -0.119228, -0.035807, + -0.047392, 0.027035, -0.004412, -0.03265, -0.03715, + 0.002491, -0.045447, 0.15826, 0.022828, -0.030124, + -0.047856, 0.088744, -0.009678, 0.106688, 0.08769, + -0.027941, 0.044084, -0.0285, 0.018736, -0.069969, + -0.035358, -0.051568, -0.030459, -0.017899, 0.027632, + -0.018607, -0.123557, 0.019228, 0.057485, -0.028907, + 0.019057, 0.038151, -0.08022, 0.034222, 0.023081, + 0.021312, 0.041905, 0.112903, 0.024092, 0.093974, + -0.116679, 0.015344, -0.066059, -0.096437, 0.004041, + -0.022464, -0.11626, 0.047819, -0.003921, -0.073504, + 0.001975, -0.025869, 0.0282, 0.12269, 0.010627, + -0.035672, 0.078963, -0.009686, 0.000743, -0.147582, + 0.016932, -0.020291, -0.096896, -0.237875, -0.029121, + 0.017376, -0.04013, -0.053865, 0.15406, -0.013215, + 0.015215, -0.019023, -0.070604, 0.032265, 0.04034, + 0.102365, -0.022746, 0.019895, 0.05057, 0.008845, + -0.034134, 0.044441, -0.049387, -0.140481, 0.07257, + 0.013023, -0.006079, 0.037574, 0.004937, -0.081501, + 0.003696, 0.049908, 0.007355, 0.000403, 0.026006, + -0.008466, 0.08068, 0.061382, -0.108985, -0.08806, + -0.012275, -0.081061, 0.020333, -0.079001, 0.068724, + -0.014081, -0.042609, 0.093365, 0.04412, 0.000303, + 0.063391, 0.096574, -0.105424, 0.039041, 0.010412, + -0.054031, -0.084948, 0.080406, -0.035883, 0.137428, + 0.063037, 0.050562, 0.02469, -0.031394, 0.13032, + -0.015501, -0.078884, -0.076886, -0.013864, -0.073587, + 0.048778, 0.003814, -0.031125, 0.046897, 0.028304, + 0.048692, 0.132795, 0.06545, 0.059487, -0.042396, + -0.176999, 0.056943, -0.004135, -0.049378, -0.041083, + -0.039445, -0.016292, -0.00455, 0.06201, -0.079613, + -0.054566, -0.008476, -0.01671, 0.049202, 0.025758, + -0.078723, 0.092091, 0.096536, -0.065079, 0.021161, + 0.076657, 0.009203, -0.036866, -0.016559, 0.012823, + 0.008225, -0.003006, 0.108033, 0.04312, -0.06087, + -0.019346, 0.02279, -0.001728, 0.062304, -0.016965, + -0.001302, -0.01449, -0.041803, -0.034058, -0.197066, + -0.033655, -0.127217, -0.108681, -0.010571, -0.004705, + -0.015553, -0.086069, 0.034109, -0.101379, 0.002068, + -0.004003, -0.044637, -0.068617, 0.052228, -0.047812, + -0.043307, 0.035681, 0.042207, -0.055946, 0.055944, + -0.026792, -0.012601, -0.05671, -0.021094, 0.105842, + -0.025598, -0.078858, -0.013487, 0.030728, -0.031956, + 0.031444, 0.022763, 0.025364, 0.121366, 0.070736, + -0.084556, 0.098118, -0.024301, -0.058655, -0.043194, + -0.011752, -0.043781, 0.091051, -0.071201, -0.02098, + 0.082904, -0.031657, -0.088247, 0.066709, -0.079182, + -0.012151, 0.011796, -0.010589, 0.100656, 0.094539, + 0.035967, 0.025338, 0.071826, 0.009741, -0.040209, + 0.006866, -0.015095, -0.168469, -0.056133, 0.060145, + 0.04583, -0.068969, 0.034551, 0.015842, -0.092809, + 0.054699, 0.138744, 0.001726, 0.006927, 0.005167, + 0.016978, 0.046384, -0.060183, -0.040742, -0.072692, + -0.022489, -0.029728, -0.065018, -0.124741, 0.044927, + -0.029057, -0.037154, 0.031068, 0.060086, 0.009984, + 0.009311, -0.006957, -0.105508, 0.059637, -0.019564, + -0.068154, -0.066443, 0.000799, 0.028579, 0.097063, + 0.096936, 0.03023, -0.034623, -0.088918, 0.040334, + 0.019439, -0.050707, -0.003294, -0.028505, -0.053599, + 0.06246, -0.070688, -0.016465, -0.03568, 0.017378, + 0.009363, 0.048761, 0.043374, 0.039587, -0.023232, + -0.067033, 0.042663, 0.05407, -0.042797, -0.089391, + -0.030497, -0.050249, 0.059528, 0.089089, -0.029633, + 0.064125, -0.086614, -0.002005, 0.08062, 0.000502, + -0.00349, 0.097336, 0.099565, 0.015648, 0.006691, + 0.077668, 0.016572, 0.035404, -0.046026, 0.017237, + -0.048631, 0.009314, 0.141479, 0.017079, 0.043796, + -0.106474, 0.145951, 0.05774, 0.01125, -0.059443, + 0.027572, 0.02665, 0.008527, 0.002949, -0.03768, + -0.077991, -0.090617, 0.00342, -0.04601, 0.007354, + 0.019056, -0.128651, 0.016464, 0.004584, -0.030883, + -0.092069, 0.038976, -0.08184, 0.066695, -0.04734, + 0.003513, 0.040613, 0.046815, -0.023406, 0.062389, + 0.021759, 0.024928, -0.018922, -0.048006, 0.0638, + -0.014416, -0.050333, 0.042628, -0.114934, -0.10145, + 0.062139, 0.029295, -0.065908, 0.111463, 0.050781, + -0.022707, 0.135414, 0.003548, 0.134535, -0.048259, + -0.092344, -0.027727, 0.016343, -0.060786, -0.081502, + -0.005412, -0.026229, -0.143331, 0.052404, -0.077298, + -0.035919, -0.041968, -0.106108, -0.004369, 0.065028, + 0.09637, -0.053299, 0.043317, -0.049735, 0.049815, + 0.032324, 0.051309, -0.009607, -0.205917, 0.005023, + -0.054316, -0.022895, 0.099327, -0.006927, -0.076574, + -0.111024, 0.111026, 0.038381, -0.060368, 0.064238, + -0.034316, 0.026846, 0.02574, -0.076162, -0.163904, + 0.055955, -0.056885, 0.014831, -0.120715, 0.090938, + 0.035289, -0.036439, 0.060012, 0.080302, 0.036215, + 0.06525, 0.08303, -0.058784, 0.104826, -0.051805, + -0.011099, -0.00642, 0.053042, 0.024127, 0.092534, + 0.058569, -0.033442, 0.025186, -0.018222, 0.117744, + 0.044345, -0.042456, -0.043767, -0.021378, -0.121965, + 0.027371, 0.052731, -0.020316, 0.036912, 0.115357, + 0.03115, 0.041547, 0.059267, -0.039672, -0.086918, + -0.162369, 0.024801, 0.031725, 0.0834, -0.034463, + 0.000272, -0.008147, -0.002016, 0.131953, -0.092911, + -0.091944, -0.062864, -0.005221, 0.063647, -0.012658, + 0.042685, 0.067952, 0.038644, -0.153221, 0.096841, + 0.108299, 0.089446, -0.047164, 0.004196, -0.043268, + -0.035456, 0.050838, 0.070444, 0.084465, -0.07998, + -0.048916, 0.057726, 0.023894, 0.027653, 0.017775, + 0.015461, -0.030287, -0.022245, 0.052081, -0.150947, + -0.002682, -0.056774, -0.123366, -0.091754, 0.006536, + 0.006473, -0.143025, 0.05469, -0.043189, 0.03297, + 0.027446, 0.033127, -0.132722, -0.010417, -0.080097, + -0.018187, 0.001858, 0.11129, -0.090749, 0.059434, + -0.068738, 0.090679, -0.14507, -0.065277, 0.063514, + -0.003982, -0.056382, -0.003673, 0.015845, -0.073396, + 0.043688, 0.002836, 0.069211, 0.124852, -0.053313, + -0.040946, 0.07044, -0.107024, -0.019199, -0.033672, + -0.00144, 0.02168, 0.110595, -0.053452, -0.052426, + 0.035461, -0.028179, -0.049041, 0.02258, -0.010989, + -0.002913, -0.051691, -0.075881, 0.037241, 0.076377, + 0.034735, -0.031556, 0.073516, -0.001427, 0.016296, + -0.017537, 0.003346, -0.099774, -0.067624, -0.044257, + -0.018202, 0.030622, 0.012773, 0.046475, -0.121785, + -0.057265, 0.116179, -0.079916, 0.066396, 0.050104, + -0.013177, 0.057766, -0.047879, -0.109526, -0.146491, + 0.032675, -0.049318, -0.057045, -0.080068, 0.089621, + -0.046564, -0.029992, 0.040828, 0.029281, -0.037369, + -0.009731, -0.082145, -0.117622, 0.117077, 0.037369, + 0.00082, -0.106634, -0.007967, 0.000812, 0.140637, + 0.03653, 0.062121, -0.065504, -0.09493, 0.121336, + 0.01753, -0.01733, -0.040402, -0.018255, 0.010992, + 0.019746, -0.027564, 0.033588, 0.042466, -0.003143, + 0.013767, 0.084179, 0.033753, -0.017279, -0.009676, + -0.006452, 0.032645, 0.031852, -0.030975, -0.043384, + -0.005433, -0.015258, 0.053273, 0.054748, -0.064736, + 0.008959, -0.141223, -0.032957, -0.015079, 0.018198, + -0.001681, 0.143079, 0.076, 0.001037, -0.048744, + 0.022062, 0.02603, -0.008263, -0.050353, -0.023037, + -0.036477, -0.051733, 0.137823, -0.034438, -0.007573, + -0.004256, 0.064218, 0.075183, 0.095106, 0.026497, + 0.02636, 0.009791, -0.058039, 0.053315, -0.077817, + -0.033283, -0.081151, -0.05522, 0.004268, 0.017539, + -0.007329, -0.1172, 0.09322, 0.037359, 0.002718, + 0.010749, 0.018281, -0.0758, -0.024889, 0.00572, + 0.022129, 0.035613, 0.036187, 0.032246, 0.105439, + -0.073766, 0.016887, -0.059934, -0.049471, 0.07352, + -0.024041, -0.104642, 0.023557, -0.059746, -0.043871, + 0.022311, -0.00025, -0.074027, 0.198593, 0.102732, + 0.024478, 0.077658, -0.060042, -0.018229, -0.149648, + -0.009871, -0.105822, 0.007585, -0.161459, -0.041121, + -0.02146, 0.00902, -0.065018, 0.111801, -0.024953, + 0.074594, -0.026041, -0.062859, 0.009199, 0.069609, + 0.078672, -0.033414, 0.054128, 0.005408, -0.016273, + 0.052076, 0.10761, -0.067518, -0.0964, 0.033703, + -0.01435, -0.024676, 0.056254, -0.04377, -0.060847, + -0.004185, 0.07355, -0.05783, -0.016644, 0.029096, + 0.005755, 0.026472, 0.040449, -0.09195, -0.048538, + -0.034439, -0.107938, 0.090712, -0.117001, 0.04317, + -0.006505, -0.035277, 0.117316, 0.127002, 0.047906, + -0.001441, 0.118379, -0.132165, 0.00738, 0.023823, + -0.02012, -0.083725, 0.047284, 0.023795, 0.074123, + -0.013439, 0.024994, 0.060254, -0.06912, 0.166373, + -0.024228, -0.06315, -0.046506, -0.077202, -0.054592, + -0.006571, 0.010335, -0.006568, 0.003982, 0.075837, + 0.008643, 0.136339, -0.005502, 0.03391, -0.066379, + -0.127371, -0.006954, 0.03977, -0.070123, 0.060925, + -0.046386, -0.02642, -0.00528, 0.103509, -0.02231, + -0.00374, -0.014999, -0.03777, 0.080005, 0.025231, + -0.054995, 0.071017, 0.009442, -0.075737, 0.013441, + 0.051947, 0.027097, -0.070351, -0.055705, -0.021115, + 0.021387, 0.029232, 0.163331, -0.03238, 0.010008, + -0.011987, -0.028631, 0.002665, 0.01477, -0.009558, + -0.034325, 0.01583, -0.091253, -0.012677, -0.107378, + -0.034624, -0.047725, -0.10233, 0.042525, -0.006869, + 0.014048, -0.043127, 0.052384, -0.047473, 0.055102, + 0.009744, -0.033646, -0.081755, -0.001464, -0.016223, + -0.036697, -0.002279, 0.023279, -0.036221, 0.101478, + -0.058454, 0.065074, 0.003524, 0.00501, 0.097182, + -0.038171, -0.037943, -0.009994, -0.033355, -0.044552, + 0.041318, 0.065041, 9.2e-05, 0.100816, 0.029007, + -0.031803, 0.183537, -0.009617, -0.010544, -0.028465, + 0.0069, -0.014988, 0.09049, -0.174817, 0.027464, + 0.063314, -0.049281, -0.001567, 0.091421, -0.078603, + -0.004869, -0.063266, -0.001922, 0.069338, 0.081771, + 0.058737, 0.073195, 0.081676, -0.047808, -0.025797, + -0.004185, 0.033203, -0.125472, -0.108148, 0.031258, + 0.035192, 0.029957, 0.046675, 0.047238, -0.088197, + 0.033315, 0.114919, -0.04918, 0.025707, 0.053843, + 0.035182, 0.140206, -0.05866, -0.025978, -0.019658, + -0.014847, -0.021051, -0.034385, -0.121789, 0.173406, + -0.112251, -0.022333, 0.071206, 0.028998, 0.046468, + 0.067704, -0.026159, -0.158316, 0.014936, 0.040216, + -0.010137, -0.053492, 0.004935, -0.011277, 0.073852, + 0.091261, 0.114794, -0.01406, -0.051545, 0.077316, + 0.101258, -0.046137, 0.022994, -0.066767, -0.065537, + 0.049952, -0.043582, 0.012823, 0.009313, 0.036343, + 0.054885, 0.037796, 0.02194, 0.013211, 0.006019, + -0.099578, 0.058596, -0.045463, -0.015632, -0.087141, + -0.019273, -0.03314, 0.043796, 0.119057, -0.081813, + -0.021538, -0.070453, -0.052551, 0.077213, 9.4e-05, + 0.050268, 0.092271, 0.051688, -0.025224, 0.075437, + 0.027983, 0.069205, 0.031787, -0.099975, 0.004387, + -0.002747, -0.056567, 0.161394, 0.000164, 0.084189, + -0.124844, 0.050329, 0.009844, 0.055877, 0.055701, + 0.030479, 0.028843, -0.001076, -0.017173, -0.10277, + -0.038426, -0.133841, -0.03584, -0.072046, 0.020206, + 0.016438, -0.097885, 0.041857, 0.034601, 0.030422, + -0.089192, -0.014112, -0.052276, 0.012005, -0.029335, + -0.011331, 0.101833, 0.063827, 0.044288, 0.101597, + -0.034689, -0.027434, -0.017801, -0.079224, 0.067103, + -0.027456, -0.098034, 0.009448, -0.038986, -0.156729, + 0.085023, 0.033136, -0.021343, 0.110701, -0.011901, + -0.006484, 0.082023, -0.027094, 0.091208, -0.013163, + -0.012223, 0.005933, 0.010653, -0.098119, -0.005304, + -0.021061, -0.058077, -0.073035, 0.097856, -0.102847, + -0.035329, -0.092754, -0.101463, -0.048671, 0.055015, + 0.102145, 0.062017, 0.016002, 0.036489, 0.059, + 0.042861, 0.025447, -0.019735, -0.107841, -0.033752, + -0.043982, -0.067059, 0.051092, 0.025235, -0.147107, + -0.016269, 0.123009, 0.035894, -0.020453, 0.040013, + 0.015557, 0.015825, 0.080712, -0.06963, -0.149739, + 0.022006, -0.008848, 0.040169, -0.095688, 0.059575, + -0.030641, -0.061353, 0.046302, 0.104489, 0.043372, + -0.001579, 0.059737, -0.104073, 0.042342, -0.048611, + -0.013811, -0.056255, 0.107179, 0.057433, 0.084815, + 0.030217, 0.02236, -0.040342, -0.028775, 0.120588, + 0.04127, -0.045775, -0.030195, -0.106859, -0.104349, + 0.072418, -0.003603, -0.013072, 0.040728, 0.086869, + 0.091943, 0.066517, 0.024442, -0.030929, -0.03292, + -0.160336, -0.010347, -0.068458, 0.017458, 0.044823, + 0.050694, 0.067625, 0.040303, 0.113164, -0.038747, + -0.065558, -0.106357, -0.028352, 0.121488, 0.026548, + -0.00782, 0.054872, 0.094674, -0.099533, 0.005231, + 0.118132, 0.04278, -0.065079, 0.03144, 0.043229, + -0.050024, 0.015943, 0.073917, 0.034049, 0.010548, + -0.024979, 0.022639, 0.027795, 0.049491, 0.048762, + -0.002738, -0.010783, -0.027637, -0.006986, -0.104141, + -0.066719, -0.061742, -0.067028, -0.053057, -0.003478, + -0.050948, -0.122196, 0.022082, 0.002595, 0.015094, + 0.006014, 0.005784, -0.184537, -0.034872, -0.036104, + 0.055412, 0.006886, 0.103488, -0.063001, 0.096665, + -0.035533, 0.009847, -0.095114, 0.008588, 0.023736, + -0.034278, -0.11197, -0.041172, 0.03973, -0.102952, + 0.063775, 0.039273, 0.109863, 0.0918, 0.030306, + -0.082206, 0.089449, -0.058478, -0.029341, 0.038389, + 0.061057, -0.024711, 0.111044, -0.035079, -0.027985, + 0.01457, 0.002046, -0.031545, 0.058848, -0.0195, + -0.002475, -0.025589, -0.144358, 0.063478, 0.124927, + -0.014094, -0.01097, 0.031621, -0.040043, 0.004389, + 0.025003, 0.052397, -0.054526, -0.073469, 0.026795, + -0.024697, 0.024739, 0.118299, 0.014948, -0.132109, + 0.020192, 0.037815, -0.09027, 0.049313, 0.082764, + -0.022642, -0.006053, -0.038073, -0.057363, -0.107347, + 0.033166, -0.027556, -0.019765, -0.111958, 0.027773, + -0.063001, -0.052998, 0.019353, -0.009646, -0.01127, + 0.011872, -0.006508, -0.122226, 0.059824, 0.041779, + 0.016445, -0.03189, -0.03631, 0.013085, 0.091631, + 0.062866, 0.054501, -0.117523, -0.010907, 0.087026, + -0.014974, -0.03592, -0.048565, -0.019246, -0.043405, + -0.006959, 0.006211, 0.04237, 0.014603, -0.006435, + 0.019149, 0.078038, -0.020556, 0.018114, -0.036521, + -0.054036, 0.007325, 0.056349, -0.033497, -0.02596, + 0.050184, -0.066536, 0.091501, 0.071356, -0.049044, + -0.032263, -0.095268, -0.008784, 0.049033, 0.036929, + 0.020357, 0.152151, 0.040814, -0.063159, -0.024324, + -0.017084, 0.011876, -0.015442, -0.019811, -0.000366, + -0.0027, -0.072981, 0.109288, 0.007473, -0.049442, + -0.05404, 0.051947, 0.019359, 0.12916, 0.021981, + 0.002248, 0.035262, -0.023141, 0.064666, -0.078273, + -0.031663, -0.031343, -0.006058, -0.045421, 0.017466, + -0.067122, -0.130784, 0.067057, 0.05246, -0.041165, + -0.004411, 0.046453, -0.055461, 0.048162, -0.009687, + 0.02153, 0.007211, 0.104764, 0.079849, 0.086248, + -0.072791, 0.001112, -0.027964, -0.071233, -0.013339, + 0.007979, -0.118231, 0.076826, -0.060762, -0.084358, + -0.011447, 0.009765, 0.014163, 0.164784, -0.015892, + -0.020756, 0.152509, -0.014014, -0.041853, -0.117008, + -0.011755, -0.005766, -0.086896, -0.13965, -0.032342, + 0.025651, -0.007843, -0.039073, 0.103397, -0.042591, + -0.005971, -0.001324, -0.053945, -0.000716, 0.048977, + 0.130185, 0.028226, 0.061179, 0.024489, -0.021939, + -0.007019, 0.054336, -0.01004, -0.095411, 0.082406, + -0.03213, -0.015054, 0.033059, 0.002802, -0.080159, + -0.022452, 0.077426, -0.015314, 0.033583, 0.028479, + 0.023293, 0.035078, 0.006442, -0.110541, -0.106244, + -0.034737, -0.10414, -0.03457, -0.114316, 0.079382, + 0.006009, 0.003901, 0.080081, 0.055082, 0.012896, + 0.064981, 0.057219, -0.112986, 0.003906, -0.028414, + -0.012383, -0.054541, 0.077483, 0.004267, 0.123567, + 0.007369, 0.099856, 0.023273, -0.028194, 0.12203, + -0.036635, -0.126589, -0.034567, -0.028288, -0.06504, + 0.01428, 0.011435, -0.004867, 0.043901, 0.035395, + 0.028599, 0.075858, 0.11846, 0.070581, -0.051903, + -0.170905, 0.050352, 0.053514, -0.017139, 0.021748, + -0.09661, 0.008904, -0.001049, 0.078787, -0.101201, + -0.026229, -0.019757, -0.035771, 0.054142, 0.068041, + -0.020328, 0.099979, 0.096623, -0.046957, -0.001733, + 0.049586, 0.052458, -0.031724, -0.028332, -0.005418, + 0.04671, 0.014238, 0.133125, -0.005428, -0.080055, + -0.033226, 0.034007, 0.025272, 0.033924, -0.044662, + -0.03469, -0.079173, -0.160689, -0.153893, -0.228771, + -0.00245, -0.083966, -0.168294, 0.010694, -0.012167, + 4e-06, -0.044377, 0.023373, -0.077437, 0.012178, + -0.015899, -0.010828, -0.062847, 0.029927, -0.074557, + -0.053306, 0.049688, 0.057017, -0.022571, 0.015337, + -0.046545, 0.018895, -0.024848, -0.004424, 0.165442, + -0.060201, -0.098629, -0.06519, 0.036582, -0.038566, + 0.051453, 0.093478, 0.039619, 0.117535, 0.090386, + -0.029366, 0.108075, -0.016568, -0.093576, -0.048799, + -0.045599, -0.023619, 0.070072, -0.109294, 0.001548, + 0.076285, -0.091274, -0.068829, 0.000215, -0.046519, + -0.022512, -0.027067, 0.014905, 0.079017, 0.140699, + 0.061141, 0.009178, 0.097811, 0.033468, -0.006666, + 0.007163, -0.007578, -0.124238, -0.025271, 0.017581, + 0.042405, -0.034252, 0.06489, 0.0025, -0.139083, + 0.009733, 0.158179, 0.014474, 0.038913, 0.05629, + -0.004998, 0.075401, -0.030557, -0.038595, -0.04907, + -0.01468, -0.076306, -0.132365, -0.177693, 0.09176, + -0.057238, -0.072379, 0.050877, 0.051489, 0.028125, + 0.004991, 0.032621, -0.167359, 0.041002, -0.007072, + -0.086405, -0.042263, -0.019757, -0.011524, 0.066004, + 0.08567, 0.008071, -0.013614, -0.062142, 0.08328, + 0.000887, -0.07582, 0.008295, -0.020136, -0.016886, + 0.089657, -0.10626, -0.051491, -0.012687, 0.054778, + 0.011535, 0.086613, 0.053803, 0.027164, -0.023825, + -0.040009, 0.080987, 0.026309, -0.000334, -0.085288, + -0.024208, -0.08504, 0.096077, 0.120527, -0.044181, + 0.003034, -0.091142, 0.006471, 0.115971, -0.026358, + 0.003489, 0.083633, 0.109975, -0.029425, 0.061726, + 0.056115, -0.006711, 0.013158, -0.062917, -0.015029, + 0.003354, 0.031574, 0.119045, 0.022859, 0.023777, + -0.068292, 0.115604, 0.031617, 0.008953, 0.006943, + 0.01442, 0.008569, -0.031547, -0.006857, -0.05169, + -0.086683, -0.108339, 0.005093, -0.108646, -0.03472, + 0.054273, -0.096753, 0.050806, -0.021115, -0.025278, + -0.079997, 0.027008, -0.034211, 0.090949, 0.005678, + 0.019288, 0.042083, 0.062119, 0.019301, 0.040859, + -0.009113, 0.022427, -0.004019, -0.06089, 0.032884, + -0.012373, -0.037976, 0.017625, -0.079369, -0.050788, + 0.07972, -0.039347, -0.085324, 0.091044, 0.026653, + -0.063122, 0.099371, -0.024736, 0.084631, -0.100421, + -0.073313, 0.014317, 0.022555, -0.116051, -0.063966, + -0.009688, -0.063666, -0.131709, 0.016744, -0.135028, + -0.003708, -0.043685, -0.121631, -0.03693, 0.125776, + 0.084333, 0.010114, 0.071231, -0.010395, 0.059391, + 0.01776, 0.033034, -0.018996, -0.13054, 0.025758, + -0.018261, -0.060044, 0.127025, -0.032724, -0.107299, + -0.064538, 0.090073, -0.010186, -0.066127, 0.107025, + -0.01094, 0.003083, 0.01903, -0.023935, -0.140176, + 0.003549, -0.042402, -0.010695, -0.185915, 0.060835, + 0.005405, -0.013822, 0.029205, 0.079338, 0.068155, + 0.071485, 0.030282, -0.087207, 0.07348, -0.02794, + 0.004896, -0.033246, 0.072637, 0.018017, 0.054712, + 0.026184, -0.005287, 0.034456, -0.036753, 0.079232, + 0.072707, 0.004506, -0.039353, -0.01556, -0.071466, + 0.010257, 0.067446, -0.006598, 0.047396, 0.072218, + 0.023405, 0.082663, 0.015319, -0.035436, -0.075461, + -0.124036, -0.032046, 0.060837, 0.010231, -0.053024, + 0.0228, 0.042891, -0.041549, 0.132395, -0.09533, + -0.077091, -0.058554, -0.070632, 0.04757, 0.031856, + 0.000127, 0.114996, 0.05866, -0.092472, 0.064503, + 0.09645, 0.0662, -0.001059, 0.039487, -0.032859, + -0.065721, 0.001601, 0.088037, 0.059828, -0.047411, + -0.077714, 0.010275, 0.013629, 0.003304, 0.005407, + 0.000665, 0.012927, -0.077525, 0.069202, -0.157417, + 0.014547, -0.095965, -0.087546, -0.067375, -0.027867, + 0.005458, -0.095839, 0.105294, -0.044892, 0.045151, + -0.001349, 0.038356, -0.127152, -0.080503, -0.105423, + -0.018484, 0.008439, 0.104398, -0.027959, 0.082086, + -0.020605, 0.042785, -0.109139, -0.025958, 0.079733, + 0.036289, -0.083773, -0.033819, 0.032566, -0.065556, + 0.006659, 0.00209, 0.097027, 0.115715, -0.013271, + -0.067514, 0.128365, -0.089129, 0.02616, -0.040584, + -0.002443, -0.017254, 0.129204, -0.110078, -0.064943, + 0.089215, -0.022299, -0.034959, 0.022446, -0.019254, + -0.0389, -0.069862, -0.07054, 0.069949, 0.111993, + -0.006311, -0.009057, 0.094278, -0.014932, 0.003657, + -0.019323, 0.026145, -0.062611, -0.073753, -0.007182, + 0.014101, 0.015776, 0.052537, 0.064728, -0.160187, + -0.005122, 0.076356, -0.104763, 0.091493, 0.020225, + -0.000433, 0.062698, -0.060457, -0.14754, -0.066168, + 0.007195, -0.061498, -0.037801, -0.039763, 0.059551, + -0.02841, -0.07451, 0.057667, 0.020584, -0.04251, + -0.025311, -0.037825, -0.18801, 0.077423, 0.030749, + -0.025465, -0.067541, 0.003073, -0.049778, 0.127789, + 0.002786, 0.120009, -0.067812, -0.026565, 0.111272, + 0.023219, -0.024403, -0.014507, -0.048624, 0.022163, + 0.014596, -0.052136, 0.00158, 0.064595, 0.017963, + 0.02133, 0.098862, -0.009253, -0.041062, 0.008903, + -0.013829, 0.031967, 0.076571, -0.005348, -0.04401, + 0.031252, 0.000369, 0.036818, 0.072854, -0.038569, + 0.004161, -0.128017, -0.053152, 0.050896, -0.015212, + -0.036159, 0.097995, 0.068397, -0.048472, -0.056131, + -0.01192, 0.059188, 0.010215, -0.061152, -0.011717, + -0.035949, -0.057039, 0.090859, -0.029682, 0.041466, + -0.025106, 0.131191, 0.059327, 0.085383, 0.021699, + 0.04923, 0.03663, -0.077086, 0.017806, -0.08879, + 0.00404, -0.069533, -0.026785, 0.009666, 0.014017, + -0.055897, -0.096299, 0.120693, 0.029995, 0.032602, + -0.001365, 0.034015, -0.053512, 0.001573, -0.01917, + 0.003956, 0.006452, 0.067313, 0.028301, 0.160615, + -0.053111, 0.01399, -0.02706, -0.013638, 0.039376, + -0.054462, -0.096553, 0.079994, -0.043791, -0.025051, + -0.003222, 0.019418, -0.049525, 0.151136, 0.034123, + 0.055117, 0.058918, -0.017393, 0.026169, -0.12638, + -0.019008, -0.028939, -0.014027, -0.173373, -0.032841, + -0.00337, 0.03968, -0.118311, 0.114094, -0.041869, + 0.041121, -0.038391, -0.096074, -0.032479, 0.060222, + 0.063968, -0.024528, 0.018158, -0.009892, -0.043882, + -0.005004, 0.1298, -0.025438, -0.121186, 0.04986, + 0.010448, -0.040388, 0.061853, -0.017304, -0.035088, + -0.008678, 0.061476, -0.039493, -0.005055, 0.079169, + 0.046134, 0.00977, 0.068294, -0.078965, -0.043792, + -0.030529, -0.053845, 0.053853, -0.140682, 0.111461, + 0.003549, -0.014939, 0.148955, 0.072861, 0.004332, + 0.015386, 0.062006, -0.122325, -0.032529, 0.010241, + -0.047982, -0.12644, 0.05584, 0.067128, 0.101189, + -0.00263, 0.031969, 0.046076, -0.080194, 0.10474, + -0.033486, -0.077818, -0.058697, -0.095258, -0.111074, + 0.037236, 0.011711, 0.001113, -0.005664, 0.048588, + 0.041131, 0.098257, 0.033126, 0.029317, -0.095311, + -0.071555, -0.039999, 0.026678, -0.072182, 0.035031, + -0.007997, -0.048174, -0.006796, 0.075959, -0.05206, + -0.007645, 0.037076, -0.035574, 0.085576, 0.034126, + -0.050676, 0.05143, 0.031999, -0.134308, -0.001489, + 0.084564, -0.018394, -0.09741, -0.042931, -0.025608, + -0.025489, 0.041919, 0.142482, 0.004617, -0.041085, + -0.028816, -0.015527, -0.031005, 0.028405, -0.02224, + -0.067737, -0.025241, -0.052578, 0.012322, -0.120556, + 0.016278, -0.081744, -0.09916, 0.025144, 0.025441, + 0.003176, -0.073871, 0.031718, -0.028622, 0.029031, + 0.01791, -0.030693, -0.104215, -0.015422, -0.065738, + -0.048346, -0.012847, 0.046849, -0.008621, 0.058771, + -0.054495, 0.031597, -0.038844, 0.043138, 0.092588, + -0.071371, -0.059093, -0.001197, 0.001766, -0.074762, + 0.02947, 0.089616, 0.005009, 0.052977, 0.015899, + -0.045424, 0.158466, -0.038717, -0.032506, 0.028687, + 0.011435, -0.006772, 0.047605, -0.144659, -0.031229, + 0.073577, 0.01153, -0.008172, 0.058883, -0.088412, + 0.033615, -0.03412, -0.030701, 0.101215, 0.096645, + 0.027368, 0.041249, 0.081502, -0.02544, 0.007592, + 0.059893, 0.012106, -0.112009, -0.114692, 0.016397, + 0.087068, 0.016199, 0.051263, 0.011915, -0.085364, + 0.026046, 0.145258, -0.047521, 0.077134, -0.000345, + 0.034532, 0.099801, -0.087591, -0.059719, -0.058671, + 0.022737, -0.001887, -0.107049, -0.116757, 0.134115, + -0.055403, 0.005157, 0.067618, 0.081074, 0.071787, + 0.063802, -0.00343, -0.106491, 0.017543, 0.002214, + -0.013785, -0.032962, 0.010084, 0.024325, 0.045963, + 0.059883, 0.072282, -0.008608, -0.015127, 0.048225, + 0.041752, -0.068845, 0.012227, -0.090748, -0.035309, + 0.045353, -0.078624, -0.019489, 0.035531, 0.058571, + 0.045414, 0.039032, -0.011106, 0.048787, -0.025336, + -0.084893, 0.031896, 0.01085, 0.012526, -0.053205, + 0.016952, -0.044041, 0.068766, 0.097328, -0.122229, + 0.027016, -0.051759, -0.057246, 0.074566, 0.006201, + 0.069904, 0.100068, 0.076124, 0.004278, 0.029466, + 0.045229, 0.055683, 0.01879, -0.067806, 0.039373, + 0.029179, -0.036787, 0.129921, -0.028993, 0.037711, + -0.105011, 0.138747, -0.00437, 0.05208, 0.050835, + 0.025511, -0.002962, 0.007852, -0.055234, -0.075055, + 0.00046, -0.089231, -0.030467, -0.080347, 0.007488, + 0.06746, -0.076368, 0.084991, 0.039544, 0.033391, + -0.044318, 0.00639, -0.079387, -0.002909, -0.029708, + -0.047882, 0.06304, 0.065719, 0.021811, 0.070945, + -0.007571, -0.001302, -0.064119, -0.068005, 0.05104, + -0.017747, -0.063938, 0.018673, -0.038391, -0.099966, + 0.057475, -0.007669, 0.009384, 0.109283, 0.012248, + -0.048858, 0.092498, 0.011967, 0.061525, -0.028819, + -0.015131, -0.02416, -0.03322, -0.101648, -0.01798, + -0.003342, -0.049829, -0.125096, 0.128241, -0.047377, + -0.028943, -0.109072, -0.066133, -0.015454, 0.098334, + 0.053371, 0.011324, 0.042781, 0.044313, 0.06251, + 0.098408, 0.06541, -0.040693, -0.116351, -0.032327, + -0.013634, -0.058591, 0.081507, 0.042019, -0.09977, + -0.018275, 0.084624, -0.007512, -0.041113, 0.054203, + 0.017879, -0.029747, 0.059865, -0.048281, -0.111513, + -0.022478, 0.002059, 0.022383, -0.12536, 0.058216, + 0.002386, -0.0816, 0.049288, 0.157428, 0.057724, + 0.005046, 0.102125, -0.083473, 0.044059, -0.094864, + 0.03912, -0.063306, 0.057341, 0.060519, 0.107383, + 0.007076, -0.009373, -0.012555, -0.06663, 0.117121, + 0.025254, -0.008796, -0.062102, -0.083164, -0.079007, + 0.084839, 0.042308, -0.055353, 0.036386, 0.132641, + 0.084464, 0.056288, -0.011636, -0.059554, -0.087748, + -0.147377, -0.052414, -0.010203, -0.009159, -0.018829, + 0.009621, 0.061633, 0.015716, 0.086332, -0.061465, + -0.011833, -0.062998, -0.021168, 0.125194, 0.045025, + 0.052316, 0.02572, 0.095155, -0.093252, 0.02872, + 0.056113, 0.063321, -0.045315, 0.025199, 0.023591, + -0.070481, 0.07235, 0.092458, 0.047973, -0.025439, + -0.001281, 0.021028, 0.034576, 0.084779, 0.006867, + -0.010323, -0.04633, -0.009172, 0.030485, -0.117679, + -0.021782, -0.034737, -0.086292, -0.045885, 0.009655, + -0.037167, -0.123331, 0.017291, -0.028319, 0.071447, + -0.05718, -0.032912, -0.139418, -0.025966, -0.039305, + 0.009411, -0.054017, 0.076307, -0.060252, 0.110087, + -0.061366, 0.038897, -0.098107, 0.046119, 0.043021, + -0.02913, -0.096885, 0.007623, 0.090513, -0.097416, + 0.053264, 0.058296, 0.054372, 0.060769, 0.015586, + -0.067956, 0.059996, -0.03785, 0.005986, 0.000778, + 0.045873, -0.065546, 0.0779, -0.085638, 0.000698, + 0.027694, -0.021241, -0.002777, 0.034509, -0.048173, + 0.009988, 0.001008, -0.077434, 0.026002, 0.13949, + 0.00891, 0.007791, 0.059292, -0.057047, 0.014127, + -0.022959, 0.08571, -0.068087, -0.081561, 0.005935, + 0.007577, 0.061544, 0.076542, 0.00166, -0.113279, + 0.024973, 0.08675, -0.061674, 0.095059, 0.089352, + -0.024436, 0.024181, -0.016117, -0.073634, -0.067986, + 0.074701, -0.046868, -0.054634, -0.092485, 0.006662, + -0.033256, -0.053774, 0.049001, -0.002339, 0.013545, + -0.006432, -0.012089, -0.086842, 0.104105, 0.061991 +}; + /* /Users/erdgeist/Coding/codec2/src/codebook/lspjmv3.txt */ +#ifdef __EMBEDDED__ +static const float codes2[] = { +#else +static float codes2[] = { +#endif + 0.007066, 0.075781, -0.070082, -0.092014, -0.066477, + 0.09051, 0.106622, 0.025911, -0.01676, 0.003724, + -0.024628, 0.058332, 0.012876, 0.059557, -0.002092, + -0.065092, -0.096975, -0.041837, -0.002432, 0.058918, + 0.014358, 0.080049, -0.008803, -0.002091, -0.097584, + 0.085323, -0.026053, -0.086585, -0.009541, 0.130555, + 0.045391, 0.037557, 0.074726, -0.050453, 0.033517, + -0.035576, -0.084211, -0.08643, 0.00891, -0.072674, + -0.098699, -0.02454, -0.048972, -0.066975, -0.048791, + 0.032184, 0.070992, -0.014416, 0.141892, -0.044249, + -0.108921, -0.02045, 0.115988, 0.011287, -0.026273, + 0.024341, 0.138519, -0.036467, 0.020684, 0.074258, + -0.053563, 0.077463, 0.072166, 0.032112, -0.079303, + -0.025039, 0.079675, 0.094211, -0.115754, 0.038892, + 0.050897, -0.024639, 0.057826, -0.110429, 0.071184, + 0.015309, -0.034027, -0.055726, 0.043179, -0.063089, + 0.043359, -0.011698, 0.006637, 0.002751, 0.03011, + -0.001261, 0.11147, 0.043277, -0.004205, -0.021599, + -0.005698, 0.058842, 0.168422, 0.059313, -0.007971, + -0.087599, 0.073891, -0.083238, 0.099279, -0.017364, + -0.018429, 0.01404, -0.014864, -0.111512, 0.08945, + -0.028498, -0.087983, -0.07732, -0.062602, 0.000328, + -0.027152, -0.093796, 0.111381, -0.018603, 0.092394, + -0.007256, 0.025391, 0.011454, 0.012802, -0.04168, + 0.008078, 0.020905, -0.105401, -0.083265, 0.027756, + -0.04963, -0.044085, -0.051424, 0.104125, -0.000779, + -0.063079, -0.130699, 0.0705, 0.033468, -0.019802, + -0.061011, 0.094839, -0.040122, 0.118409, 0.05695, + 0.086391, -0.006615, 0.045337, -0.04419, -0.106474, + -0.081912, 0.067557, -0.031649, -0.014437, 0.057585, + -0.121755, -0.049113, 0.057109, -0.049872, 0.044104, + 0.064705, -0.091589, 0.037286, -0.048606, -0.045398, + 0.003456, 0.05723, 0.006262, -0.055206, -0.063871, + -0.005249, 0.081783, 0.134969, -0.002331, 0.052643, + -0.093346, 0.072093, 0.116025, -0.031453, -0.006012, + -0.038574, -0.030841, 0.010288, 0.02442, 0.051657, + -0.086584, 0.046381, 0.00541, 0.052622, -0.072741, + 0.079023, 0.078099, -0.093912, 0.005477, -0.006721, + 0.100232, -0.017587, 0.044819, 0.036655, 0.02158, + -0.006829, -0.050076, -0.00302, 0.088246, 0.01356, + -0.01569, 0.012477, -0.052595, -0.048861, -0.033688, + 0.055615, 0.092298, -0.066194, 0.016416, -0.066059, + 0.046976, 0.003023, 0.104646, 0.109136, 0.018293, + -0.016507, -0.006859, 0.004326, 0.070843, 0.14075, + 0.025774, 0.03473, -0.07959, 0.050054, -0.10795, + 0.002378, 0.097498, 0.027111, -0.122953, -0.002423, + -0.020539, -0.063263, -0.095493, -0.157361, -0.039183, + 0.025721, 0.026897, -0.0012, 0.033997, -0.001749, + 0.061593, -0.013053, -0.106317, -0.06819, 0.046352, + -0.05606, 0.157084, -0.049365, 0.053959, -0.051065, + -0.047672, 0.08157, 0.064342, -0.030705, -0.070806, + -0.076503, -0.059471, 0.012419, 0.073968, -0.026179, + -0.038473, 0.059013, -0.035783, -0.030057, -0.036346, + -0.052692, -0.015346, -0.022687, -0.035279, 0.013314, + 0.068397, -0.046609, -0.009593, -0.040796, 0.157438, + -0.07536, -0.110464, 0.031839, -0.029035, -0.015222, + 0.041013, -0.099212, -0.10892, -0.008627, 0.012095, + 0.020855, 0.009935, -0.086917, 0.058827, -0.006536, + 0.022104, -0.005013, 0.003496, 0.046663, -0.051061, + -0.036803, -0.067317, -0.007075, 0.18087, -0.027434, + -0.025056, -0.039341, -0.073918, -0.00318, -0.11093, + -0.042711, 0.005519, -0.035005, -0.088419, 0.170942, + 0.001503, -0.121485, 0.066383, -0.067346, 0.005643, + 0.080088, -0.042562, -0.006668, -0.036538, 0.020683, + 0.042848, 0.027852, -0.029088, -0.156468, 0.006503, + 0.037716, 0.032082, 0.038416, 0.021835, -0.106963, + -0.043017, 0.018166, 0.070409, -0.005426, -0.035585, + -0.111071, -0.039986, 0.05043, 0.035157, 0.066902, + -0.040684, 0.060527, 0.036225, 0.002527, -0.015087, + 0.059243, 0.021268, -0.010682, -0.018434, 0.059128, + 0.111314, -0.05407, 0.105744, -0.051476, -0.01297, + -0.000358, -0.099249, -0.077385, 0.069924, -0.039101, + -0.072139, -0.049069, -0.088018, 0.006144, 0.000712, + 0.08103, 0.021987, -0.046031, 0.058087, -0.00132, + -0.046851, -0.011062, 0.108321, -0.001146, -0.071193, + 0.044973, -0.002915, -0.003323, 0.041735, 0.094566, + 0.05353, 0.035927, 0.100282, 0.059082, -0.054059, + -0.012158, -0.035417, 0.020412, -0.073193, 0.059296, + -0.040489, -0.09525, -0.003821, -0.084904, 0.053925, + 0.109183, -0.005862, -0.036538, 0.080962, -0.040647, + 0.02007, 0.057778, -0.020197, -0.079626, -0.003186, + -0.050855, 0.128185, 0.034731, 0.05746, -0.035236, + -0.057096, -0.001238, 0.122018, -0.071204, -0.047253, + -0.051767, 0.048301, -0.052678, 0.02599, -0.017481, + -0.029379, 0.030738, 0.047207, -0.047864, -0.033561, + 0.029884, -0.091175, -0.085446, -0.02614, 0.092628, + 0.067706, -0.085617, 0.081433, 0.047305, 0.031945, + -0.048728, -0.040387, 0.046206, 0.010578, -0.037639, + 0.011328, -0.042458, -0.149597, 0.033882, -0.061869, + 0.0088, 0.057754, -0.095876, 0.03823, 0.096876, + -0.033487, -0.141669, -0.014172, 0.028439, -0.092764, + -0.053714, 0.086926, 0.034786, 0.136053, -0.005569, + 0.028753, 0.00963, 0.044114, -0.050365, -0.066224, + 0.006017, 0.014348, 0.024471, 0.000489, 0.067234, + -0.021678, -0.11876, 0.036349, -0.040295, 0.076358, + -0.008444, -0.086082, -0.044018, -0.025804, 0.028971, + -0.009233, 0.053026, -0.035341, -0.182193, -0.102515, + 0.08921, 0.066812, 0.032417, 0.046882, -0.034815, + -0.052293, 0.022814, 0.129622, 0.128232, -0.012105, + -0.087084, 0.004762, 0.086538, 0.046566, 0.098359, + -0.018713, 0.039204, -0.021707, -0.06011, -0.117527, + -0.005459, 0.060994, -0.057718, -0.021783, 0.035154, + 0.100557, -0.01547, -0.025818, 0.00845, 0.051535, + -0.001388, -0.11461, -0.057903, 0.041862, 0.061778, + 0.045701, -0.078563, -0.070166, -0.04845, -0.08853, + 0.021375, -0.004598, -0.09071, -0.009399, -0.073952, + -0.035575, -0.05028, 0.11478, 0.137866, 0.065234, + 0.003594, -0.066802, -0.144989, 0.166201, 0.039564, + -0.022457, -0.03009, 0.016187, 0.115443, -0.097331, + -0.019139, 0.09944, 0.002198, -0.030953, 0.021099, + -0.045399, -0.046871, 0.022533, -0.064657, 0.005776, + 0.049063, -0.028478, 0.019268, 0.054265, 0.028042, + 0.045559, -0.005541, -0.01441, -0.024165, -0.054976, + -0.073258, 0.084205, 0.036077, -0.068683, 0.004708, + -0.085228, 0.001234, 0.046261, -0.050496, -0.028227, + -0.086828, -0.001218, 0.021865, 0.003791, -0.000568, + -0.088733, -0.040041, -0.035891, -0.054915, 0.073463, + -0.132031, -0.012844, -0.068544, 0.013052, 0.087335, + 0.038603, -0.115382, -0.010433, -0.007113, 0.095126, + -0.047378, -0.081353, 0.018021, -0.021156, -0.120774, + 0.040038, 0.007633, -0.088728, -0.009928, 0.020142, + 0.052024, -0.021063, -0.118121, 0.102739, -0.055837, + 0.005253, -0.061924, 0.06368, -0.014512, -0.020259, + 0.029493, -0.013435, -0.020638, 0.089342, 0.001092, + -0.046491, -0.145634, -0.083159, -0.158142, -0.279281, + 0.003611, 0.055863, -0.064655, -0.088773, 0.089283, + -0.029619, -0.089949, 0.017197, -0.066633, -0.052347, + 0.090828, -0.087551, 0.000338, 0.085238, -0.005313, + 0.096211, 0.071381, -0.076546, -0.077927, -0.040864, + 0.062936, 0.041559, 0.016235, -0.017513, 0.014773, + -0.025734, 0.028586, 0.070292, 0.055794, -0.026131, + -0.076954, -0.082228, 0.043947, -0.035921, 0.152668, + -0.04951, 0.023159, 0.008506, -0.044773, -0.160358, + 0.024984, -0.025587, -0.071627, -0.038376, 0.088478, + 0.120568, 0.046723, 0.086731, 0.000695, -0.015751, + -0.027837, -0.160937, -0.095031, 0.036271, -0.009061, + -0.015078, -0.036281, -0.103665, -0.058258, -0.049573, + 0.022021, 0.108296, -0.002586, 0.065655, -0.018584, + -0.046441, -0.031018, 0.06735, 0.014328, 0.00886, + -0.000245, 0.0634, -0.00181, 0.043515, 0.090344, + -0.063845, 0.020485, 0.079401, 0.070558, -0.116428, + 0.032628, 0.068949, 0.052238, -0.04453, 0.096813, + 0.029911, -0.008814, 0.044352, -0.168172, 0.009604, + 0.055828, -0.100739, -0.026013, 0.021193, -0.051425, + 0.035891, -0.004085, 0.030216, -0.060801, 0.037202, + 0.007262, 0.120686, 0.026846, 0.058464, -0.100792, + -0.009176, 0.027589, 0.123957, -0.011283, -0.025744, + -0.105081, 0.118244, -0.042122, -0.025404, 0.000873, + -0.012703, 0.084159, -0.067539, -0.140536, 0.041637, + -0.014485, -0.043382, -0.048004, -0.075416, 0.054401, + -0.018651, -0.032908, 0.164231, -0.053236, 0.033946, + -0.021681, -0.012655, -0.037049, -0.001613, -0.053393, + -0.014635, 0.017954, -0.116115, -0.027232, 0.034005, + -0.035376, 0.026492, -0.03725, 0.070733, 0.074835, + -0.021378, -0.14298, 0.123195, 0.003699, 0.025398, + 0.015629, 0.07737, 0.032623, 0.12158, 0.0971, + 0.000946, -0.056355, 0.042065, 0.008184, -0.081824, + -0.101937, 0.065473, 0.00336, 0.069241, 0.073002, + -0.053844, -0.044301, 0.080351, -0.091833, 0.044288, + 0.007447, -0.120723, -0.013806, -0.023636, -0.064616, + 0.030556, 0.07263, 0.074428, -0.087759, -0.02644, + 0.06484, 0.049162, 0.091053, 0.023891, 0.033811, + -0.027746, 0.116392, 0.106126, -0.056644, -0.014781, + 0.036137, -0.002632, 0.055512, 0.070077, 0.067819, + -0.030625, 0.053772, -0.078457, -0.021351, -0.113011, + 0.052797, 0.044875, -0.077269, -0.009867, 0.101493, + 0.073477, -0.024103, 0.049145, -0.004706, -0.025211, + -0.053731, -0.049009, -0.035786, 0.05443, 0.046515, + 0.025154, -0.043569, -0.034789, -0.05861, 0.006931, + 0.012049, 0.046809, -0.129441, 0.025541, -0.030933, + 0.000297, -0.054058, 0.179837, 0.081515, 0.004932, + -0.028445, -0.073753, 0.010629, 0.080042, 0.09871, + -0.014017, 0.057597, 0.00101, 0.071658, -0.06757, + 0.074384, 0.110366, -0.018121, -0.108754, 0.037793, + 0.028041, -0.047508, -0.031359, -0.098913, -0.036486, + -0.017311, -0.001279, -0.013694, 0.051968, 0.036512, + 0.088201, 0.031155, -0.043442, -0.065045, 0.023486, + 0.027, 0.104768, -0.015176, -0.038754, -0.004178, + 0.003732, 0.062166, 0.085438, -0.077368, -0.101645, + -0.118347, 0.007589, -0.056489, 0.082268, 0.020253, + -0.035623, 0.034235, -0.099354, -0.061237, -0.024285, + 0.005441, -0.039694, -0.025957, -0.004411, 0.049903, + 0.00304, 0.036243, 0.023552, -0.007334, 0.128963, + -0.077727, -0.059175, -0.019437, -0.024872, 0.004339, + 0.084006, -0.076605, -0.102261, 0.036714, -0.035205, + -0.007642, -0.005125, -0.030525, 0.09639, -0.053138, + -0.002192, -0.024851, 0.050645, 0.04149, -0.043183, + 0.046796, -0.050894, 0.055023, 0.133834, -0.024013, + 0.000872, -0.057072, -0.00063, 0.04207, -0.129339, + -0.064283, 0.037836, -0.066393, 0.004438, 0.125379, + -0.062213, -0.067468, 0.090177, -0.046094, -0.025725, + 0.079101, -0.074909, -0.04373, -0.073483, 0.069672, + -0.020413, -7.9e-05, -0.049725, -0.120751, -0.04698, + 0.039894, 0.072305, 0.009798, 0.005613, -0.045217, + 0.006862, 0.036285, 0.074819, -0.006747, 0.015144, + -0.071562, 0.012324, -0.001082, 0.014835, 0.07996, + -0.027804, 0.103358, -0.017203, 0.014914, -0.056687, + 0.030827, 0.028076, 0.003395, -0.073255, 0.11031, + 0.056498, -0.044893, 0.110122, -0.109058, -0.052302, + -0.001604, -0.089977, -0.060548, 0.107808, 0.025463, + -0.070203, -0.000513, -0.123913, 0.046247, -0.085392, + 0.096343, 0.09589, -0.06495, 0.070363, 0.034272, + 0.037773, -0.07695, 0.124858, -0.009008, -0.010115, + 0.083868, 0.051242, 0.039149, 0.015185, 0.083375, + 0.029773, -0.045961, 0.100395, 0.003743, -0.138294, + -0.041755, 0.010806, 0.057797, -0.147374, 0.095858, + -0.009929, -0.103347, -0.03231, -0.11056, 0.121377, + 0.145244, 0.017079, -0.080587, 0.020516, -0.044939, + -0.010477, 0.038347, -0.003466, -0.001618, 0.0196, + -0.021762, 0.125482, 0.011074, 0.065815, 0.040298, + 0.009202, -0.051686, 0.129684, -0.131135, 0.044536, + 0.009313, 0.102518, -0.075351, 0.054338, 0.020273, + -0.045753, 0.031345, 0.000407, -0.097294, -0.000416, + -0.007466, -0.044972, -0.078744, 0.042414, 0.066624, + 0.030318, -0.067852, 0.061416, -0.028992, 0.056606, + 0.004038, -0.036253, -0.014279, 0.023123, -0.007832, + -0.000137, -0.027684, -0.127648, -0.007713, -0.008746, + -0.0265, 0.049032, -0.183319, 0.059107, 0.0665, + 0.016902, -0.093331, 0.090129, 0.016648, -0.083492, + -0.023669, -0.010473, 0.027614, 0.145068, 0.000681, + 0.044133, -0.035809, 0.005668, -0.090461, -0.090732, + -0.033927, 0.042997, 0.0217, -0.046955, 0.044487, + -0.026444, -0.061011, 0.01011, -0.023804, 0.030427, + -0.015195, -0.155603, -0.016584, 0.021461, -0.003528, + -0.059784, 0.032214, 0.000847, -0.098859, -0.07898, + 0.043188, 0.066433, 0.062309, 0.144507, 0.006865, + -0.068953, 0.046698, 0.099369, 0.043354, -0.014309, + -0.033202, -0.00295, 0.040734, 0.083454, 0.039319, + 0.051358, 0.006074, -0.073465, -0.090554, -0.120787, + -0.040676, 0.092412, -0.085151, -0.021699, 0.005813, + 0.103135, 0.024964, 0.025832, -0.075982, 0.035699, + -0.02731, -0.153007, 0.03642, 0.0576, 0.08163, + 0.001605, -0.054191, -0.033043, -0.01439, -0.071383, + 0.03618, 0.03586, -0.04698, 0.038541, -0.044757, + -0.078032, -0.029878, 0.078183, 0.082251, 0.010549, + 0.053317, -0.038231, -0.06561, 0.055798, 0.037504, + 0.076317, -0.027605, 0.010349, 0.095361, -0.088636, + 0.049089, 0.113316, 0.051084, 0.038589, 0.03433, + -0.055948, -0.037217, -0.015418, -0.139976, 0.036306, + 0.039306, -0.009889, -0.04491, 0.016559, -5e-05, + 0.106073, 0.01528, -0.002563, -0.109085, -0.048475, + -0.035319, 0.16386, 0.032981, -0.044932, 0.003227, + -0.123233, -0.010638, 0.055479, -0.003666, -0.072249, + -0.111158, 0.065365, 0.010691, 0.039119, -0.001837, + -0.118729, 0.06147, -0.002077, -0.033335, -0.060165, + -0.026081, -0.001806, -0.079616, -7.5e-05, 0.080598, + 0.032908, -0.03514, -0.003136, -0.029024, 0.094622, + -0.075773, -0.022898, -0.014817, 0.058393, -0.111505, + 0.036794, -0.01576, -0.112602, 0.030323, 0.085897, + -0.020834, 0.056079, -0.103762, 0.117671, -0.041205, + 0.041684, -0.084336, 0.034186, 0.011973, -0.006313, + 0.040836, -0.035709, 0.03417, 0.122672, 0.090973, + -0.053182, -0.059371, 0.091017, -0.090998, -0.116986, + 0.001405, 0.138364, 0.017107, -0.064076, 0.103486, + -0.031142, -0.030068, 0.046547, -0.133471, -0.042055, + 0.140418, -0.125084, 0.035218, -0.001162, -0.02113, + -0.012034, 0.097413, -0.079006, -0.03903, -0.054011, + 0.143887, 0.078835, -0.000601, -0.021173, -0.039895, + -0.02505, 0.075865, 0.039221, 0.032458, 0.038206, + -0.038873, -0.085003, -0.032736, -0.026956, 0.113525, + -0.023933, 0.120794, -0.003862, -0.026459, -0.138724, + 0.089559, 0.029002, -0.052098, -0.085692, 0.115174, + 0.083497, 0.024179, 0.119021, -0.067541, 0.019047, + -0.02772, -0.086083, -0.055329, 0.020087, -0.027086, + -0.047858, -0.051975, -0.035205, -0.059342, -0.068582, + 0.058936, 0.044141, -0.080315, 0.119744, -0.046518, + -0.064588, -0.027212, 0.147823, 0.032404, 0.01669, + 0.024302, 0.08556, -0.001525, 0.016469, 0.038891, + -0.020146, 0.019943, 0.045067, 0.03807, -0.086274, + -0.025769, 0.044192, 0.102141, -0.064765, 0.055849, + 0.048803, -0.030066, -0.00922, -0.116655, 0.068295, + 0.04758, -0.076138, -0.070307, 0.047582, -0.111342, + 0.004656, -0.004452, 0.029703, -0.004259, 0.01113, + 0.014446, 0.166086, 0.059565, 0.000985, -0.052607, + 0.013251, 0.094476, 0.106216, 0.016715, -0.025581, + -0.101244, 0.072897, -0.114526, 0.024681, 0.010784, + -0.051759, 0.032389, -0.050202, -0.083316, 0.052334, + -0.0351, -0.116721, -0.110336, -0.053391, 0.065541, + -0.02979, -0.020457, 0.135285, -0.004142, 0.111508, + -0.030936, 0.018549, -0.016034, 0.018572, -0.084336, + -0.048615, -0.018739, -0.096815, -0.090162, 0.01941, + -0.040821, -0.009925, -0.097427, 0.091891, 0.031793, + -0.024598, -0.132848, 0.078353, 0.089339, -0.068562, + -0.020779, 0.040974, -0.055675, 0.169131, 0.029649, + 0.078165, -0.050679, -0.005881, -0.004983, -0.104324, + -0.069096, 0.12796, 0.011392, -0.000769, 0.062168, + -0.079842, 0.001606, 0.089284, -0.035465, 0.031075, + 0.029519, -0.102956, -0.010902, -0.06403, -0.019669, + 0.057492, 0.075802, -0.008904, -0.060743, -0.053144, + 0.005126, 0.06298, 0.085674, 0.019895, 0.104448, + -0.086473, 0.056906, 0.056795, -0.01294, 0.036606, + -0.008604, -0.04045, 0.042062, 0.04181, 0.02768, + -0.092256, 0.091237, -0.0395, 0.024761, -0.088978, + 0.068585, 0.088295, -0.048033, -0.017808, 0.04537, + 0.1246, -0.03532, 0.056751, 0.092751, 0.054025, + -0.015725, -0.061938, 0.036806, 0.078768, -0.016065, + 0.002444, -0.023887, -0.072177, -0.02979, -0.00586, + 0.015478, 0.129142, -0.091024, 0.071482, -0.065445, + 0.005867, -0.006051, 0.098646, 0.054089, 0.018713, + 0.033837, -0.008355, -0.051959, 0.05744, 0.160305, + -0.001863, 0.016738, -0.033705, 0.062233, -0.140759, + 0.027342, 0.060074, 0.030362, -0.117875, 0.06102, + -0.028026, -0.088238, -0.003782, -0.146288, -0.080395, + 0.050048, 0.036136, 0.0195, 0.066902, 0.020355, + 0.024817, -0.056254, -0.140918, -0.085803, 0.02054, + -0.00373, 0.161411, -0.049408, 0.000219, -0.002348, + -0.055021, 0.06782, 0.126483, -0.031063, -0.119299, + -0.102834, 0.001133, 0.010172, 0.107707, -0.029106, + -0.059813, 0.036698, -0.02172, -0.043189, -0.00227, + -0.031694, 0.009605, -0.022459, -0.036417, 0.053675, + 0.061561, -0.012723, 0.05004, -0.02945, 0.131044, + -0.124516, -0.107579, -0.012171, 0.011761, 0.002599, + 0.016327, -0.060854, -0.08091, 0.030875, -0.002997, + -0.02097, -0.01188, -0.086096, 0.037912, 0.012421, + 0.055253, -0.00725, 0.04174, 0.055596, -0.02442, + -0.017564, -0.079202, 0.008897, 0.180091, 0.05449, + 0.001772, -0.022151, -0.082048, -0.010559, -0.163377, + -0.02066, -0.017827, -0.0308, -0.045856, 0.122405, + -0.052946, -0.13049, 0.097383, -0.116737, 0.039855, + 0.056504, -0.059549, -0.059931, -0.018658, 0.034898, + 0.054889, 0.005373, -0.066796, -0.12736, 0.04796, + 0.071746, 0.02741, -0.006212, 0.024132, -0.094062, + 0.005369, -0.008926, 0.073085, -0.014265, -0.029204, + -0.100025, -0.072076, 0.014651, 0.069368, 0.048275, + -0.066823, 0.086074, 0.014921, -0.015395, -0.045138, + 0.026224, 0.000902, -0.038208, -0.035221, 0.057397, + 0.097606, -0.073195, 0.051626, -0.033488, 0.027813, + 0.00207, -0.09751, -0.057877, 0.12668, -0.082194, + -0.072597, 0.006014, -0.093185, -0.016853, -0.02279, + 0.138461, 0.005394, -0.056485, 0.102778, 0.028918, + -0.045604, -0.060041, 0.121251, 0.02926, -0.101404, + 0.061194, 0.033039, -0.016798, 0.064263, 0.065144, + 0.010925, 0.023151, 0.107623, 0.027977, -0.090356, + -0.024863, -0.00644, 0.04787, -0.047486, 0.088211, + -0.012139, -0.116121, -0.000525, -0.140961, 0.016604, + 0.06349, -0.022732, -0.046944, 0.06697, -0.068838, + 0.016143, 0.026202, -0.043344, -0.064881, 0.024877, + -0.072845, 0.120531, 0.077901, 0.047272, 0.011713, + -0.044646, 0.040932, 0.076164, -0.101233, -0.029615, + -0.065118, 0.050966, -0.023273, 0.053517, 0.02371, + -0.007489, 0.035822, 0.023439, -0.055528, -0.004033, + -0.007662, -0.096546, -0.081662, 0.037141, 0.137562, + 0.075526, -0.097496, 0.12399, 0.013996, 0.087005, + -0.019788, -0.082043, 0.020524, 0.007027, -0.021537, + -0.036264, -0.090952, -0.177722, -0.009306, -0.031473, + -0.009287, 0.047557, -0.090241, 0.089347, 0.056375, + -0.005506, -0.112128, 0.004356, 0.064421, -0.038478, + -0.035674, 0.040616, 0.007731, 0.160236, -0.054199, + -0.007537, 0.012434, 0.022001, -0.021567, -0.075163, + -0.026053, 0.015909, 0.041015, 0.021832, 0.034152, + -0.048539, -0.086655, 0.047465, 0.000682, 0.04264, + 0.023697, -0.095971, -0.022874, -0.000369, 0.003413, + 0.046005, 0.064807, 0.010131, -0.129517, -0.092254, + 0.116469, 0.053796, 0.03811, 0.09447, 0.018435, + -0.034803, 0.073591, 0.108348, 0.104096, 0.049884, + -0.021274, 0.022097, 0.065347, 0.065555, 0.089319, + 0.000474, -0.004186, -0.040493, -0.065543, -0.083167, + -0.017425, 0.049177, -0.044248, 0.008399, 0.06818, + 0.154778, 0.027549, -0.008012, 0.01495, 0.043254, + 0.039599, -0.136415, -0.018716, 0.0619, 0.031263, + 0.058118, -0.0372, -0.114692, -0.080876, -0.053238, + 0.077436, 0.015015, -0.092517, 0.005804, -0.065541, + -0.005653, -0.073184, 0.095594, 0.08247, 0.060989, + -0.000262, -0.035766, -0.083441, 0.122634, 0.088429, + -0.014397, -0.055434, -0.005659, 0.069697, -0.064892, + 0.008824, 0.082498, 0.051866, -0.03607, 0.033403, + -0.082855, -0.087376, 0.002714, -0.097121, -0.01917, + 0.027179, -0.06987, -0.009316, 0.04745, 0.040657, + 0.060527, 0.00462, -0.040264, -0.051228, -0.029023, + -0.071384, 0.101421, 0.009538, -0.099185, 0.0601, + -0.048395, -0.024677, 0.025125, -0.056043, -0.058045, + -0.054059, 0.008107, 0.021078, 0.04529, -0.018459, + -0.113359, 0.014009, -0.006826, -0.052747, 0.046922, + -0.075976, 0.008538, -0.084411, -0.004369, 0.045801, + 0.075392, -0.06734, 0.014454, 0.032407, 0.092478, + -0.061859, -0.083458, 0.051442, 0.031695, -0.080233, + 0.054028, 0.027, -0.073549, 0.0323, 0.036501, + -0.011384, -0.02078, -0.124142, 0.093905, -0.028332, + 0.039139, -0.030944, 0.079952, -0.001717, 0.013976, + 0.038005, -0.001751, -0.044097, 0.129827, 0.014385, + -0.001682, -0.063458, -0.002511, -0.07815, -0.141236, + 0.021955, 0.104851, -0.093246, -0.060019, 0.069998, + 0.004399, -0.096408, 0.059327, -0.062268, -0.074327, + 0.108063, -0.090534, -0.045654, 0.048119, 0.049187, + 0.042105, 0.043964, -0.091516, -0.047999, -0.028881, + 0.070471, 0.055401, -0.025605, 0.011176, 0.008475, + 0.022254, 0.038266, 0.048106, 0.047176, -0.017967, + -0.010978, -0.088762, 0.034806, 0.019311, 0.126815, + -0.010571, 0.053073, 0.032162, -0.00078, -0.1522, + -0.014253, -0.021954, -0.13104, -0.061376, 0.113838, + 0.060725, 0.020201, 0.102533, -0.011392, -0.052046, + -0.069625, -0.091011, -0.097954, 0.067847, 0.017856, + -0.053461, -0.040679, -0.121664, -0.077208, -0.106919, + 0.057996, 0.069756, -0.012433, 0.069569, -0.055159, + -0.024801, -0.060448, 0.1017, 0.014619, 0.03658, + -0.004526, 0.093977, -0.028211, 0.045261, 0.149736, + -0.014691, -0.007959, 0.097708, 0.107128, -0.079723, + 0.029157, 0.020116, 0.104828, -0.064208, 0.119172, + 0.039583, -0.029446, 0.006628, -0.110398, 0.004062, + 0.048132, -0.060601, 0.009448, 0.051777, -0.053127, + 0.050551, -0.001924, 0.028079, -0.050618, -0.013698, + 0.00192, 0.088162, 0.073078, 0.085795, -0.066788, + 0.014025, 0.042699, 0.176241, -0.046674, -0.034822, + -0.051433, 0.121729, -0.057076, 0.023901, 0.045075, + -0.057182, 0.05478, -0.01728, -0.146674, 0.00209, + -0.016223, -0.044841, -0.084524, -0.152479, 0.072688, + -0.006962, 0.008711, 0.127455, -0.003876, 0.053162, + -0.013682, -0.025386, -0.000427, -0.024811, -0.024474, + -0.056267, 0.062116, -0.121311, -0.053011, 0.065651, + -0.075385, -0.00868, -0.063033, 0.083039, 0.110577, + -0.000152, -0.127017, 0.055904, 0.013659, 0.005664, + -0.002852, 0.047248, 0.001128, 0.100773, 0.037274, + 0.026368, -0.042205, 0.021887, -0.020247, -0.056678, + -0.077475, 0.089799, 0.058003, 0.039741, 0.106663, + -0.016853, -0.015972, 0.075741, -0.048829, 0.015374, + -0.032657, -0.125677, -0.06206, -0.057409, -0.061287, + 0.073151, 0.050357, 0.053547, -0.059886, -0.051298, + 0.057954, -0.003817, 0.076028, 0.006757, 0.061109, + -0.03803, 0.143209, 0.092207, -0.018493, 0.062291, + 0.005751, -0.036449, 0.067582, 0.031449, 0.101894, + -0.080754, 0.011515, -0.049485, -0.016137, -0.087818, + 0.108851, 0.038222, -0.099315, -0.003117, 0.052278, + 0.107517, -0.036233, 0.06537, 0.040409, -0.057029, + -0.033167, -0.081758, -0.019502, 0.033438, 0.013365, + -0.01776, -0.025906, -0.020244, -0.078722, -0.011697, + -0.028246, 0.068647, -0.106417, 0.026956, -0.064914, + 0.062711, -0.017857, 0.151539, 0.044613, -0.01782, + 0.009085, -0.032785, -0.025795, 0.07579, 0.075667, + -0.040398, 0.058556, -0.042634, 0.093973, -0.099529, + 0.057103, 0.073562, 0.01264, -0.066141, 0.029558, + 0.060219, -0.083699, -0.054799, -0.120442, -0.000374, + 0.006521, 0.034512, -0.039558, 0.042191, 0.033865, + 0.103992, -0.014977, -0.077384, -0.05134, 0.001873, + 0.047451, 0.140612, -0.024885, -0.02142, -0.046604, + 0.030606, 0.10066, 0.076356, -0.019288, -0.09857, + -0.114463, -0.010855, -0.034657, 0.025618, -0.003356, + -0.087913, 0.064346, -0.07554, -0.091569, -0.024965, + -0.021232, -0.017255, -0.056931, -0.003104, 0.030219, + -0.020112, -0.012334, 0.035298, 0.001405, 0.161753, + -0.064618, -0.064401, -0.007218, -0.00012, -0.047208, + 0.116105, -0.056464, -0.069645, -0.007032, -0.01209, + -0.023237, 0.016, -0.039802, 0.074319, -0.012604, + 0.014863, -0.058081, 0.093219, 0.062253, -0.040302, + 0.027405, -0.128683, 0.039923, 0.116808, -0.011706, + 0.012483, -0.017698, 0.003645, -0.007588, -0.120662, + -0.032868, 0.066217, -0.031343, -0.034166, 0.146334, + -0.031228, -0.125921, 0.117756, -0.042686, -0.062094, + 0.049375, -0.112262, 0.010166, -0.073599, 0.04869, + 0.028292, 0.020076, -0.062865, -0.106114, -0.0253, + 0.066916, 0.029279, 0.028191, -0.003599, -0.040614, + 0.020491, 0.060238, 0.052747, -0.01039, -0.022389, + -0.063358, -0.028707, 0.035907, -0.011898, 0.079703, + -0.003758, 0.078051, -0.017869, 0.009045, -0.018982, + 0.034974, 0.069405, -0.018909, -0.038613, 0.083909, + 0.033935, -0.036607, 0.088891, -0.052599, -0.059839, + 0.052758, -0.068308, -0.063615, 0.126093, -0.00946, + -0.042175, -0.011113, -0.073071, 0.052086, -0.052619, + 0.049226, 0.066898, -0.045666, 0.117923, 0.053656, + -0.010739, -0.043962, 0.141903, 0.001792, -0.035469, + 0.090671, 0.043993, -0.013655, 0.018989, 0.127223, + 0.00103, -0.001154, 0.081839, -0.024979, -0.103704, + -0.07792, 0.036083, 0.06822, -0.06221, 0.11373, + -0.010501, -0.065801, 0.050885, -0.104304, 0.121937, + 0.11185, 0.00968, -0.011791, 0.001677, -0.035029, + 0.010677, 0.024572, -0.01286, -0.030323, -0.010466, + 0.011279, 0.167752, 0.003136, 0.109709, 0.007292, + 0.000987, 0.004572, 0.108706, -0.113192, -0.012431, + -0.015225, 0.073653, -0.051275, 0.077928, -0.012752, + -0.011708, 0.014172, 0.025162, -0.095378, 0.026382, + -0.028889, -0.058569, -0.129329, 0.011087, 0.061452, + 0.056893, -0.058004, 0.103586, -0.060752, 0.081824, + -0.042805, -0.015991, -0.024444, 0.028952, -0.013528, + 0.042851, 0.019988, -0.165741, -0.031012, -0.014713, + -0.026059, 0.031698, -0.134343, 0.03209, 0.020828, + 0.051674, -0.128006, 0.050856, 0.02222, -0.073513, + -0.00934, 0.013756, 0.036163, 0.098407, -0.023495, + 0.023858, 0.008121, 0.02222, -0.103489, -0.046663, + -0.033, 0.063565, 0.029224, -0.012693, 0.084202, + 0.012187, -0.051, 0.026126, -0.043293, 0.008675, + -0.019812, -0.16507, -0.014555, -0.047431, 0.01799, + -0.040073, 0.107192, 0.022228, -0.089023, -0.066885, + 0.01463, 0.073186, 0.069902, 0.072634, 0.019593, + -0.041539, 0.031788, 0.09231, 0.027223, 0.034027, + -0.051855, 0.000391, 0.007869, 0.13191, 0.069384, + 0.046276, 0.04044, -0.037093, -0.031393, -0.112828, + 0.015709, 0.096749, -0.103205, -0.021284, 0.011405, + 0.158287, -0.021028, 0.042219, -0.050759, 0.069715, + -0.042907, -0.11698, 0.014224, 0.094648, 0.028395, + 0.041535, -0.057033, -0.047607, -0.024419, -0.034905, + 0.010125, 0.036728, -0.052503, -0.001839, -0.033477, + -0.053414, -0.070394, 0.092895, 0.1006, -0.026352, + 0.080574, -0.028763, -0.059548, 0.094571, 0.091787, + 0.041437, 0.014312, 0.045792, 0.108269, -0.081586, + 0.056288, 0.137447, 0.054718, -0.032474, 0.054502, + -0.100144, -0.00646, 0.024739, -0.117043, -0.008919, + 0.070299, -0.036862, -0.014543, 0.0245, -0.015222, + 0.114975, -0.043705, 0.000421, -0.061872, -0.035148, + -0.022797, 0.128575, -0.031798, -0.086718, -0.007172, + -0.071706, -0.006833, 0.028645, -0.007011, -0.096745, + -0.142269, 0.027996, 0.06521, 0.061381, 0.000741, + -0.140531, 0.01748, -0.014986, -0.040893, -0.012718, + -0.012494, -0.021869, -0.032923, 0.016456, 0.104475, + 0.010792, -0.066178, 0.019097, -0.001893, 0.067513, + -0.092673, -0.059851, -0.045936, 0.052642, -0.0625, + 0.065013, -0.025659, -0.149301, 0.051705, 0.035692, + -0.04579, -0.007482, -0.069141, 0.149365, -0.042039, + 0.018492, -0.081315, 0.05588, 0.058158, 0.019669, + 0.063836, -0.012391, 0.007057, 0.155454, 0.033854, + -0.016532, -0.007661, 0.043113, -0.080283, -0.10867, + -0.029344, 0.093781, -0.01584, -0.068134, 0.091804, + 0.004148, -0.058507, 0.059633, -0.095883, -0.004939, + 0.086151, -0.113571, -0.019466, -0.009167, 0.003662 +}; + +const struct lsp_codebook lsp_cbjmv[] = { + /* /Users/erdgeist/Coding/codec2/src/codebook/lspjmv1.txt */ + { + 10, + 9, + 512, + codes0 + }, + /* /Users/erdgeist/Coding/codec2/src/codebook/lspjmv2.txt */ + { + 5, + 9, + 512, + codes1 + }, + /* /Users/erdgeist/Coding/codec2/src/codebook/lspjmv3.txt */ + { + 5, + 9, + 512, + codes2 + }, + { 0, 0, 0, 0 } +}; diff --git a/codebookjvm.c b/codebookjvm.c deleted file mode 100644 index 86f5b83..0000000 --- a/codebookjvm.c +++ /dev/null @@ -1,1579 +0,0 @@ -/* THIS IS A GENERATED FILE. Edit generate_codebook.c and its input */ - -/* - * This intermediary file and the files that used to create it are under - * The LGPL. See the file COPYING. - */ - -#include "defines.h" - - /* codebook/lspjvm1.txt */ -static const float codes0[] = { - 0.435217, 0.668864, 1.0103, 1.22042, 1.50398, 1.78468, 2.13546, 2.35747, 2.61891, 2.73804, - 0.179285, 0.33316, 0.500638, 0.79695, 1.03999, 1.23497, 1.6523, 1.84823, 2.62556, 2.80497, - 0.268785, 0.356576, 0.595753, 1.04434, 1.24938, 1.42868, 1.68699, 1.86469, 2.33991, 2.5138, - 0.12007, 0.165585, 0.484694, 0.95916, 1.23753, 1.52915, 1.83751, 2.10773, 2.48749, 2.76685, - 0.150214, 0.229487, 0.62824, 0.961255, 1.33706, 1.59831, 1.91974, 2.21786, 2.53732, 2.75956, - 0.268624, 0.34598, 0.569637, 0.754737, 0.916538, 1.50854, 1.78635, 1.95442, 2.36953, 2.50182, - 0.246064, 0.468874, 0.662711, 0.890015, 1.14715, 1.51043, 1.78106, 2.09594, 2.65539, 2.80037, - 0.191631, 0.280628, 0.393229, 0.611761, 1.42017, 1.70774, 1.87303, 2.10155, 2.28035, 2.49949, - 0.361668, 0.507047, 0.789974, 1.04599, 1.50238, 1.67703, 1.90534, 2.16255, 2.43226, 2.59087, - 0.20816, 0.294285, 0.448634, 0.694229, 0.872517, 1.07032, 1.70335, 2.16874, 2.42619, 2.60366, - 0.316939, 0.513618, 0.705487, 0.917036, 1.17599, 1.31114, 1.6186, 2.03784, 2.45052, 2.5794, - 0.241068, 0.377728, 0.521595, 0.717203, 1.31041, 1.53999, 1.73643, 2.09893, 2.29792, 2.58735, - 0.234937, 0.281875, 0.780422, 1.44073, 1.60943, 1.75643, 1.97721, 2.14861, 2.60203, 2.7225, - 0.178679, 0.242672, 0.416988, 0.708348, 0.95562, 1.17667, 1.7818, 2.05449, 2.28159, 2.44811, - 0.345036, 0.42108, 0.740887, 1.16544, 1.32494, 1.4888, 1.76346, 1.90617, 2.39505, 2.64916, - 0.249586, 0.357494, 0.520747, 0.847195, 1.42841, 1.59778, 1.77819, 2.1785, 2.41344, 2.56466, - 0.295235, 0.574231, 1.2491, 1.4641, 1.72756, 1.92679, 2.09536, 2.28483, 2.56707, 2.72248, - 0.34193, 0.427307, 0.634001, 0.804212, 0.905629, 1.33337, 1.79033, 1.89276, 2.44582, 2.60283, - 0.363948, 0.508985, 0.667357, 0.946354, 1.43756, 1.62654, 1.81114, 2.03909, 2.29188, 2.43549, - 0.163514, 0.277407, 0.409207, 0.902065, 1.18907, 1.33964, 1.80241, 1.96077, 2.65293, 2.81899, - 0.302643, 0.359753, 0.651207, 1.20802, 1.4237, 1.54815, 1.88213, 2.01559, 2.26054, 2.5789, - 0.155928, 0.216908, 0.381812, 0.654803, 1.11237, 1.58993, 1.84756, 1.97672, 2.22408, 2.72534, - 0.274981, 0.347675, 0.572, 0.736046, 0.894248, 1.63237, 1.89139, 2.05689, 2.6029, 2.72178, - 0.154496, 0.243461, 0.348174, 0.689505, 1.57381, 1.70031, 1.94318, 2.10158, 2.56466, 2.77317, - 0.292612, 0.466612, 0.795936, 1.04747, 1.41369, 1.75085, 2.06289, 2.34007, 2.61361, 2.76949, - 0.242896, 0.3615, 0.555859, 0.793597, 0.932291, 1.40947, 1.86386, 2.00953, 2.4645, 2.67749, - 0.221646, 0.344724, 0.554564, 0.729403, 1.13657, 1.30177, 1.52918, 2.16359, 2.39582, 2.61081, - 0.160969, 0.224467, 0.371545, 0.626879, 1.16095, 1.44423, 1.67597, 1.87978, 2.47859, 2.67202, - 0.214172, 0.341585, 0.676575, 0.977397, 1.32543, 1.7201, 2.07259, 2.36954, 2.63528, 2.77879, - 0.203311, 0.289438, 0.458739, 0.914153, 1.12288, 1.30292, 1.58384, 1.88683, 2.18787, 2.42704, - 0.280383, 0.3716, 0.824827, 1.10025, 1.23623, 1.39892, 1.57804, 2.016, 2.36897, 2.50673, - 0.170627, 0.251778, 0.393686, 0.608347, 1.2876, 1.44667, 1.79328, 2.03655, 2.31015, 2.75244, - 0.18058, 0.288746, 0.987854, 1.43171, 1.67722, 1.91566, 2.12494, 2.28945, 2.58961, 2.75426, - 0.176335, 0.266263, 0.445421, 0.706403, 0.875402, 1.42292, 1.75867, 1.96091, 2.41068, 2.60175, - 0.216173, 0.287404, 0.480696, 1.00977, 1.2913, 1.47664, 1.89558, 2.06429, 2.28406, 2.48311, - 0.176523, 0.273934, 0.403407, 0.966139, 1.30472, 1.43661, 1.94473, 2.08484, 2.54446, 2.76242, - 0.311836, 0.550501, 0.879591, 1.09623, 1.27666, 1.47786, 1.81771, 2.15434, 2.56047, 2.77984, - 0.179765, 0.25056, 0.455939, 1.02389, 1.22513, 1.47566, 1.73462, 1.91871, 2.14734, 2.43824, - 0.271033, 0.457235, 0.599622, 0.821049, 0.940125, 1.20094, 1.84972, 1.98666, 2.54817, 2.75158, - 0.179326, 0.248002, 0.426405, 0.81706, 1.28589, 1.56502, 2.11736, 2.29871, 2.5724, 2.7527, - 0.374409, 0.535936, 0.897009, 1.18507, 1.59157, 1.7572, 1.96794, 2.17999, 2.45739, 2.62264, - 0.185472, 0.282752, 0.409439, 0.657499, 0.856446, 1.0294, 1.87993, 2.06932, 2.34474, 2.7531, - 0.375964, 0.578457, 0.758945, 0.929339, 1.12748, 1.25944, 1.70411, 2.12297, 2.33603, 2.4983, - 0.225641, 0.36103, 0.501679, 0.783379, 1.31485, 1.45262, 1.71415, 1.98716, 2.2257, 2.72436, - 0.144996, 0.252919, 0.632145, 1.22604, 1.57534, 1.90155, 2.17148, 2.39055, 2.68229, 2.80983, - 0.172022, 0.263338, 0.448634, 0.729435, 0.984007, 1.1716, 1.75705, 1.99023, 2.32131, 2.77121, - 0.235731, 0.351117, 0.796871, 1.05571, 1.30022, 1.59182, 1.89587, 2.12292, 2.41789, 2.59982, - 0.254053, 0.319371, 0.455623, 1.08614, 1.66467, 1.91588, 2.05908, 2.23342, 2.45204, 2.58679, - 0.375538, 0.742993, 1.13991, 1.33776, 1.73556, 2.01391, 2.31501, 2.48343, 2.65158, 2.75521, - 0.247245, 0.481131, 0.710366, 0.897602, 1.12109, 1.27171, 1.78735, 2.1995, 2.42966, 2.74067, - 0.226103, 0.311441, 0.501648, 0.844424, 1.36282, 1.53134, 1.77747, 1.98993, 2.18749, 2.3585, - 0.195862, 0.296224, 0.609554, 0.783241, 1.24347, 1.44548, 1.63703, 2.02264, 2.48356, 2.64614, - 0.233302, 0.299441, 0.472792, 1.24946, 1.45788, 1.60186, 1.83143, 1.99372, 2.59719, 2.75543, - 0.168096, 0.224183, 0.3827, 0.596214, 1.06059, 1.29442, 1.60576, 1.84849, 2.3577, 2.56919, - 0.33005, 0.445912, 0.661713, 0.874446, 1.00079, 1.45297, 1.94399, 2.07692, 2.42388, 2.61236, - 0.226382, 0.287303, 0.517631, 0.806229, 1.30901, 1.88528, 2.16051, 2.28641, 2.52638, 2.66082, - 0.20317, 0.499314, 0.887358, 1.23507, 1.46292, 1.69826, 1.99932, 2.22922, 2.57161, 2.76669, - 0.307531, 0.378353, 0.573606, 0.712218, 0.850169, 1.309, 2.05909, 2.26382, 2.49794, 2.67682, - 0.276203, 0.51025, 0.6868, 0.902844, 1.2052, 1.32798, 1.71889, 2.03895, 2.25639, 2.69715, - 0.161948, 0.229115, 0.393619, 0.683613, 1.13781, 1.32269, 1.78372, 1.96158, 2.38907, 2.63608, - 0.201334, 0.276773, 0.468994, 0.967017, 1.47597, 1.63242, 1.96577, 2.19728, 2.48059, 2.70155, - 0.214587, 0.315421, 0.469498, 0.733397, 1.146, 1.27791, 1.72784, 2.22713, 2.44026, 2.68112, - 0.255602, 0.394609, 0.743393, 0.977796, 1.19908, 1.40597, 1.91834, 2.22483, 2.47919, 2.66339, - 0.245989, 0.352625, 0.517055, 0.80283, 1.55871, 1.79565, 1.94405, 2.13364, 2.33327, 2.47998, - 0.337423, 0.480433, 0.869036, 1.13957, 1.63076, 1.82296, 2.07484, 2.29261, 2.47913, 2.62532, - 0.220974, 0.35885, 0.57164, 0.752791, 0.937013, 1.15172, 1.6744, 2.06247, 2.55872, 2.78484, - 0.267518, 0.331708, 0.541111, 1.11655, 1.41112, 1.53287, 1.79295, 1.93352, 2.24894, 2.62864, - 0.084613, 0.105083, 0.297424, 0.916949, 1.2563, 1.56703, 1.88539, 2.18987, 2.52279, 2.7921, - 0.205328, 0.287223, 0.724462, 1.0324, 1.45771, 1.64217, 1.92563, 2.17552, 2.42964, 2.60549, - 0.232554, 0.338724, 0.502115, 0.859975, 1.04409, 1.24565, 1.80656, 1.99964, 2.26116, 2.45998, - 0.291638, 0.379172, 0.626072, 0.792796, 0.959124, 1.50489, 1.73447, 1.91961, 2.61436, 2.72271, - 0.191554, 0.263114, 0.426797, 0.610628, 1.07741, 1.82954, 2.02195, 2.21057, 2.42765, 2.61383, - 0.389151, 0.679476, 0.915414, 1.03664, 1.25085, 1.58661, 2.04097, 2.2815, 2.56794, 2.71882, - 0.2032, 0.30128, 0.470357, 0.668716, 0.851737, 0.980327, 1.57086, 2.03762, 2.28907, 2.69388, - 0.304064, 0.405934, 0.710274, 0.962705, 1.12882, 1.34167, 1.63505, 1.84538, 2.07992, 2.50751, - 0.171777, 0.240705, 0.409371, 0.786432, 1.2232, 1.37569, 1.69176, 1.86608, 2.35041, 2.49394, - 0.231251, 0.277994, 0.557867, 1.32582, 1.66035, 1.77948, 2.00714, 2.17232, 2.44046, 2.65231, - 0.188101, 0.259494, 0.412543, 0.624843, 0.839549, 1.0337, 1.63413, 1.93194, 2.24608, 2.42577, - 0.361304, 0.419465, 0.795676, 1.18461, 1.2968, 1.57845, 1.84175, 1.99736, 2.54054, 2.68714, - 0.274372, 0.338938, 0.492443, 0.963516, 1.50951, 1.70638, 1.86988, 2.07717, 2.26128, 2.44418, - 0.41599, 0.652103, 1.03129, 1.26955, 1.57275, 1.77297, 2.00466, 2.17527, 2.43061, 2.59655, - 0.242045, 0.370942, 0.534392, 0.763529, 1.00117, 1.12976, 1.68219, 2.14464, 2.32448, 2.7157, - 0.377438, 0.588168, 0.765394, 0.976873, 1.35665, 1.49009, 1.73797, 2.00677, 2.21369, 2.38997, - 0.191625, 0.284123, 0.405342, 1.01678, 1.43273, 1.54759, 1.81393, 1.95832, 2.47077, 2.64926, - 0.272672, 0.349555, 0.633911, 1.15223, 1.30394, 1.54764, 1.9195, 2.0477, 2.56278, 2.73058, - 0.168423, 0.23633, 0.421468, 0.831345, 1.08354, 1.55345, 1.88073, 2.0647, 2.37086, 2.63295, - 0.219318, 0.301481, 0.513617, 0.765086, 1.02602, 1.51465, 2.0482, 2.24857, 2.49981, 2.65707, - 0.232695, 0.347947, 0.495203, 0.71883, 1.42301, 1.72249, 1.87958, 2.16504, 2.42025, 2.58966, - 0.270284, 0.336865, 0.684929, 1.15579, 1.69042, 1.87674, 2.02736, 2.22618, 2.44675, 2.582, - 0.149701, 0.193747, 0.352019, 0.520123, 0.823974, 1.43475, 1.68659, 1.96115, 2.37091, 2.69307, - 0.254818, 0.412303, 0.601514, 0.771438, 1.17545, 1.37657, 1.53903, 1.93704, 2.40858, 2.56362, - 0.233713, 0.355886, 0.593725, 0.76288, 1.27148, 1.5639, 1.79752, 2.09469, 2.53863, 2.71173, - 0.179028, 0.237103, 0.396818, 1.04202, 1.63354, 1.76268, 2.12393, 2.32239, 2.58819, 2.75134, - 0.182027, 0.251039, 0.434581, 0.714302, 0.950997, 1.4379, 1.81357, 1.9691, 2.14588, 2.35397, - 0.501538, 0.692148, 0.84886, 1.07131, 1.35054, 1.48948, 1.84164, 2.10428, 2.34154, 2.51529, - 0.27453, 0.38147, 0.526682, 0.922143, 1.44495, 1.5736, 1.85877, 2.06675, 2.2848, 2.62682, - 0.360617, 0.583131, 0.979491, 1.25408, 1.48835, 1.79756, 2.21952, 2.48218, 2.74237, 2.86203, - 0.140913, 0.220301, 0.619552, 0.818307, 1.05243, 1.33997, 1.83073, 2.13395, 2.53638, 2.75113, - 0.293514, 0.391691, 0.79008, 0.96274, 1.16032, 1.5266, 1.80549, 2.04146, 2.36162, 2.56496, - 0.199542, 0.290571, 0.452891, 0.689515, 1.25853, 1.40988, 1.88624, 2.22813, 2.46568, 2.72665, - 0.29692, 0.356356, 0.784287, 0.99654, 1.14618, 1.62387, 1.8155, 2.0383, 2.60063, 2.7057, - 0.206451, 0.276025, 0.537547, 0.802572, 1.22041, 1.64206, 1.86363, 2.00198, 2.21534, 2.58538, - 0.33365, 0.464751, 0.653772, 0.966306, 1.10387, 1.3402, 1.7847, 1.91459, 2.47017, 2.68692, - 0.181861, 0.24487, 0.376456, 0.554383, 1.3299, 1.81044, 2.04784, 2.20232, 2.66086, 2.81706, - 0.450565, 0.647291, 0.951172, 1.22943, 1.51964, 1.68681, 2.04911, 2.26717, 2.50128, 2.6506, - 0.219996, 0.320591, 0.427747, 0.601183, 0.753448, 0.929578, 1.74198, 2.28579, 2.47263, 2.74957, - 0.333848, 0.423373, 0.658791, 1.0313, 1.22263, 1.36577, 1.90189, 2.1211, 2.29031, 2.53118, - 0.166064, 0.233902, 0.383355, 0.661806, 1.22657, 1.39968, 1.77127, 1.97454, 2.17349, 2.56634, - 0.189286, 0.243602, 0.390584, 1.38793, 1.58872, 1.76324, 2.09112, 2.31631, 2.59353, 2.75508, - 0.158404, 0.224878, 0.385, 0.668463, 0.942954, 1.41197, 1.70031, 1.82807, 2.0594, 2.69255, - 0.325989, 0.461263, 0.851471, 1.04571, 1.28403, 1.5162, 1.79734, 2.08839, 2.43767, 2.62721, - 0.223709, 0.28919, 0.632812, 0.858738, 1.5419, 1.74677, 1.93574, 2.18482, 2.40433, 2.58301, - 0.545842, 0.95242, 1.34082, 1.51684, 1.83888, 2.01289, 2.24497, 2.40317, 2.59228, 2.69112, - 0.238526, 0.349079, 0.494582, 0.987665, 1.17075, 1.34823, 1.46864, 2.29696, 2.64416, 2.78738, - 0.270857, 0.442003, 0.655998, 0.881913, 1.25925, 1.42836, 1.76987, 1.99853, 2.39559, 2.65284, - 0.154384, 0.211806, 0.489481, 0.997257, 1.24982, 1.54123, 1.77886, 1.9494, 2.31914, 2.62339, - 0.268258, 0.312888, 0.589114, 1.25863, 1.57271, 1.67543, 1.91278, 2.07046, 2.27993, 2.56423, - 0.170715, 0.224965, 0.374011, 0.540197, 1.16189, 1.49907, 1.92587, 2.08257, 2.24662, 2.46972, - 0.324358, 0.391989, 0.706816, 0.833614, 1.01573, 1.56899, 1.73598, 2.12707, 2.55841, 2.65387, - 0.178059, 0.258575, 0.374125, 0.536831, 1.33483, 1.79863, 1.98698, 2.18925, 2.43227, 2.6267, - 0.198857, 0.420955, 0.817664, 1.17836, 1.46674, 1.8213, 2.20733, 2.47441, 2.73828, 2.85119, - 0.188344, 0.324302, 0.470468, 0.790033, 0.934101, 1.18872, 1.88717, 2.05283, 2.44832, 2.63024, - 0.201295, 0.365646, 0.526513, 0.758388, 1.1401, 1.26733, 1.65017, 1.87934, 2.10289, 2.60029, - 0.135058, 0.169428, 0.307348, 0.50316, 1.01808, 1.44795, 1.81098, 2.134, 2.48028, 2.75985, - 0.178006, 0.26661, 0.390327, 0.928681, 1.50161, 1.62133, 1.87136, 2.02586, 2.58044, 2.7708, - 0.246182, 0.42429, 0.644023, 0.801168, 1.11488, 1.27776, 1.50332, 2.07489, 2.2957, 2.50138, - 0.322996, 0.430355, 0.6316, 1.0477, 1.22184, 1.42673, 1.90308, 2.03222, 2.51673, 2.70845, - 0.292994, 0.430599, 0.619178, 0.794567, 1.28303, 1.65282, 1.84084, 2.06995, 2.38538, 2.52825, - 0.525494, 0.787797, 1.12182, 1.38748, 1.67457, 1.93622, 2.22404, 2.39062, 2.63428, 2.74323, - 0.299504, 0.409196, 0.602235, 0.892336, 1.05643, 1.25377, 1.48914, 1.63988, 2.42748, 2.65037, - 0.423758, 0.52048, 0.758987, 1.04126, 1.17366, 1.42368, 1.81824, 1.93641, 2.363, 2.62664, - 0.155042, 0.247496, 0.641445, 0.954509, 1.22497, 1.46585, 1.83784, 2.09046, 2.4515, 2.71616, - 0.251949, 0.421094, 0.706797, 0.975659, 1.25991, 1.52007, 1.81631, 2.12202, 2.47491, 2.71667, - 0.21522, 0.302248, 0.730598, 0.896343, 1.14557, 1.37019, 1.70069, 2.02256, 2.28327, 2.48922, - 0.28523, 0.453559, 0.66367, 0.861526, 1.0116, 1.24742, 1.65598, 1.86129, 2.57894, 2.73133, - 0.162067, 0.219409, 0.373433, 0.544669, 1.1033, 1.59718, 1.92104, 2.1434, 2.4065, 2.66048, - 0.342367, 0.511499, 0.93135, 1.16322, 1.39365, 1.61115, 1.97277, 2.19442, 2.47077, 2.64926, - 0.25101, 0.364125, 0.560956, 0.746545, 1.01984, 1.17072, 1.53295, 2.28867, 2.57709, 2.72307, - 0.315001, 0.489412, 0.720682, 0.877607, 1.09047, 1.25385, 1.44822, 1.92295, 2.25589, 2.40863, - 0.174666, 0.235793, 0.387644, 0.554402, 1.23109, 1.45614, 1.68803, 2.12745, 2.36703, 2.59727, - 0.215113, 0.341915, 1.04372, 1.32275, 1.49541, 1.74189, 1.96116, 2.23982, 2.5449, 2.70394, - 0.219852, 0.30177, 0.513912, 0.705474, 0.87754, 1.2959, 1.699, 1.98706, 2.28797, 2.49697, - 0.290638, 0.366442, 0.655155, 1.04499, 1.17215, 1.53254, 1.80079, 1.94893, 2.50968, 2.66005, - 0.232252, 0.31377, 0.658552, 0.941977, 1.46317, 1.66549, 1.86246, 2.02784, 2.53402, 2.70124, - 0.326539, 0.552681, 1.12173, 1.33138, 1.52007, 1.86708, 2.08286, 2.33247, 2.60604, 2.73709, - 0.190254, 0.340428, 0.492777, 0.739738, 0.895461, 1.07937, 1.64316, 1.79529, 2.49182, 2.72938, - 0.283586, 0.41844, 0.587306, 0.870866, 1.41855, 1.57703, 1.7995, 2.0694, 2.27448, 2.4381, - 0.235752, 0.35765, 0.502891, 1.01243, 1.25885, 1.40779, 1.82006, 1.95583, 2.5059, 2.73433, - 0.278412, 0.343137, 0.849977, 1.2329, 1.3505, 1.59063, 1.78752, 2.09158, 2.54136, 2.66386, - 0.162966, 0.243159, 0.439238, 0.684821, 0.887783, 1.4629, 1.88174, 2.04425, 2.28939, 2.705, - 0.235063, 0.371799, 0.57821, 0.752199, 1.00855, 1.47628, 1.80491, 2.2714, 2.65504, 2.78965, - 0.154939, 0.223696, 0.344718, 0.667555, 1.49566, 1.66944, 2.06988, 2.30721, 2.62769, 2.81134, - 0.239702, 0.335917, 0.716616, 1.1318, 1.45251, 1.63913, 2.10552, 2.27982, 2.50203, 2.66922, - 0.226818, 0.331261, 0.472705, 0.651974, 0.781639, 1.2198, 1.8229, 2.08273, 2.43933, 2.6109, - 0.223413, 0.359594, 0.534704, 0.741518, 1.22589, 1.38987, 1.61819, 2.00991, 2.207, 2.45984, - 0.171308, 0.268378, 0.383799, 0.858926, 1.37629, 1.51917, 1.7806, 1.92291, 2.62309, 2.8024, - 0.140134, 0.21232, 0.443224, 0.967457, 1.26424, 1.56215, 1.92915, 2.21739, 2.66834, 2.83075, - 0.221323, 0.322124, 0.485563, 0.818589, 1.01184, 1.19898, 1.42362, 1.6694, 2.15752, 2.36319, - 0.369687, 0.525655, 0.719213, 0.939654, 1.13763, 1.31222, 1.59994, 1.82681, 2.35522, 2.58068, - 0.211975, 0.314411, 0.489148, 0.739213, 1.3778, 1.5545, 1.82437, 2.15887, 2.35299, 2.72262, - 0.170698, 0.296368, 0.934285, 1.24313, 1.5559, 1.86654, 2.15994, 2.36344, 2.58503, 2.73853, - 0.189263, 0.305887, 0.439912, 0.78461, 1.22726, 1.34251, 1.58765, 1.75491, 2.43989, 2.72131, - 0.296339, 0.385169, 0.612012, 1.08132, 1.27636, 1.43718, 1.87147, 2.00172, 2.33909, 2.64022, - 0.229588, 0.320544, 0.517278, 0.969137, 1.14256, 1.62609, 1.87792, 2.11546, 2.54674, 2.70802, - 0.248869, 0.420193, 0.732388, 1.04902, 1.30341, 1.60146, 1.94921, 2.23946, 2.64822, 2.82261, - 0.2076, 0.29232, 0.496539, 0.857149, 1.18229, 1.39985, 1.71416, 1.86824, 2.02794, 2.20074, - 0.225558, 0.396897, 0.541783, 0.873366, 1.17897, 1.29958, 1.67719, 1.8496, 2.33048, 2.75272, - 0.176821, 0.231377, 0.372767, 0.508565, 1.15282, 1.80805, 2.11268, 2.25007, 2.57134, 2.74855, - 0.352149, 0.515765, 1.02324, 1.26022, 1.44357, 1.62207, 1.8728, 2.10018, 2.48928, 2.67104, - 0.166138, 0.263444, 0.370151, 0.590066, 0.754819, 0.940533, 1.76187, 1.94661, 2.44501, 2.75819, - 0.342082, 0.476411, 0.656223, 0.851774, 1.00399, 1.15337, 1.6944, 2.06562, 2.25564, 2.44015, - 0.227237, 0.376514, 0.514329, 0.894887, 1.14167, 1.28305, 1.83138, 1.9859, 2.33447, 2.78488, - 0.215891, 0.269548, 0.684111, 1.40566, 1.67481, 1.80093, 2.17209, 2.3394, 2.59157, 2.7301, - 0.23624, 0.400377, 0.533684, 0.750343, 0.910405, 1.08911, 1.73773, 1.91281, 2.19252, 2.68873, - 0.169242, 0.284879, 0.916252, 1.16977, 1.43368, 1.64438, 1.91912, 2.16162, 2.48266, 2.68259, - 0.270731, 0.336506, 0.477594, 1.04271, 1.60584, 1.79686, 1.94591, 2.16004, 2.35491, 2.52095, - 0.420586, 0.652563, 1.11716, 1.40601, 1.74754, 1.94742, 2.20309, 2.35997, 2.5479, 2.68217, - 0.281552, 0.395037, 0.640181, 0.944531, 1.19396, 1.33049, 1.71866, 2.18839, 2.44459, 2.57867, - 0.311824, 0.476892, 0.633431, 0.845825, 1.33252, 1.49166, 1.69361, 2.04108, 2.28932, 2.4394, - 0.133945, 0.20079, 0.647237, 0.927687, 1.18888, 1.36966, 1.69956, 1.97278, 2.29526, 2.67818, - 0.204796, 0.278215, 0.443465, 1.27048, 1.40521, 1.64092, 1.82425, 2.32709, 2.59964, 2.77253, - 0.18397, 0.244116, 0.410594, 0.639103, 1.22159, 1.40487, 1.62836, 1.90244, 2.16863, 2.3068, - 0.343622, 0.434735, 0.666599, 0.868069, 1.04894, 1.53278, 1.81983, 1.97188, 2.2887, 2.44875, - 0.238017, 0.320361, 0.657255, 0.917611, 1.30331, 1.72736, 1.98891, 2.18145, 2.44297, 2.61332, - 0.323613, 0.545056, 0.930173, 1.22606, 1.44018, 1.7723, 2.05689, 2.34781, 2.68938, 2.82062, - 0.28893, 0.401387, 0.617124, 0.836453, 0.990306, 1.26123, 1.91328, 2.11005, 2.32458, 2.55716, - 0.33267, 0.480804, 0.656147, 0.880536, 1.02957, 1.23049, 1.76906, 1.9323, 2.20037, 2.58521, - 0.185551, 0.265352, 0.409432, 0.608847, 1.0347, 1.22282, 1.87697, 2.17165, 2.4035, 2.66644, - 0.155026, 0.223348, 0.401684, 1.07914, 1.41579, 1.62002, 2.04552, 2.25851, 2.63162, 2.80229, - 0.183461, 0.263081, 0.425694, 0.635685, 1.18866, 1.35756, 1.57499, 2.08598, 2.28872, 2.51111, - 0.314738, 0.463011, 0.648733, 0.877651, 1.00289, 1.26581, 2.00541, 2.1981, 2.48153, 2.71418, - 0.244411, 0.318444, 0.546578, 0.793615, 1.32615, 1.73548, 1.9456, 2.11466, 2.31535, 2.47853, - 0.326237, 0.54354, 0.987361, 1.30441, 1.68493, 1.90215, 2.20717, 2.37427, 2.55753, 2.71622, - 0.157795, 0.283302, 0.430398, 0.660379, 0.81106, 1.14254, 1.4793, 1.71871, 2.67026, 2.84756, - 0.220856, 0.283872, 0.779935, 1.07494, 1.31221, 1.62633, 1.83761, 1.96888, 2.15599, 2.60238, - 0.140763, 0.205719, 0.406561, 0.762459, 1.04127, 1.48699, 1.83831, 2.11461, 2.55281, 2.77228, - 0.140451, 0.39592, 0.79211, 1.108, 1.40264, 1.62308, 1.94315, 2.22795, 2.54616, 2.774, - 0.229862, 0.336462, 0.54659, 0.81015, 1.20191, 1.34679, 1.82532, 2.09293, 2.28573, 2.47336, - 0.224913, 0.328246, 0.517269, 0.874793, 1.01259, 1.45218, 1.69578, 2.01493, 2.51145, 2.67257, - 0.247745, 0.335741, 0.546558, 0.710177, 1.17056, 1.72779, 1.97068, 2.15853, 2.48282, 2.62891, - 0.398252, 0.555087, 0.890367, 1.1212, 1.38153, 1.60123, 1.86665, 2.06661, 2.40516, 2.58802, - 0.198563, 0.288867, 0.478054, 0.658477, 0.851841, 1.0271, 1.53974, 2.02111, 2.57946, 2.78418, - 0.304271, 0.371642, 0.66159, 1.06898, 1.22425, 1.41193, 1.68052, 1.86977, 2.10007, 2.30855, - 0.188223, 0.257939, 0.432402, 0.73505, 1.31804, 1.48553, 1.82811, 2.04644, 2.30702, 2.45724, - 0.246723, 0.297276, 0.604475, 1.3109, 1.57044, 1.68885, 1.91366, 2.05133, 2.55601, 2.71497, - 0.158309, 0.234509, 0.435792, 0.6679, 0.957567, 1.23592, 1.59294, 1.81816, 2.30739, 2.76897, - 0.419843, 0.501412, 0.766892, 1.07317, 1.18937, 1.48022, 1.7666, 1.92215, 2.53794, 2.69477, - 0.27514, 0.335563, 0.678421, 1.08152, 1.59238, 1.77263, 1.93124, 2.1407, 2.3338, 2.49086, - 0.372056, 0.856814, 1.23954, 1.40999, 1.6903, 1.86302, 2.0727, 2.27355, 2.53266, 2.69052, - 0.321254, 0.422981, 0.604856, 0.793437, 0.912112, 1.12845, 1.79598, 2.17323, 2.36015, 2.53614, - 0.395214, 0.598779, 0.771997, 0.946713, 1.21378, 1.33043, 1.66033, 1.97715, 2.16506, 2.34402, - 0.225286, 0.317828, 0.464801, 1.11233, 1.36951, 1.512, 1.92195, 2.05341, 2.59352, 2.77729, - 0.330612, 0.407807, 0.730129, 1.25973, 1.45981, 1.60567, 1.98131, 2.13701, 2.46597, 2.67972, - 0.213145, 0.305305, 0.507016, 0.662299, 1.05685, 1.47986, 1.6719, 2.10271, 2.36987, 2.58199, - 0.219658, 0.296096, 0.443507, 0.610973, 0.799691, 1.67658, 1.96549, 2.15323, 2.50223, 2.693, - 0.174947, 0.257739, 0.373547, 0.552567, 1.40532, 1.61425, 1.84892, 2.11779, 2.31788, 2.7119, - 0.209667, 0.297529, 0.756195, 1.0953, 1.5642, 1.84477, 2.1037, 2.29266, 2.52005, 2.67949, - 0.170138, 0.24031, 0.452247, 0.684414, 0.880102, 1.36692, 1.74165, 2.13129, 2.50573, 2.73261, - 0.278164, 0.468635, 0.707518, 0.853693, 1.05478, 1.21046, 1.54094, 2.17456, 2.41066, 2.61214, - 0.155738, 0.23889, 0.352836, 0.621012, 1.44144, 1.6197, 1.82517, 1.97533, 2.52537, 2.74857, - 0.223776, 0.274424, 0.479048, 0.797871, 1.69419, 1.87813, 2.13528, 2.37373, 2.59542, 2.72979, - 0.151088, 0.198286, 0.326558, 0.536276, 0.845893, 1.14165, 1.46056, 1.76287, 2.02585, 2.1773, - 0.434445, 0.614208, 0.887657, 1.02845, 1.19136, 1.3922, 1.78689, 2.06248, 2.4234, 2.61936, - 0.180755, 0.275311, 0.397787, 0.859366, 1.40976, 1.52332, 1.90885, 2.08232, 2.38972, 2.74389, - 0.275975, 0.508416, 0.889894, 1.31893, 1.63331, 1.90473, 2.16901, 2.37466, 2.72697, 2.84767, - 0.156239, 0.262624, 0.406657, 0.739074, 1.04449, 1.20123, 1.81089, 2.0056, 2.5817, 2.80489, - 0.195391, 0.258771, 0.654924, 0.824371, 1.31526, 1.50073, 1.76594, 2.06399, 2.34118, 2.51366, - 0.178034, 0.301047, 0.46302, 0.716172, 1.19887, 1.34045, 1.83456, 2.02213, 2.40075, 2.77629, - 0.340368, 0.404236, 0.843747, 1.03924, 1.20211, 1.70805, 1.91495, 2.16951, 2.52152, 2.62335, - 0.218465, 0.289694, 0.528045, 0.817051, 1.13234, 1.58046, 1.83889, 1.98339, 2.14749, 2.34813, - 0.322509, 0.458058, 0.654679, 0.958976, 1.11821, 1.32157, 1.90139, 2.04641, 2.36093, 2.66422, - 0.191821, 0.252321, 0.389176, 0.581111, 1.52967, 1.93169, 2.08361, 2.27046, 2.56685, 2.71388, - 0.493961, 0.710827, 0.98226, 1.19627, 1.41933, 1.62091, 1.92801, 2.14565, 2.42977, 2.60197, - 0.213148, 0.311589, 0.424636, 0.602664, 0.736895, 1.02216, 1.99228, 2.21853, 2.61163, 2.85032, - 0.288129, 0.434441, 0.629313, 0.856153, 1.28967, 1.42452, 1.8758, 2.15024, 2.35181, 2.53684, - 0.160031, 0.230716, 0.406654, 0.870424, 1.15652, 1.39232, 1.8041, 1.95144, 2.21048, 2.73516, - 0.22934, 0.293962, 0.503222, 1.2421, 1.47582, 1.62465, 1.99868, 2.1445, 2.57855, 2.75327, - 0.15877, 0.220035, 0.363386, 0.577761, 0.96309, 1.17494, 1.73817, 1.9792, 2.16244, 2.66192, - 0.346062, 0.444816, 0.716985, 1.18072, 1.37058, 1.523, 1.89217, 2.06668, 2.3958, 2.62766, - 0.307495, 0.38933, 0.612607, 0.969283, 1.55771, 1.83994, 1.99674, 2.17238, 2.42063, 2.5392, - 0.437804, 0.726957, 1.29117, 1.5033, 1.76543, 1.96212, 2.16365, 2.33623, 2.57962, 2.70852, - 0.232184, 0.333678, 0.528368, 0.706749, 1.20328, 1.37902, 1.61116, 2.15468, 2.5929, 2.75032, - 0.272652, 0.46171, 0.625777, 0.839609, 1.34202, 1.49673, 1.71538, 2.13757, 2.37004, 2.59739, - 0.184908, 0.302324, 0.454883, 0.880307, 1.10438, 1.29253, 1.7772, 1.94336, 2.44417, 2.62273, - 0.265644, 0.341261, 0.553228, 1.13947, 1.42715, 1.56044, 1.93394, 2.08413, 2.39331, 2.65413, - 0.16792, 0.207301, 0.370331, 0.525538, 1.03089, 1.36816, 1.78247, 2.0624, 2.33276, 2.5263, - 0.343172, 0.433912, 0.717501, 0.889734, 1.05206, 1.69528, 2.05316, 2.20846, 2.60887, 2.71832, - 0.216527, 0.305247, 0.44589, 0.729271, 1.63974, 1.90328, 2.05335, 2.22125, 2.43225, 2.56802, - 0.110545, 0.209955, 0.844788, 1.1742, 1.4922, 1.81024, 2.17727, 2.4405, 2.69729, 2.83523, - 0.217384, 0.337412, 0.488999, 0.761842, 0.879715, 1.20953, 1.97075, 2.1208, 2.61165, 2.79176, - 0.190459, 0.296484, 0.469967, 0.800649, 1.10556, 1.27853, 1.51694, 1.69307, 2.11442, 2.71674, - 0.134814, 0.175978, 0.300425, 0.496817, 1.2443, 1.48531, 1.86172, 2.13123, 2.48505, 2.77388, - 0.210174, 0.278266, 0.435508, 0.927538, 1.60691, 1.7539, 1.95755, 2.16628, 2.39852, 2.74961, - 0.213766, 0.3153, 0.509924, 0.70993, 0.964724, 1.10678, 1.38261, 2.00107, 2.32321, 2.56531, - 0.400615, 0.524954, 0.798552, 1.01285, 1.13549, 1.47485, 1.98903, 2.13091, 2.50797, 2.67946, - 0.2494, 0.377023, 0.519635, 0.754227, 1.45956, 1.64276, 1.82896, 2.07788, 2.29823, 2.46753, - 0.473365, 0.683973, 1.05234, 1.37583, 1.54811, 1.74759, 2.1393, 2.31877, 2.60998, 2.73925, - 0.203877, 0.341791, 0.48518, 0.884069, 1.09759, 1.26953, 1.47992, 1.75788, 2.6484, 2.82239, - 0.273046, 0.404254, 0.555403, 0.954547, 1.29123, 1.39902, 1.72289, 1.90344, 2.17198, 2.64531, - 0.040369, 0.117266, 0.617136, 0.892043, 1.26033, 1.54165, 1.85938, 2.1531, 2.49823, 2.76189, - 0.132414, 0.211358, 0.742445, 1.06686, 1.33108, 1.57079, 1.86746, 2.13253, 2.47962, 2.73108, - 0.237329, 0.326529, 0.612538, 0.790663, 0.990133, 1.41374, 1.73823, 1.93691, 2.16773, 2.45163, - 0.27396, 0.405794, 0.57253, 0.933672, 1.05782, 1.39795, 1.85653, 1.99755, 2.59949, 2.76004, - 0.199334, 0.29838, 0.442931, 0.628638, 1.30321, 1.64014, 1.80402, 2.11302, 2.37545, 2.54895, - 0.350188, 0.50201, 0.821298, 1.03864, 1.36929, 1.5924, 1.91082, 2.15649, 2.46051, 2.65326, - 0.281558, 0.399892, 0.573105, 0.753299, 0.900613, 1.05457, 1.58199, 2.17844, 2.43035, 2.61604, - 0.344653, 0.543532, 0.703715, 0.862285, 1.19822, 1.33821, 1.57908, 2.06077, 2.30675, 2.48575, - 0.220701, 0.326795, 0.520618, 0.755133, 1.29555, 1.45189, 1.6905, 2.20005, 2.41427, 2.61591, - 0.279478, 0.332193, 0.801527, 1.34597, 1.48748, 1.6785, 1.9222, 2.10002, 2.58557, 2.71339, - 0.163502, 0.212169, 0.365096, 0.525464, 0.869846, 1.20881, 1.79399, 2.04031, 2.29718, 2.4698, - 0.285531, 0.341488, 0.754059, 1.17002, 1.30084, 1.5137, 1.69986, 1.88992, 2.58146, 2.70687, - 0.249595, 0.366997, 0.626427, 0.945219, 1.40704, 1.56056, 1.83166, 2.23115, 2.46635, 2.65452, - 0.271671, 0.443136, 1.15641, 1.40646, 1.67652, 1.85648, 2.06322, 2.2305, 2.47584, 2.63958, - 0.28662, 0.427806, 0.63732, 0.803409, 0.996161, 1.26638, 1.68175, 2.00397, 2.39465, 2.58855, - 0.314906, 0.440519, 0.612129, 0.896126, 1.47241, 1.71769, 1.88135, 2.09944, 2.36917, 2.49547, - 0.170277, 0.25127, 0.405477, 0.915641, 1.12689, 1.43663, 1.71477, 1.8932, 2.55299, 2.73852, - 0.27941, 0.337137, 0.734563, 1.28105, 1.4806, 1.61188, 1.85321, 1.99488, 2.41605, 2.65483, - 0.165776, 0.226083, 0.417544, 0.744574, 1.04447, 1.53489, 1.80849, 1.94495, 2.13849, 2.60179, - 0.264579, 0.336652, 0.542033, 0.71019, 0.913338, 1.65575, 1.81776, 2.23196, 2.52444, 2.65852, - 0.158194, 0.235588, 0.338347, 0.541657, 1.58338, 1.76629, 2.00914, 2.24334, 2.50394, 2.77516, - 0.332612, 0.50962, 0.822935, 1.07588, 1.45429, 1.65079, 1.97445, 2.25128, 2.53734, 2.74512, - 0.262817, 0.359709, 0.520893, 0.707667, 0.818364, 1.43885, 1.97125, 2.08767, 2.49701, 2.64644, - 0.2332, 0.399599, 0.612456, 0.775547, 1.19919, 1.35576, 1.6469, 2.13625, 2.34249, 2.69574, - 0.149687, 0.238538, 0.372248, 0.63452, 1.25581, 1.43379, 1.77004, 1.92875, 2.61191, 2.82493, - 0.137016, 0.210297, 0.591489, 1.12545, 1.37565, 1.6853, 2.08961, 2.39089, 2.70446, 2.84443, - 0.21349, 0.341024, 0.541716, 0.750061, 1.0882, 1.24458, 1.55534, 1.96557, 2.1879, 2.38371, - 0.300159, 0.489291, 0.825022, 1.0371, 1.19409, 1.34738, 1.68475, 2.02494, 2.46561, 2.74097, - 0.170029, 0.255033, 0.392758, 0.727117, 1.38207, 1.57968, 1.80091, 1.95907, 2.28234, 2.7288, - 0.175883, 0.365509, 1.11217, 1.38587, 1.72039, 1.97781, 2.2453, 2.42161, 2.62957, 2.754, - 0.16259, 0.248164, 0.45463, 0.763209, 0.966031, 1.28234, 1.73074, 1.93805, 2.47938, 2.66756, - 0.258043, 0.345866, 0.55652, 0.981312, 1.36153, 1.48238, 1.87224, 2.15823, 2.36227, 2.55503, - 0.234139, 0.348843, 0.528234, 0.987884, 1.19522, 1.42215, 1.96003, 2.12737, 2.60332, 2.793, - 0.179699, 0.559209, 0.867682, 1.08884, 1.31689, 1.5715, 1.9222, 2.19739, 2.50112, 2.72868, - 0.216784, 0.310791, 0.487492, 0.932903, 1.20195, 1.36655, 1.8004, 1.9775, 2.17426, 2.53707, - 0.186878, 0.400655, 0.580952, 0.846287, 1.10387, 1.26678, 1.84277, 2.01959, 2.488, 2.71722, - 0.164641, 0.248712, 0.389358, 0.772822, 1.21256, 1.36992, 2.02587, 2.27762, 2.61752, 2.80953, - 0.351899, 0.520326, 0.926597, 1.21965, 1.50984, 1.67684, 1.92174, 2.11125, 2.35638, 2.54593, - 0.242182, 0.365285, 0.506156, 0.71602, 0.865221, 1.01169, 1.78692, 2.12298, 2.35088, 2.76773, - 0.413776, 0.559566, 0.7358, 0.928997, 1.07912, 1.26718, 1.88007, 2.15249, 2.32483, 2.53986, - 0.210597, 0.329568, 0.469735, 0.78859, 1.21549, 1.31981, 1.71146, 2.05899, 2.24544, 2.65373, - 0.197937, 0.254148, 0.477985, 1.22709, 1.62992, 1.76743, 2.18698, 2.3851, 2.59487, 2.72554, - 0.205489, 0.333855, 0.523915, 0.706275, 1.10215, 1.24661, 1.6489, 2.02683, 2.28169, 2.75931, - 0.230328, 0.322431, 0.861834, 1.14561, 1.34721, 1.57611, 1.80728, 2.00482, 2.35437, 2.57225, - 0.224898, 0.282022, 0.506636, 1.1523, 1.62656, 1.75209, 2.02818, 2.21882, 2.48896, 2.67046, - 0.313732, 0.625469, 1.16447, 1.49908, 1.74961, 2.01853, 2.26223, 2.4296, 2.69216, 2.8225, - 0.375623, 0.575307, 0.7912, 0.93577, 1.09694, 1.34339, 1.80799, 2.18731, 2.51972, 2.6948, - 0.236981, 0.332412, 0.47927, 0.844461, 1.34764, 1.49073, 1.68394, 2.03914, 2.29762, 2.45843, - 0.129047, 0.20625, 0.636751, 0.865101, 1.13689, 1.35661, 1.7048, 1.91668, 2.51836, 2.75632, - 0.195171, 0.266517, 0.414793, 1.23956, 1.45291, 1.60836, 1.83305, 2.0478, 2.47352, 2.62199, - 0.165853, 0.21272, 0.372757, 0.536136, 1.01394, 1.33963, 1.55512, 1.94574, 2.23628, 2.44095, - 0.256981, 0.368868, 0.635878, 0.802543, 1.08476, 1.43912, 1.81473, 2.12052, 2.45815, 2.62146, - 0.214382, 0.297135, 0.445091, 0.70205, 1.3651, 1.85126, 2.06703, 2.2073, 2.47073, 2.61243, - 0.34071, 0.532103, 0.935278, 1.17102, 1.37789, 1.6386, 1.96527, 2.24616, 2.63127, 2.80634, - 0.310524, 0.412051, 0.582478, 0.768755, 0.871594, 1.11985, 1.92635, 2.20751, 2.40709, 2.63663, - 0.249349, 0.443517, 0.631532, 0.810096, 1.20513, 1.35721, 1.6074, 1.98416, 2.20802, 2.64511, - 0.14309, 0.185312, 0.325214, 0.504, 1.13447, 1.32791, 1.67365, 2.0069, 2.38928, 2.74609, - 0.226575, 0.298946, 0.453938, 0.998061, 1.3946, 1.59728, 2.06418, 2.22325, 2.42547, 2.56946, - 0.183924, 0.255181, 0.415834, 0.624247, 1.04234, 1.20308, 1.55524, 2.12531, 2.40035, 2.66192, - 0.27561, 0.365968, 0.654909, 0.990108, 1.1708, 1.45533, 2.07756, 2.25267, 2.50232, 2.68595, - 0.204334, 0.287844, 0.39481, 0.761295, 1.5012, 1.78471, 1.93557, 2.15283, 2.34926, 2.54564, - 0.342976, 0.527539, 0.917466, 1.16059, 1.49953, 1.76183, 2.09527, 2.30187, 2.54057, 2.69469, - 0.202374, 0.333367, 0.480179, 0.708677, 0.819505, 1.10529, 1.80664, 1.95335, 2.61084, 2.7975, - 0.307033, 0.368471, 0.602486, 1.10861, 1.41335, 1.52864, 1.79852, 1.98614, 2.16905, 2.43726, - 0.144073, 0.196932, 0.386988, 0.819061, 1.28977, 1.62507, 1.90192, 2.13611, 2.48302, 2.70797, - 0.17676, 0.268627, 0.662082, 1.05687, 1.54797, 1.71139, 1.97294, 2.24991, 2.54447, 2.76109, - 0.191409, 0.292985, 0.492193, 0.800526, 1.04184, 1.27855, 1.83663, 2.02868, 2.24939, 2.62778, - 0.324102, 0.399146, 0.687435, 0.868704, 1.02296, 1.58208, 1.85385, 1.98188, 2.55491, 2.67706, - 0.229172, 0.302836, 0.481418, 0.704363, 0.967567, 1.82827, 2.0973, 2.25847, 2.54911, 2.70465, - 0.467124, 0.696788, 0.9395, 1.09499, 1.27754, 1.4885, 1.89628, 2.15847, 2.47418, 2.65999, - 0.175418, 0.234039, 0.367674, 0.513586, 0.747619, 1.0084, 1.58316, 2.05311, 2.36329, 2.68115, - 0.410273, 0.561949, 0.736215, 0.956685, 1.13569, 1.28842, 1.75061, 1.93771, 2.15132, 2.48934, - 0.204541, 0.277613, 0.529607, 0.722971, 1.19998, 1.44734, 1.71563, 1.92105, 2.35778, 2.50749, - 0.253116, 0.311907, 0.696982, 1.32008, 1.57542, 1.70532, 2.00507, 2.16867, 2.46188, 2.66505, - 0.163657, 0.237902, 0.393374, 0.60949, 0.854272, 1.08998, 1.52639, 1.84234, 2.12625, 2.67905, - 0.448627, 0.530664, 0.812719, 1.0952, 1.20764, 1.57541, 1.88421, 2.0343, 2.55301, 2.68835, - 0.262717, 0.338748, 0.512685, 1.00354, 1.48018, 1.62208, 1.82852, 2.14242, 2.35646, 2.51153, - 0.417111, 0.636688, 1.03657, 1.31988, 1.67992, 1.87339, 2.07372, 2.2494, 2.50773, 2.65105, - 0.263698, 0.461151, 0.618737, 0.830471, 1.00404, 1.15887, 1.80157, 2.02022, 2.30656, 2.74304, - 0.387779, 0.575108, 0.729791, 0.932981, 1.36116, 1.50516, 1.75118, 2.06847, 2.33826, 2.48764, - 0.18151, 0.265666, 0.454631, 1.08238, 1.2873, 1.5792, 1.85118, 2.09696, 2.46724, 2.64693, - 0.277668, 0.345119, 0.602341, 1.1792, 1.37899, 1.54562, 1.81386, 1.96259, 2.4918, 2.66445, - 0.17932, 0.24808, 0.456925, 0.722589, 1.12693, 1.57945, 1.7994, 1.95067, 2.48412, 2.70724, - 0.314322, 0.381145, 0.608651, 0.727613, 0.890472, 1.61028, 2.13617, 2.25836, 2.59638, 2.70978, - 0.189539, 0.266068, 0.419729, 0.651693, 1.41016, 1.64311, 1.85481, 2.27558, 2.49205, 2.72201, - 0.254466, 0.313038, 0.594149, 1.01254, 1.68881, 1.93546, 2.11918, 2.28787, 2.53554, 2.66793, - 0.134691, 0.171906, 0.30274, 0.492936, 0.899551, 1.22919, 1.73394, 2.01288, 2.44634, 2.74276, - 0.231556, 0.365068, 0.680761, 0.889142, 1.11134, 1.2959, 1.54264, 1.97178, 2.42756, 2.63191, - 0.222525, 0.305606, 0.527193, 0.687519, 1.18138, 1.67176, 1.86368, 2.07202, 2.63452, 2.77927, - 0.17877, 0.237415, 0.37516, 0.856692, 1.67368, 1.81374, 2.01679, 2.27242, 2.5226, 2.73596, - 0.193532, 0.268731, 0.451328, 0.753471, 0.984854, 1.28535, 1.68565, 1.88412, 2.09168, 2.24342, - 0.476037, 0.65161, 0.801054, 1.01016, 1.24137, 1.35584, 1.77598, 2.08615, 2.27291, 2.45435, - 0.211657, 0.308331, 0.421366, 0.865966, 1.41877, 1.55674, 1.78615, 2.02033, 2.19859, 2.63198, - 0.203789, 0.490794, 1.01014, 1.27501, 1.47221, 1.81014, 2.17064, 2.43766, 2.66212, 2.78806, - 0.174355, 0.252095, 0.674715, 0.842194, 1.05509, 1.278, 1.69868, 2.07056, 2.39938, 2.65743, - 0.245109, 0.324049, 0.628822, 0.92791, 1.1236, 1.58007, 1.87864, 2.0546, 2.35872, 2.54684, - 0.182644, 0.253804, 0.386248, 0.614056, 1.36482, 1.54588, 2.04017, 2.21883, 2.41901, 2.62461, - 0.295605, 0.367794, 0.690701, 1.05516, 1.1866, 1.64445, 1.94415, 2.10144, 2.56212, 2.69127, - 0.220878, 0.289573, 0.640307, 0.822072, 1.14406, 1.5678, 1.76641, 1.90811, 2.10346, 2.56049, - 0.403453, 0.526298, 0.732204, 0.90115, 1.03587, 1.33938, 1.78399, 1.94196, 2.37103, 2.62665, - 0.212825, 0.25857, 0.471588, 0.685549, 1.26374, 1.82105, 2.16382, 2.2884, 2.62806, 2.78816, - 0.401181, 0.642053, 1.03247, 1.23611, 1.44445, 1.68668, 2.00672, 2.22851, 2.57211, 2.72396, - 0.239433, 0.341091, 0.492629, 0.70763, 0.881426, 1.03082, 1.71925, 2.34406, 2.57906, 2.75694, - 0.294093, 0.38277, 0.577412, 1.00928, 1.31304, 1.4193, 1.74467, 2.09423, 2.28904, 2.47584, - 0.169805, 0.236922, 0.403314, 0.638995, 1.17645, 1.35214, 1.66557, 1.90976, 2.15012, 2.71624, - 0.210447, 0.277913, 0.452474, 1.40269, 1.51343, 1.72094, 1.90394, 2.2785, 2.58376, 2.74318, - 0.159574, 0.225382, 0.374008, 0.714137, 1.01125, 1.37171, 1.69916, 1.87159, 2.02706, 2.49119, - 0.258602, 0.557253, 0.81972, 1.03886, 1.30147, 1.44536, 1.83061, 2.09817, 2.32081, 2.54107, - 0.232756, 0.282242, 0.631974, 0.898694, 1.53744, 1.86922, 2.06397, 2.23446, 2.49823, 2.63352, - 0.580133, 0.997946, 1.32096, 1.48187, 1.73161, 1.89858, 2.12071, 2.29013, 2.53009, 2.65166, - 0.21184, 0.307093, 0.45336, 0.945579, 1.25082, 1.49029, 1.72414, 2.2811, 2.5627, 2.7526, - 0.314276, 0.493555, 0.667782, 0.8965, 1.32301, 1.48262, 1.66749, 1.97441, 2.42735, 2.55568, - 0.182455, 0.261592, 0.418011, 1.05093, 1.26139, 1.44337, 1.66547, 1.93903, 2.44469, 2.63845, - 0.24157, 0.306934, 0.491293, 1.10595, 1.55483, 1.66652, 1.92392, 2.08765, 2.3676, 2.65489, - 0.190084, 0.25485, 0.454062, 0.724519, 1.08336, 1.39389, 1.89234, 2.08886, 2.32176, 2.4843, - 0.306497, 0.389831, 0.721793, 0.839714, 1.12475, 1.6524, 1.82292, 2.27331, 2.5692, 2.6696, - 0.1862, 0.27346, 0.383201, 0.564758, 1.51107, 1.84502, 1.99828, 2.1941, 2.38869, 2.58792, - 0.300722, 0.478218, 0.823364, 1.12749, 1.59114, 1.87135, 2.17472, 2.40318, 2.62478, 2.7824, - 0.228884, 0.358342, 0.504622, 0.795874, 1.00562, 1.15261, 1.90805, 2.12479, 2.37247, 2.79758, - 0.171885, 0.248234, 0.432842, 0.833143, 1.04089, 1.26929, 1.66164, 1.91863, 2.15896, 2.6534, - 0.140943, 0.193684, 0.343025, 0.562303, 1.06955, 1.54333, 1.82447, 1.96164, 2.46351, 2.77054, - 0.173053, 0.245656, 0.360656, 0.960618, 1.58953, 1.68991, 1.98414, 2.143, 2.58839, 2.7594, - 0.24018, 0.429951, 0.63744, 0.786596, 1.06915, 1.22657, 1.47088, 1.95205, 2.19506, 2.61597, - 0.367862, 0.471897, 0.730834, 1.08232, 1.22629, 1.46293, 1.92817, 2.05247, 2.40674, 2.66246, - 0.247175, 0.358209, 0.535946, 0.781876, 1.3637, 1.63524, 1.80723, 1.99378, 2.45277, 2.60104, - 0.445578, 0.687898, 1.11411, 1.30103, 1.5774, 1.88604, 2.2249, 2.43653, 2.65969, 2.76103, - 0.214389, 0.336025, 0.487794, 0.759534, 0.970518, 1.1411, 1.45733, 1.62464, 2.30692, 2.71527, - 0.3773, 0.466775, 0.716121, 1.08378, 1.25654, 1.41124, 1.78943, 1.93637, 2.20557, 2.56236, - 0.148362, 0.214593, 0.545023, 0.840437, 1.19333, 1.48066, 1.79187, 2.08342, 2.41054, 2.67613, - 0.150403, 0.278398, 0.792676, 0.97668, 1.21885, 1.40524, 1.77506, 2.16246, 2.54786, 2.74638, - 0.236301, 0.328633, 0.630867, 0.839915, 1.04235, 1.29887, 1.62775, 1.83949, 2.29893, 2.49396, - 0.337889, 0.49792, 0.711277, 0.85042, 0.992027, 1.24688, 1.71075, 2.08668, 2.52716, 2.70716, - 0.172215, 0.23654, 0.372897, 0.525146, 1.18258, 1.73573, 1.92703, 2.11462, 2.31917, 2.54278, - 0.415304, 0.624807, 0.906616, 1.11784, 1.44615, 1.66942, 1.94841, 2.17282, 2.50453, 2.67075, - 0.265417, 0.407241, 0.613894, 0.816534, 0.980063, 1.15606, 1.75675, 2.27485, 2.49719, 2.71224, - 0.27644, 0.468209, 0.649518, 0.816686, 1.19517, 1.35552, 1.54923, 1.93527, 2.21787, 2.42698, - 0.188925, 0.277012, 0.412665, 0.672627, 1.35481, 1.51452, 1.69999, 2.14455, 2.38219, 2.58608, - 0.24263, 0.352485, 0.912974, 1.34378, 1.60443, 1.80187, 2.01479, 2.19307, 2.46081, 2.632, - 0.190903, 0.285841, 0.44907, 0.760328, 0.954285, 1.18294, 1.69264, 1.87816, 2.27684, 2.46596, - 0.220659, 0.300374, 0.721694, 0.947306, 1.29833, 1.56298, 1.76062, 1.88825, 2.50644, 2.68968, - 0.213168, 0.290928, 0.695227, 0.918179, 1.37819, 1.63199, 1.84789, 2.00307, 2.35836, 2.61935, - 0.328586, 0.517244, 0.93732, 1.37624, 1.57484, 1.76435, 2.05863, 2.22433, 2.58444, 2.75665, - 0.248486, 0.367007, 0.562147, 0.750632, 0.902785, 1.14756, 1.63742, 1.91206, 2.41399, 2.6057, - 0.310691, 0.477895, 0.670796, 0.940507, 1.41829, 1.5635, 1.80514, 2.11408, 2.37636, 2.53516, - 0.256555, 0.41421, 0.559427, 0.981289, 1.19165, 1.37831, 1.6784, 1.84931, 2.5767, 2.75663, - 0.291424, 0.335003, 0.750149, 1.28965, 1.43721, 1.59999, 1.80318, 1.96741, 2.60175, 2.73376, - 0.195254, 0.279513, 0.451755, 0.649111, 0.828694, 1.60951, 1.91491, 2.09122, 2.31959, 2.5349, - 0.222304, 0.332624, 0.475678, 0.685205, 1.03033, 1.73722, 1.92098, 2.37829, 2.70672, 2.81773, - 0.164833, 0.240093, 0.359862, 0.801929, 1.51368, 1.64171, 2.04052, 2.24884, 2.48866, 2.71403, - 0.214777, 0.287322, 0.572644, 1.14507, 1.36711, 1.75269, 2.04242, 2.22207, 2.54305, 2.69789, - 0.226099, 0.330382, 0.474439, 0.687757, 0.799187, 1.31984, 1.94457, 2.0781, 2.3678, 2.50846, - 0.24454, 0.392163, 0.553692, 0.729765, 1.24786, 1.44838, 1.61759, 2.07464, 2.34005, 2.51806, - 0.175381, 0.314231, 0.446023, 0.797404, 1.32846, 1.43973, 1.79335, 1.93957, 2.4688, 2.72165, - 0.205808, 0.29367, 0.452447, 1.07427, 1.28823, 1.65563, 1.8575, 2.36469, 2.63981, 2.79814, - 0.253926, 0.392653, 0.587584, 0.800134, 0.97631, 1.18559, 1.57069, 1.82141, 2.09089, 2.34902, - 0.322461, 0.410912, 0.723569, 1.06064, 1.20152, 1.40036, 1.57919, 1.78876, 2.46024, 2.6166, - 0.211266, 0.304981, 0.436011, 0.771978, 1.49062, 1.67775, 1.88623, 2.1135, 2.32635, 2.72726, - 0.235012, 0.406911, 0.864785, 1.29148, 1.70829, 1.93855, 2.1799, 2.3524, 2.56379, 2.71145, - 0.176814, 0.26862, 0.445837, 0.823113, 1.02978, 1.27157, 1.62339, 1.81122, 2.40214, 2.61417, - 0.241865, 0.339268, 0.507509, 1.00368, 1.20435, 1.37256, 1.94079, 2.10137, 2.38561, 2.66998, - 0.230878, 0.334743, 0.50037, 0.879929, 1.02189, 1.53377, 1.97079, 2.12897, 2.56726, 2.71729, - 0.297505, 0.451574, 0.748848, 0.988527, 1.36624, 1.60667, 1.89466, 2.17448, 2.52143, 2.75917, - 0.199265, 0.271145, 0.49816, 0.854679, 1.1721, 1.36415, 1.76208, 1.96909, 2.17354, 2.31163, - 0.222173, 0.424864, 0.564942, 0.829809, 1.03817, 1.19405, 1.7206, 1.85809, 2.43176, 2.74146, - 0.181961, 0.226819, 0.390513, 0.556339, 1.0566, 1.55306, 2.12835, 2.25802, 2.6025, 2.80212, - 0.3576, 0.565047, 1.15301, 1.35031, 1.53358, 1.71854, 1.95789, 2.17535, 2.50565, 2.67849, - 0.162257, 0.236808, 0.374039, 0.570569, 0.748034, 1.17226, 1.82339, 2.05303, 2.51377, 2.77207, - 0.305794, 0.46587, 0.645121, 0.88265, 1.14129, 1.26686, 1.70158, 2.00288, 2.18412, 2.41125, - 0.231652, 0.380738, 0.549642, 0.83741, 1.22527, 1.33297, 1.85158, 2.11937, 2.31508, 2.73211, - 0.235449, 0.286771, 0.684809, 1.34666, 1.52663, 1.70348, 2.10149, 2.25455, 2.57718, 2.71899, - 0.23387, 0.446515, 0.60508, 0.814654, 1.05496, 1.1788, 1.63316, 1.84974, 2.13938, 2.73277, - 0.271706, 0.335152, 0.857227, 1.25374, 1.38719, 1.70217, 1.89677, 2.19111, 2.48, 2.60136, - 0.237386, 0.314549, 0.438339, 0.912164, 1.57776, 1.87779, 2.03279, 2.19704, 2.41232, 2.53648, - 0.361168, 0.574093, 1.02384, 1.46852, 1.69056, 1.91737, 2.18737, 2.33403, 2.6691, 2.80629, - 0.27848, 0.398742, 0.573342, 0.839212, 1.07389, 1.22209, 1.69168, 2.16526, 2.37741, 2.53688, - 0.286018, 0.447947, 0.61506, 0.849446, 1.31947, 1.46358, 1.76995, 2.00103, 2.18943, 2.45038, - 0.21944, 0.301601, 0.668534, 0.861094, 1.21, 1.49867, 1.74512, 1.87777, 2.31438, 2.6196, - 0.223591, 0.352153, 0.598841, 1.21789, 1.35908, 1.59174, 1.77109, 2.21386, 2.56154, 2.73542, - 0.176857, 0.236601, 0.395107, 0.634632, 1.13349, 1.33512, 1.77037, 1.98131, 2.20656, 2.33972, - 0.334735, 0.402265, 0.659168, 0.781639, 0.975228, 1.665, 1.87207, 2.04753, 2.47696, 2.57398, - 0.215968, 0.284755, 0.524241, 0.78146, 1.33481, 1.77238, 1.95388, 2.19421, 2.57825, 2.74194, - 0.298193, 0.489879, 0.812985, 1.18369, 1.49642, 1.67998, 2.10879, 2.31656, 2.67378, 2.85161, - 0.312989, 0.415446, 0.618011, 0.899096, 1.08368, 1.26338, 1.8874, 2.24306, 2.41945, 2.57048, - 0.244471, 0.431115, 0.601512, 0.813139, 1.10216, 1.22106, 1.69244, 2.03316, 2.2218, 2.61984, - 0.150949, 0.21906, 0.349217, 0.611327, 1.07711, 1.25055, 1.91552, 2.08398, 2.45, 2.79254, - 0.161611, 0.218964, 0.445377, 0.927863, 1.45115, 1.76846, 2.13001, 2.36672, 2.666, 2.81405, - 0.196, 0.297256, 0.497266, 0.6919, 1.08988, 1.27368, 1.51372, 2.00647, 2.27378, 2.57222, - 0.335268, 0.460795, 0.685187, 0.867664, 1.01381, 1.47955, 2.01199, 2.16848, 2.57264, 2.71756, - 0.257604, 0.340872, 0.499757, 0.843052, 1.39655, 1.83169, 2.03423, 2.17033, 2.42262, 2.5405, - 0.417663, 0.631718, 0.955424, 1.19732, 1.6598, 1.87988, 2.1688, 2.35905, 2.57809, 2.69825, - 0.162052, 0.251583, 0.4399, 0.660911, 0.903902, 1.3203, 1.62476, 1.77858, 2.53053, 2.79971, - 0.256861, 0.322803, 0.68537, 1.08644, 1.26328, 1.56988, 1.85165, 2.01495, 2.26471, 2.44701, - 0.125192, 0.176171, 0.336135, 0.7816, 1.20022, 1.43997, 1.80542, 2.07752, 2.46247, 2.73819, - 0.102286, 0.191322, 0.774556, 1.07615, 1.36946, 1.62715, 1.97301, 2.236, 2.60937, 2.81298, - 0.173442, 0.232622, 0.491622, 0.844157, 1.09524, 1.3708, 1.69697, 2.05141, 2.31606, 2.50205, - 0.257531, 0.343598, 0.654071, 0.838985, 1.0481, 1.48747, 1.72538, 1.89742, 2.43051, 2.586, - 0.1979, 0.276312, 0.440283, 0.705103, 1.26734, 1.7403, 1.93448, 2.15401, 2.4002, 2.62414, - 0.40959, 0.596785, 0.983751, 1.18177, 1.37115, 1.50238, 1.75828, 2.01857, 2.38005, 2.59215, - 0.231819, 0.33289, 0.483514, 0.644585, 0.816808, 0.926308, 1.4033, 2.23301, 2.46786, 2.67846, - 0.25861, 0.340064, 0.670485, 0.908467, 1.10761, 1.45624, 1.75958, 1.93218, 2.11312, 2.31013, - 0.184377, 0.249203, 0.410806, 0.587907, 1.3025, 1.51032, 1.72443, 1.98189, 2.2829, 2.42213, - 0.25411, 0.313328, 0.659859, 1.26582, 1.41295, 1.66593, 1.92715, 2.10198, 2.55145, 2.67303, - 0.161592, 0.23748, 0.376535, 0.637094, 0.823028, 1.13761, 1.69642, 1.87577, 2.40363, 2.63962, - 0.384501, 0.466812, 0.740791, 0.938093, 1.06235, 1.50928, 1.74914, 1.9178, 2.54816, 2.67151, - 0.333872, 0.419367, 0.638994, 1.09262, 1.52055, 1.64945, 1.86662, 2.14894, 2.34672, 2.50614, - 0.426216, 0.686997, 1.23588, 1.42885, 1.61159, 1.79286, 2.01759, 2.23372, 2.54777, 2.69661, - 0.262949, 0.367509, 0.530429, 0.741867, 0.872474, 1.0696, 1.74557, 2.06119, 2.28384, 2.49418, - 0.335782, 0.547236, 0.716211, 0.919077, 1.27569, 1.40844, 1.68512, 1.96739, 2.21764, 2.44668, - 0.227629, 0.330991, 0.486068, 1.11757, 1.30498, 1.51013, 1.75726, 1.94697, 2.62556, 2.7826, - 0.35985, 0.436633, 0.750634, 1.20151, 1.33757, 1.59484, 1.97027, 2.11384, 2.57381, 2.72996, - 0.211871, 0.304028, 0.512758, 0.663762, 1.08635, 1.63333, 1.81802, 2.12958, 2.39108, 2.60077, - 0.196092, 0.279726, 0.434488, 0.624802, 0.772358, 1.40438, 1.94878, 2.16092, 2.63, 2.77518, - 0.176304, 0.262521, 0.373719, 0.581101, 1.52011, 1.73617, 1.93323, 2.14017, 2.35813, 2.75352, - 0.254932, 0.381411, 0.806187, 1.10229, 1.53452, 1.75028, 1.9709, 2.15987, 2.45592, 2.65841, - 0.190385, 0.288656, 0.449066, 0.678174, 0.812376, 1.44933, 1.72866, 1.96632, 2.63881, 2.78955, - 0.251178, 0.386509, 0.609363, 0.797102, 1.02416, 1.18173, 1.45466, 2.01263, 2.49309, 2.69893, - 0.166654, 0.266226, 0.385171, 0.71199, 1.3979, 1.53235, 1.91597, 2.088, 2.56527, 2.78953, - 0.238453, 0.306036, 0.449309, 0.876277, 1.52144, 1.93398, 2.13442, 2.26799, 2.5376, 2.65825, - 0.161634, 0.219919, 0.353206, 0.524346, 0.961806, 1.20771, 1.68792, 1.91694, 2.16187, 2.32066, - 0.413612, 0.597095, 0.793763, 0.98629, 1.28179, 1.41266, 1.65246, 2.01609, 2.38416, 2.52858, - 0.228655, 0.341562, 0.480989, 0.988605, 1.371, 1.47742, 1.86103, 2.01585, 2.33975, 2.77315, - 0.259092, 0.597012, 0.985224, 1.32174, 1.64335, 1.95737, 2.28868, 2.49747, 2.71649, 2.84447, - 0.185652, 0.304664, 0.446232, 0.864434, 1.09179, 1.27377, 1.94257, 2.09554, 2.52465, 2.76824, - 0.176687, 0.256678, 0.745652, 0.934909, 1.28376, 1.44006, 1.76524, 2.12209, 2.3881, 2.59055, - 0.189805, 0.275637, 0.440995, 0.821356, 1.25602, 1.41098, 1.92978, 2.12014, 2.39603, 2.60464, - 0.266823, 0.337688, 0.819408, 1.13475, 1.2892, 1.77703, 1.98289, 2.22175, 2.59029, 2.6981, - 0.205348, 0.276512, 0.527305, 0.727412, 1.02465, 1.65398, 1.90418, 2.04661, 2.21792, 2.45566, - 0.293498, 0.424494, 0.613795, 0.95613, 1.13398, 1.3248, 1.80903, 1.95392, 2.29385, 2.57588, - 0.18312, 0.24965, 0.376204, 0.543914, 1.35083, 1.90722, 2.09255, 2.25571, 2.51439, 2.6879, - 0.541205, 0.789796, 1.05895, 1.26942, 1.5039, 1.70219, 1.97018, 2.17544, 2.49681, 2.65224, - 0.229326, 0.339475, 0.451881, 0.66121, 0.795832, 1.0738, 2.0271, 2.20637, 2.4789, 2.72678, - 0.330006, 0.506868, 0.673076, 0.887406, 1.22877, 1.34923, 1.78129, 2.08658, 2.27776, 2.48003, - 0.138389, 0.200001, 0.396259, 0.811975, 1.09071, 1.46041, 1.74549, 1.90427, 2.34825, 2.69989, - 0.176584, 0.242161, 0.37827, 1.17785, 1.56472, 1.67817, 1.95162, 2.12141, 2.58011, 2.73713, - 0.145852, 0.198423, 0.335644, 0.550505, 1.01973, 1.37119, 1.79763, 1.94383, 2.20749, 2.74647, - 0.385078, 0.503696, 0.703239, 1.06999, 1.36574, 1.47205, 1.82583, 2.15964, 2.37128, 2.52097, - 0.28495, 0.38805, 0.507352, 0.879125, 1.52353, 1.77624, 1.9296, 2.15756, 2.44799, 2.5864, - 0.491116, 0.756155, 1.2552, 1.52246, 1.77658, 2.02812, 2.28606, 2.42977, 2.67911, 2.77616, - 0.252477, 0.396081, 0.713022, 0.861502, 1.15222, 1.3708, 1.61401, 2.1448, 2.57407, 2.71253, - 0.282756, 0.438437, 0.613566, 0.847746, 1.26077, 1.37906, 1.6422, 2.13754, 2.36837, 2.52216, - 0.203971, 0.322195, 0.479842, 0.953133, 1.21128, 1.39763, 1.80081, 1.95452, 2.40348, 2.57371, - 0.264533, 0.358424, 0.628768, 1.11124, 1.34025, 1.50648, 1.99959, 2.19411, 2.46141, 2.66736, - 0.17773, 0.22368, 0.394553, 0.556177, 0.947415, 1.50064, 1.73353, 1.92605, 2.26147, 2.43605, - 0.314223, 0.363636, 0.727886, 0.85188, 1.05384, 1.79813, 1.97435, 2.1826, 2.538, 2.62968, - 0.201778, 0.2755, 0.404891, 0.747466, 1.50005, 1.84118, 1.99884, 2.22681, 2.48199, 2.66951, - 0.132164, 0.314955, 0.821473, 1.19604, 1.42659, 1.69993, 2.03686, 2.3235, 2.68547, 2.82896, - 0.223374, 0.347335, 0.50773, 0.773547, 0.967916, 1.13413, 1.9914, 2.30657, 2.52136, 2.78875, - 0.312742, 0.449784, 0.583287, 0.934234, 1.26857, 1.36506, 1.5693, 1.68705, 2.0773, 2.59502, - 0.124286, 0.162126, 0.29073, 0.654031, 1.23166, 1.53846, 1.89307, 2.18478, 2.56264, 2.79822, - 0.177049, 0.251654, 0.367891, 0.912504, 1.55758, 1.69305, 1.89899, 2.07214, 2.35016, 2.64604, - 0.240517, 0.378333, 0.547809, 0.754272, 0.973321, 1.10367, 1.57442, 2.02805, 2.21113, 2.56271, - 0.427795, 0.519003, 0.771284, 0.93724, 1.08662, 1.60988, 1.87875, 2.05279, 2.53412, 2.65715, - 0.22437, 0.317969, 0.439666, 0.812931, 1.3985, 1.62663, 1.79418, 2.114, 2.30916, 2.49684 -}; - /* codebook/lspjvm2.txt */ -static const float codes1[] = { - 0.005167, -0.03731, -0.002159, 0.016849, 0.130396, - 0.039445, 0.03168, -0.074412, -0.031499, 0.060536, - 0.019479, -0.030564, -0.048137, -0.056279, -0.027829, - 0.020585, -0.01127, 0.023913, -0.005706, 0.011407, - -0.023217, 0.107455, -0.037777, 0.00407, -0.017279, - -0.090444, 0.007641, 0.099001, -0.047913, -0.017199, - 0.0227, -0.063865, 0.047213, 0.043843, -0.036225, - 0.001312, -0.123861, -0.038988, 0.058666, 0.074541, - 0.039508, 0.1103, 0.013954, -0.119228, -0.035807, - -0.047392, 0.027035, -0.004412, -0.03265, -0.03715, - 0.002491, -0.045447, 0.15826, 0.022828, -0.030124, - -0.047856, 0.088744, -0.009678, 0.106688, 0.08769, - -0.027941, 0.044084, -0.0285, 0.018736, -0.069969, - -0.035358, -0.051568, -0.030459, -0.017899, 0.027632, - -0.018607, -0.123557, 0.019228, 0.057485, -0.028907, - 0.019057, 0.038151, -0.08022, 0.034222, 0.023081, - 0.021312, 0.041905, 0.112903, 0.024092, 0.093974, - -0.116679, 0.015344, -0.066059, -0.096437, 0.004041, - -0.022464, -0.11626, 0.047819, -0.003921, -0.073504, - 0.001975, -0.025869, 0.0282, 0.12269, 0.010627, - -0.035672, 0.078963, -0.009686, 0.000743, -0.147582, - 0.016932, -0.020291, -0.096896, -0.237875, -0.029121, - 0.017376, -0.04013, -0.053865, 0.15406, -0.013215, - 0.015215, -0.019023, -0.070604, 0.032265, 0.04034, - 0.102365, -0.022746, 0.019895, 0.05057, 0.008845, - -0.034134, 0.044441, -0.049387, -0.140481, 0.07257, - 0.013023, -0.006079, 0.037574, 0.004937, -0.081501, - 0.003696, 0.049908, 0.007355, 0.000403, 0.026006, - -0.008466, 0.08068, 0.061382, -0.108985, -0.08806, - -0.012275, -0.081061, 0.020333, -0.079001, 0.068724, - -0.014081, -0.042609, 0.093365, 0.04412, 0.000303, - 0.063391, 0.096574, -0.105424, 0.039041, 0.010412, - -0.054031, -0.084948, 0.080406, -0.035883, 0.137428, - 0.063037, 0.050562, 0.02469, -0.031394, 0.13032, - -0.015501, -0.078884, -0.076886, -0.013864, -0.073587, - 0.048778, 0.003814, -0.031125, 0.046897, 0.028304, - 0.048692, 0.132795, 0.06545, 0.059487, -0.042396, - -0.176999, 0.056943, -0.004135, -0.049378, -0.041083, - -0.039445, -0.016292, -0.00455, 0.06201, -0.079613, - -0.054566, -0.008476, -0.01671, 0.049202, 0.025758, - -0.078723, 0.092091, 0.096536, -0.065079, 0.021161, - 0.076657, 0.009203, -0.036866, -0.016559, 0.012823, - 0.008225, -0.003006, 0.108033, 0.04312, -0.06087, - -0.019346, 0.02279, -0.001728, 0.062304, -0.016965, - -0.001302, -0.01449, -0.041803, -0.034058, -0.197066, - -0.033655, -0.127217, -0.108681, -0.010571, -0.004705, - -0.015553, -0.086069, 0.034109, -0.101379, 0.002068, - -0.004003, -0.044637, -0.068617, 0.052228, -0.047812, - -0.043307, 0.035681, 0.042207, -0.055946, 0.055944, - -0.026792, -0.012601, -0.05671, -0.021094, 0.105842, - -0.025598, -0.078858, -0.013487, 0.030728, -0.031956, - 0.031444, 0.022763, 0.025364, 0.121366, 0.070736, - -0.084556, 0.098118, -0.024301, -0.058655, -0.043194, - -0.011752, -0.043781, 0.091051, -0.071201, -0.02098, - 0.082904, -0.031657, -0.088247, 0.066709, -0.079182, - -0.012151, 0.011796, -0.010589, 0.100656, 0.094539, - 0.035967, 0.025338, 0.071826, 0.009741, -0.040209, - 0.006866, -0.015095, -0.168469, -0.056133, 0.060145, - 0.04583, -0.068969, 0.034551, 0.015842, -0.092809, - 0.054699, 0.138744, 0.001726, 0.006927, 0.005167, - 0.016978, 0.046384, -0.060183, -0.040742, -0.072692, - -0.022489, -0.029728, -0.065018, -0.124741, 0.044927, - -0.029057, -0.037154, 0.031068, 0.060086, 0.009984, - 0.009311, -0.006957, -0.105508, 0.059637, -0.019564, - -0.068154, -0.066443, 0.000799, 0.028579, 0.097063, - 0.096936, 0.03023, -0.034623, -0.088918, 0.040334, - 0.019439, -0.050707, -0.003294, -0.028505, -0.053599, - 0.06246, -0.070688, -0.016465, -0.03568, 0.017378, - 0.009363, 0.048761, 0.043374, 0.039587, -0.023232, - -0.067033, 0.042663, 0.05407, -0.042797, -0.089391, - -0.030497, -0.050249, 0.059528, 0.089089, -0.029633, - 0.064125, -0.086614, -0.002005, 0.08062, 0.000502, - -0.00349, 0.097336, 0.099565, 0.015648, 0.006691, - 0.077668, 0.016572, 0.035404, -0.046026, 0.017237, - -0.048631, 0.009314, 0.141479, 0.017079, 0.043796, - -0.106474, 0.145951, 0.05774, 0.01125, -0.059443, - 0.027572, 0.02665, 0.008527, 0.002949, -0.03768, - -0.077991, -0.090617, 0.00342, -0.04601, 0.007354, - 0.019056, -0.128651, 0.016464, 0.004584, -0.030883, - -0.092069, 0.038976, -0.08184, 0.066695, -0.04734, - 0.003513, 0.040613, 0.046815, -0.023406, 0.062389, - 0.021759, 0.024928, -0.018922, -0.048006, 0.0638, - -0.014416, -0.050333, 0.042628, -0.114934, -0.10145, - 0.062139, 0.029295, -0.065908, 0.111463, 0.050781, - -0.022707, 0.135414, 0.003548, 0.134535, -0.048259, - -0.092344, -0.027727, 0.016343, -0.060786, -0.081502, - -0.005412, -0.026229, -0.143331, 0.052404, -0.077298, - -0.035919, -0.041968, -0.106108, -0.004369, 0.065028, - 0.09637, -0.053299, 0.043317, -0.049735, 0.049815, - 0.032324, 0.051309, -0.009607, -0.205917, 0.005023, - -0.054316, -0.022895, 0.099327, -0.006927, -0.076574, - -0.111024, 0.111026, 0.038381, -0.060368, 0.064238, - -0.034316, 0.026846, 0.02574, -0.076162, -0.163904, - 0.055955, -0.056885, 0.014831, -0.120715, 0.090938, - 0.035289, -0.036439, 0.060012, 0.080302, 0.036215, - 0.06525, 0.08303, -0.058784, 0.104826, -0.051805, - -0.011099, -0.00642, 0.053042, 0.024127, 0.092534, - 0.058569, -0.033442, 0.025186, -0.018222, 0.117744, - 0.044345, -0.042456, -0.043767, -0.021378, -0.121965, - 0.027371, 0.052731, -0.020316, 0.036912, 0.115357, - 0.03115, 0.041547, 0.059267, -0.039672, -0.086918, - -0.162369, 0.024801, 0.031725, 0.0834, -0.034463, - 0.000272, -0.008147, -0.002016, 0.131953, -0.092911, - -0.091944, -0.062864, -0.005221, 0.063647, -0.012658, - 0.042685, 0.067952, 0.038644, -0.153221, 0.096841, - 0.108299, 0.089446, -0.047164, 0.004196, -0.043268, - -0.035456, 0.050838, 0.070444, 0.084465, -0.07998, - -0.048916, 0.057726, 0.023894, 0.027653, 0.017775, - 0.015461, -0.030287, -0.022245, 0.052081, -0.150947, - -0.002682, -0.056774, -0.123366, -0.091754, 0.006536, - 0.006473, -0.143025, 0.05469, -0.043189, 0.03297, - 0.027446, 0.033127, -0.132722, -0.010417, -0.080097, - -0.018187, 0.001858, 0.11129, -0.090749, 0.059434, - -0.068738, 0.090679, -0.14507, -0.065277, 0.063514, - -0.003982, -0.056382, -0.003673, 0.015845, -0.073396, - 0.043688, 0.002836, 0.069211, 0.124852, -0.053313, - -0.040946, 0.07044, -0.107024, -0.019199, -0.033672, - -0.00144, 0.02168, 0.110595, -0.053452, -0.052426, - 0.035461, -0.028179, -0.049041, 0.02258, -0.010989, - -0.002913, -0.051691, -0.075881, 0.037241, 0.076377, - 0.034735, -0.031556, 0.073516, -0.001427, 0.016296, - -0.017537, 0.003346, -0.099774, -0.067624, -0.044257, - -0.018202, 0.030622, 0.012773, 0.046475, -0.121785, - -0.057265, 0.116179, -0.079916, 0.066396, 0.050104, - -0.013177, 0.057766, -0.047879, -0.109526, -0.146491, - 0.032675, -0.049318, -0.057045, -0.080068, 0.089621, - -0.046564, -0.029992, 0.040828, 0.029281, -0.037369, - -0.009731, -0.082145, -0.117622, 0.117077, 0.037369, - 0.00082, -0.106634, -0.007967, 0.000812, 0.140637, - 0.03653, 0.062121, -0.065504, -0.09493, 0.121336, - 0.01753, -0.01733, -0.040402, -0.018255, 0.010992, - 0.019746, -0.027564, 0.033588, 0.042466, -0.003143, - 0.013767, 0.084179, 0.033753, -0.017279, -0.009676, - -0.006452, 0.032645, 0.031852, -0.030975, -0.043384, - -0.005433, -0.015258, 0.053273, 0.054748, -0.064736, - 0.008959, -0.141223, -0.032957, -0.015079, 0.018198, - -0.001681, 0.143079, 0.076, 0.001037, -0.048744, - 0.022062, 0.02603, -0.008263, -0.050353, -0.023037, - -0.036477, -0.051733, 0.137823, -0.034438, -0.007573, - -0.004256, 0.064218, 0.075183, 0.095106, 0.026497, - 0.02636, 0.009791, -0.058039, 0.053315, -0.077817, - -0.033283, -0.081151, -0.05522, 0.004268, 0.017539, - -0.007329, -0.1172, 0.09322, 0.037359, 0.002718, - 0.010749, 0.018281, -0.0758, -0.024889, 0.00572, - 0.022129, 0.035613, 0.036187, 0.032246, 0.105439, - -0.073766, 0.016887, -0.059934, -0.049471, 0.07352, - -0.024041, -0.104642, 0.023557, -0.059746, -0.043871, - 0.022311, -0.00025, -0.074027, 0.198593, 0.102732, - 0.024478, 0.077658, -0.060042, -0.018229, -0.149648, - -0.009871, -0.105822, 0.007585, -0.161459, -0.041121, - -0.02146, 0.00902, -0.065018, 0.111801, -0.024953, - 0.074594, -0.026041, -0.062859, 0.009199, 0.069609, - 0.078672, -0.033414, 0.054128, 0.005408, -0.016273, - 0.052076, 0.10761, -0.067518, -0.0964, 0.033703, - -0.01435, -0.024676, 0.056254, -0.04377, -0.060847, - -0.004185, 0.07355, -0.05783, -0.016644, 0.029096, - 0.005755, 0.026472, 0.040449, -0.09195, -0.048538, - -0.034439, -0.107938, 0.090712, -0.117001, 0.04317, - -0.006505, -0.035277, 0.117316, 0.127002, 0.047906, - -0.001441, 0.118379, -0.132165, 0.00738, 0.023823, - -0.02012, -0.083725, 0.047284, 0.023795, 0.074123, - -0.013439, 0.024994, 0.060254, -0.06912, 0.166373, - -0.024228, -0.06315, -0.046506, -0.077202, -0.054592, - -0.006571, 0.010335, -0.006568, 0.003982, 0.075837, - 0.008643, 0.136339, -0.005502, 0.03391, -0.066379, - -0.127371, -0.006954, 0.03977, -0.070123, 0.060925, - -0.046386, -0.02642, -0.00528, 0.103509, -0.02231, - -0.00374, -0.014999, -0.03777, 0.080005, 0.025231, - -0.054995, 0.071017, 0.009442, -0.075737, 0.013441, - 0.051947, 0.027097, -0.070351, -0.055705, -0.021115, - 0.021387, 0.029232, 0.163331, -0.03238, 0.010008, - -0.011987, -0.028631, 0.002665, 0.01477, -0.009558, - -0.034325, 0.01583, -0.091253, -0.012677, -0.107378, - -0.034624, -0.047725, -0.10233, 0.042525, -0.006869, - 0.014048, -0.043127, 0.052384, -0.047473, 0.055102, - 0.009744, -0.033646, -0.081755, -0.001464, -0.016223, - -0.036697, -0.002279, 0.023279, -0.036221, 0.101478, - -0.058454, 0.065074, 0.003524, 0.00501, 0.097182, - -0.038171, -0.037943, -0.009994, -0.033355, -0.044552, - 0.041318, 0.065041, 9.2e-05, 0.100816, 0.029007, - -0.031803, 0.183537, -0.009617, -0.010544, -0.028465, - 0.0069, -0.014988, 0.09049, -0.174817, 0.027464, - 0.063314, -0.049281, -0.001567, 0.091421, -0.078603, - -0.004869, -0.063266, -0.001922, 0.069338, 0.081771, - 0.058737, 0.073195, 0.081676, -0.047808, -0.025797, - -0.004185, 0.033203, -0.125472, -0.108148, 0.031258, - 0.035192, 0.029957, 0.046675, 0.047238, -0.088197, - 0.033315, 0.114919, -0.04918, 0.025707, 0.053843, - 0.035182, 0.140206, -0.05866, -0.025978, -0.019658, - -0.014847, -0.021051, -0.034385, -0.121789, 0.173406, - -0.112251, -0.022333, 0.071206, 0.028998, 0.046468, - 0.067704, -0.026159, -0.158316, 0.014936, 0.040216, - -0.010137, -0.053492, 0.004935, -0.011277, 0.073852, - 0.091261, 0.114794, -0.01406, -0.051545, 0.077316, - 0.101258, -0.046137, 0.022994, -0.066767, -0.065537, - 0.049952, -0.043582, 0.012823, 0.009313, 0.036343, - 0.054885, 0.037796, 0.02194, 0.013211, 0.006019, - -0.099578, 0.058596, -0.045463, -0.015632, -0.087141, - -0.019273, -0.03314, 0.043796, 0.119057, -0.081813, - -0.021538, -0.070453, -0.052551, 0.077213, 9.4e-05, - 0.050268, 0.092271, 0.051688, -0.025224, 0.075437, - 0.027983, 0.069205, 0.031787, -0.099975, 0.004387, - -0.002747, -0.056567, 0.161394, 0.000164, 0.084189, - -0.124844, 0.050329, 0.009844, 0.055877, 0.055701, - 0.030479, 0.028843, -0.001076, -0.017173, -0.10277, - -0.038426, -0.133841, -0.03584, -0.072046, 0.020206, - 0.016438, -0.097885, 0.041857, 0.034601, 0.030422, - -0.089192, -0.014112, -0.052276, 0.012005, -0.029335, - -0.011331, 0.101833, 0.063827, 0.044288, 0.101597, - -0.034689, -0.027434, -0.017801, -0.079224, 0.067103, - -0.027456, -0.098034, 0.009448, -0.038986, -0.156729, - 0.085023, 0.033136, -0.021343, 0.110701, -0.011901, - -0.006484, 0.082023, -0.027094, 0.091208, -0.013163, - -0.012223, 0.005933, 0.010653, -0.098119, -0.005304, - -0.021061, -0.058077, -0.073035, 0.097856, -0.102847, - -0.035329, -0.092754, -0.101463, -0.048671, 0.055015, - 0.102145, 0.062017, 0.016002, 0.036489, 0.059, - 0.042861, 0.025447, -0.019735, -0.107841, -0.033752, - -0.043982, -0.067059, 0.051092, 0.025235, -0.147107, - -0.016269, 0.123009, 0.035894, -0.020453, 0.040013, - 0.015557, 0.015825, 0.080712, -0.06963, -0.149739, - 0.022006, -0.008848, 0.040169, -0.095688, 0.059575, - -0.030641, -0.061353, 0.046302, 0.104489, 0.043372, - -0.001579, 0.059737, -0.104073, 0.042342, -0.048611, - -0.013811, -0.056255, 0.107179, 0.057433, 0.084815, - 0.030217, 0.02236, -0.040342, -0.028775, 0.120588, - 0.04127, -0.045775, -0.030195, -0.106859, -0.104349, - 0.072418, -0.003603, -0.013072, 0.040728, 0.086869, - 0.091943, 0.066517, 0.024442, -0.030929, -0.03292, - -0.160336, -0.010347, -0.068458, 0.017458, 0.044823, - 0.050694, 0.067625, 0.040303, 0.113164, -0.038747, - -0.065558, -0.106357, -0.028352, 0.121488, 0.026548, - -0.00782, 0.054872, 0.094674, -0.099533, 0.005231, - 0.118132, 0.04278, -0.065079, 0.03144, 0.043229, - -0.050024, 0.015943, 0.073917, 0.034049, 0.010548, - -0.024979, 0.022639, 0.027795, 0.049491, 0.048762, - -0.002738, -0.010783, -0.027637, -0.006986, -0.104141, - -0.066719, -0.061742, -0.067028, -0.053057, -0.003478, - -0.050948, -0.122196, 0.022082, 0.002595, 0.015094, - 0.006014, 0.005784, -0.184537, -0.034872, -0.036104, - 0.055412, 0.006886, 0.103488, -0.063001, 0.096665, - -0.035533, 0.009847, -0.095114, 0.008588, 0.023736, - -0.034278, -0.11197, -0.041172, 0.03973, -0.102952, - 0.063775, 0.039273, 0.109863, 0.0918, 0.030306, - -0.082206, 0.089449, -0.058478, -0.029341, 0.038389, - 0.061057, -0.024711, 0.111044, -0.035079, -0.027985, - 0.01457, 0.002046, -0.031545, 0.058848, -0.0195, - -0.002475, -0.025589, -0.144358, 0.063478, 0.124927, - -0.014094, -0.01097, 0.031621, -0.040043, 0.004389, - 0.025003, 0.052397, -0.054526, -0.073469, 0.026795, - -0.024697, 0.024739, 0.118299, 0.014948, -0.132109, - 0.020192, 0.037815, -0.09027, 0.049313, 0.082764, - -0.022642, -0.006053, -0.038073, -0.057363, -0.107347, - 0.033166, -0.027556, -0.019765, -0.111958, 0.027773, - -0.063001, -0.052998, 0.019353, -0.009646, -0.01127, - 0.011872, -0.006508, -0.122226, 0.059824, 0.041779, - 0.016445, -0.03189, -0.03631, 0.013085, 0.091631, - 0.062866, 0.054501, -0.117523, -0.010907, 0.087026, - -0.014974, -0.03592, -0.048565, -0.019246, -0.043405, - -0.006959, 0.006211, 0.04237, 0.014603, -0.006435, - 0.019149, 0.078038, -0.020556, 0.018114, -0.036521, - -0.054036, 0.007325, 0.056349, -0.033497, -0.02596, - 0.050184, -0.066536, 0.091501, 0.071356, -0.049044, - -0.032263, -0.095268, -0.008784, 0.049033, 0.036929, - 0.020357, 0.152151, 0.040814, -0.063159, -0.024324, - -0.017084, 0.011876, -0.015442, -0.019811, -0.000366, - -0.0027, -0.072981, 0.109288, 0.007473, -0.049442, - -0.05404, 0.051947, 0.019359, 0.12916, 0.021981, - 0.002248, 0.035262, -0.023141, 0.064666, -0.078273, - -0.031663, -0.031343, -0.006058, -0.045421, 0.017466, - -0.067122, -0.130784, 0.067057, 0.05246, -0.041165, - -0.004411, 0.046453, -0.055461, 0.048162, -0.009687, - 0.02153, 0.007211, 0.104764, 0.079849, 0.086248, - -0.072791, 0.001112, -0.027964, -0.071233, -0.013339, - 0.007979, -0.118231, 0.076826, -0.060762, -0.084358, - -0.011447, 0.009765, 0.014163, 0.164784, -0.015892, - -0.020756, 0.152509, -0.014014, -0.041853, -0.117008, - -0.011755, -0.005766, -0.086896, -0.13965, -0.032342, - 0.025651, -0.007843, -0.039073, 0.103397, -0.042591, - -0.005971, -0.001324, -0.053945, -0.000716, 0.048977, - 0.130185, 0.028226, 0.061179, 0.024489, -0.021939, - -0.007019, 0.054336, -0.01004, -0.095411, 0.082406, - -0.03213, -0.015054, 0.033059, 0.002802, -0.080159, - -0.022452, 0.077426, -0.015314, 0.033583, 0.028479, - 0.023293, 0.035078, 0.006442, -0.110541, -0.106244, - -0.034737, -0.10414, -0.03457, -0.114316, 0.079382, - 0.006009, 0.003901, 0.080081, 0.055082, 0.012896, - 0.064981, 0.057219, -0.112986, 0.003906, -0.028414, - -0.012383, -0.054541, 0.077483, 0.004267, 0.123567, - 0.007369, 0.099856, 0.023273, -0.028194, 0.12203, - -0.036635, -0.126589, -0.034567, -0.028288, -0.06504, - 0.01428, 0.011435, -0.004867, 0.043901, 0.035395, - 0.028599, 0.075858, 0.11846, 0.070581, -0.051903, - -0.170905, 0.050352, 0.053514, -0.017139, 0.021748, - -0.09661, 0.008904, -0.001049, 0.078787, -0.101201, - -0.026229, -0.019757, -0.035771, 0.054142, 0.068041, - -0.020328, 0.099979, 0.096623, -0.046957, -0.001733, - 0.049586, 0.052458, -0.031724, -0.028332, -0.005418, - 0.04671, 0.014238, 0.133125, -0.005428, -0.080055, - -0.033226, 0.034007, 0.025272, 0.033924, -0.044662, - -0.03469, -0.079173, -0.160689, -0.153893, -0.228771, - -0.00245, -0.083966, -0.168294, 0.010694, -0.012167, - 4e-06, -0.044377, 0.023373, -0.077437, 0.012178, - -0.015899, -0.010828, -0.062847, 0.029927, -0.074557, - -0.053306, 0.049688, 0.057017, -0.022571, 0.015337, - -0.046545, 0.018895, -0.024848, -0.004424, 0.165442, - -0.060201, -0.098629, -0.06519, 0.036582, -0.038566, - 0.051453, 0.093478, 0.039619, 0.117535, 0.090386, - -0.029366, 0.108075, -0.016568, -0.093576, -0.048799, - -0.045599, -0.023619, 0.070072, -0.109294, 0.001548, - 0.076285, -0.091274, -0.068829, 0.000215, -0.046519, - -0.022512, -0.027067, 0.014905, 0.079017, 0.140699, - 0.061141, 0.009178, 0.097811, 0.033468, -0.006666, - 0.007163, -0.007578, -0.124238, -0.025271, 0.017581, - 0.042405, -0.034252, 0.06489, 0.0025, -0.139083, - 0.009733, 0.158179, 0.014474, 0.038913, 0.05629, - -0.004998, 0.075401, -0.030557, -0.038595, -0.04907, - -0.01468, -0.076306, -0.132365, -0.177693, 0.09176, - -0.057238, -0.072379, 0.050877, 0.051489, 0.028125, - 0.004991, 0.032621, -0.167359, 0.041002, -0.007072, - -0.086405, -0.042263, -0.019757, -0.011524, 0.066004, - 0.08567, 0.008071, -0.013614, -0.062142, 0.08328, - 0.000887, -0.07582, 0.008295, -0.020136, -0.016886, - 0.089657, -0.10626, -0.051491, -0.012687, 0.054778, - 0.011535, 0.086613, 0.053803, 0.027164, -0.023825, - -0.040009, 0.080987, 0.026309, -0.000334, -0.085288, - -0.024208, -0.08504, 0.096077, 0.120527, -0.044181, - 0.003034, -0.091142, 0.006471, 0.115971, -0.026358, - 0.003489, 0.083633, 0.109975, -0.029425, 0.061726, - 0.056115, -0.006711, 0.013158, -0.062917, -0.015029, - 0.003354, 0.031574, 0.119045, 0.022859, 0.023777, - -0.068292, 0.115604, 0.031617, 0.008953, 0.006943, - 0.01442, 0.008569, -0.031547, -0.006857, -0.05169, - -0.086683, -0.108339, 0.005093, -0.108646, -0.03472, - 0.054273, -0.096753, 0.050806, -0.021115, -0.025278, - -0.079997, 0.027008, -0.034211, 0.090949, 0.005678, - 0.019288, 0.042083, 0.062119, 0.019301, 0.040859, - -0.009113, 0.022427, -0.004019, -0.06089, 0.032884, - -0.012373, -0.037976, 0.017625, -0.079369, -0.050788, - 0.07972, -0.039347, -0.085324, 0.091044, 0.026653, - -0.063122, 0.099371, -0.024736, 0.084631, -0.100421, - -0.073313, 0.014317, 0.022555, -0.116051, -0.063966, - -0.009688, -0.063666, -0.131709, 0.016744, -0.135028, - -0.003708, -0.043685, -0.121631, -0.03693, 0.125776, - 0.084333, 0.010114, 0.071231, -0.010395, 0.059391, - 0.01776, 0.033034, -0.018996, -0.13054, 0.025758, - -0.018261, -0.060044, 0.127025, -0.032724, -0.107299, - -0.064538, 0.090073, -0.010186, -0.066127, 0.107025, - -0.01094, 0.003083, 0.01903, -0.023935, -0.140176, - 0.003549, -0.042402, -0.010695, -0.185915, 0.060835, - 0.005405, -0.013822, 0.029205, 0.079338, 0.068155, - 0.071485, 0.030282, -0.087207, 0.07348, -0.02794, - 0.004896, -0.033246, 0.072637, 0.018017, 0.054712, - 0.026184, -0.005287, 0.034456, -0.036753, 0.079232, - 0.072707, 0.004506, -0.039353, -0.01556, -0.071466, - 0.010257, 0.067446, -0.006598, 0.047396, 0.072218, - 0.023405, 0.082663, 0.015319, -0.035436, -0.075461, - -0.124036, -0.032046, 0.060837, 0.010231, -0.053024, - 0.0228, 0.042891, -0.041549, 0.132395, -0.09533, - -0.077091, -0.058554, -0.070632, 0.04757, 0.031856, - 0.000127, 0.114996, 0.05866, -0.092472, 0.064503, - 0.09645, 0.0662, -0.001059, 0.039487, -0.032859, - -0.065721, 0.001601, 0.088037, 0.059828, -0.047411, - -0.077714, 0.010275, 0.013629, 0.003304, 0.005407, - 0.000665, 0.012927, -0.077525, 0.069202, -0.157417, - 0.014547, -0.095965, -0.087546, -0.067375, -0.027867, - 0.005458, -0.095839, 0.105294, -0.044892, 0.045151, - -0.001349, 0.038356, -0.127152, -0.080503, -0.105423, - -0.018484, 0.008439, 0.104398, -0.027959, 0.082086, - -0.020605, 0.042785, -0.109139, -0.025958, 0.079733, - 0.036289, -0.083773, -0.033819, 0.032566, -0.065556, - 0.006659, 0.00209, 0.097027, 0.115715, -0.013271, - -0.067514, 0.128365, -0.089129, 0.02616, -0.040584, - -0.002443, -0.017254, 0.129204, -0.110078, -0.064943, - 0.089215, -0.022299, -0.034959, 0.022446, -0.019254, - -0.0389, -0.069862, -0.07054, 0.069949, 0.111993, - -0.006311, -0.009057, 0.094278, -0.014932, 0.003657, - -0.019323, 0.026145, -0.062611, -0.073753, -0.007182, - 0.014101, 0.015776, 0.052537, 0.064728, -0.160187, - -0.005122, 0.076356, -0.104763, 0.091493, 0.020225, - -0.000433, 0.062698, -0.060457, -0.14754, -0.066168, - 0.007195, -0.061498, -0.037801, -0.039763, 0.059551, - -0.02841, -0.07451, 0.057667, 0.020584, -0.04251, - -0.025311, -0.037825, -0.18801, 0.077423, 0.030749, - -0.025465, -0.067541, 0.003073, -0.049778, 0.127789, - 0.002786, 0.120009, -0.067812, -0.026565, 0.111272, - 0.023219, -0.024403, -0.014507, -0.048624, 0.022163, - 0.014596, -0.052136, 0.00158, 0.064595, 0.017963, - 0.02133, 0.098862, -0.009253, -0.041062, 0.008903, - -0.013829, 0.031967, 0.076571, -0.005348, -0.04401, - 0.031252, 0.000369, 0.036818, 0.072854, -0.038569, - 0.004161, -0.128017, -0.053152, 0.050896, -0.015212, - -0.036159, 0.097995, 0.068397, -0.048472, -0.056131, - -0.01192, 0.059188, 0.010215, -0.061152, -0.011717, - -0.035949, -0.057039, 0.090859, -0.029682, 0.041466, - -0.025106, 0.131191, 0.059327, 0.085383, 0.021699, - 0.04923, 0.03663, -0.077086, 0.017806, -0.08879, - 0.00404, -0.069533, -0.026785, 0.009666, 0.014017, - -0.055897, -0.096299, 0.120693, 0.029995, 0.032602, - -0.001365, 0.034015, -0.053512, 0.001573, -0.01917, - 0.003956, 0.006452, 0.067313, 0.028301, 0.160615, - -0.053111, 0.01399, -0.02706, -0.013638, 0.039376, - -0.054462, -0.096553, 0.079994, -0.043791, -0.025051, - -0.003222, 0.019418, -0.049525, 0.151136, 0.034123, - 0.055117, 0.058918, -0.017393, 0.026169, -0.12638, - -0.019008, -0.028939, -0.014027, -0.173373, -0.032841, - -0.00337, 0.03968, -0.118311, 0.114094, -0.041869, - 0.041121, -0.038391, -0.096074, -0.032479, 0.060222, - 0.063968, -0.024528, 0.018158, -0.009892, -0.043882, - -0.005004, 0.1298, -0.025438, -0.121186, 0.04986, - 0.010448, -0.040388, 0.061853, -0.017304, -0.035088, - -0.008678, 0.061476, -0.039493, -0.005055, 0.079169, - 0.046134, 0.00977, 0.068294, -0.078965, -0.043792, - -0.030529, -0.053845, 0.053853, -0.140682, 0.111461, - 0.003549, -0.014939, 0.148955, 0.072861, 0.004332, - 0.015386, 0.062006, -0.122325, -0.032529, 0.010241, - -0.047982, -0.12644, 0.05584, 0.067128, 0.101189, - -0.00263, 0.031969, 0.046076, -0.080194, 0.10474, - -0.033486, -0.077818, -0.058697, -0.095258, -0.111074, - 0.037236, 0.011711, 0.001113, -0.005664, 0.048588, - 0.041131, 0.098257, 0.033126, 0.029317, -0.095311, - -0.071555, -0.039999, 0.026678, -0.072182, 0.035031, - -0.007997, -0.048174, -0.006796, 0.075959, -0.05206, - -0.007645, 0.037076, -0.035574, 0.085576, 0.034126, - -0.050676, 0.05143, 0.031999, -0.134308, -0.001489, - 0.084564, -0.018394, -0.09741, -0.042931, -0.025608, - -0.025489, 0.041919, 0.142482, 0.004617, -0.041085, - -0.028816, -0.015527, -0.031005, 0.028405, -0.02224, - -0.067737, -0.025241, -0.052578, 0.012322, -0.120556, - 0.016278, -0.081744, -0.09916, 0.025144, 0.025441, - 0.003176, -0.073871, 0.031718, -0.028622, 0.029031, - 0.01791, -0.030693, -0.104215, -0.015422, -0.065738, - -0.048346, -0.012847, 0.046849, -0.008621, 0.058771, - -0.054495, 0.031597, -0.038844, 0.043138, 0.092588, - -0.071371, -0.059093, -0.001197, 0.001766, -0.074762, - 0.02947, 0.089616, 0.005009, 0.052977, 0.015899, - -0.045424, 0.158466, -0.038717, -0.032506, 0.028687, - 0.011435, -0.006772, 0.047605, -0.144659, -0.031229, - 0.073577, 0.01153, -0.008172, 0.058883, -0.088412, - 0.033615, -0.03412, -0.030701, 0.101215, 0.096645, - 0.027368, 0.041249, 0.081502, -0.02544, 0.007592, - 0.059893, 0.012106, -0.112009, -0.114692, 0.016397, - 0.087068, 0.016199, 0.051263, 0.011915, -0.085364, - 0.026046, 0.145258, -0.047521, 0.077134, -0.000345, - 0.034532, 0.099801, -0.087591, -0.059719, -0.058671, - 0.022737, -0.001887, -0.107049, -0.116757, 0.134115, - -0.055403, 0.005157, 0.067618, 0.081074, 0.071787, - 0.063802, -0.00343, -0.106491, 0.017543, 0.002214, - -0.013785, -0.032962, 0.010084, 0.024325, 0.045963, - 0.059883, 0.072282, -0.008608, -0.015127, 0.048225, - 0.041752, -0.068845, 0.012227, -0.090748, -0.035309, - 0.045353, -0.078624, -0.019489, 0.035531, 0.058571, - 0.045414, 0.039032, -0.011106, 0.048787, -0.025336, - -0.084893, 0.031896, 0.01085, 0.012526, -0.053205, - 0.016952, -0.044041, 0.068766, 0.097328, -0.122229, - 0.027016, -0.051759, -0.057246, 0.074566, 0.006201, - 0.069904, 0.100068, 0.076124, 0.004278, 0.029466, - 0.045229, 0.055683, 0.01879, -0.067806, 0.039373, - 0.029179, -0.036787, 0.129921, -0.028993, 0.037711, - -0.105011, 0.138747, -0.00437, 0.05208, 0.050835, - 0.025511, -0.002962, 0.007852, -0.055234, -0.075055, - 0.00046, -0.089231, -0.030467, -0.080347, 0.007488, - 0.06746, -0.076368, 0.084991, 0.039544, 0.033391, - -0.044318, 0.00639, -0.079387, -0.002909, -0.029708, - -0.047882, 0.06304, 0.065719, 0.021811, 0.070945, - -0.007571, -0.001302, -0.064119, -0.068005, 0.05104, - -0.017747, -0.063938, 0.018673, -0.038391, -0.099966, - 0.057475, -0.007669, 0.009384, 0.109283, 0.012248, - -0.048858, 0.092498, 0.011967, 0.061525, -0.028819, - -0.015131, -0.02416, -0.03322, -0.101648, -0.01798, - -0.003342, -0.049829, -0.125096, 0.128241, -0.047377, - -0.028943, -0.109072, -0.066133, -0.015454, 0.098334, - 0.053371, 0.011324, 0.042781, 0.044313, 0.06251, - 0.098408, 0.06541, -0.040693, -0.116351, -0.032327, - -0.013634, -0.058591, 0.081507, 0.042019, -0.09977, - -0.018275, 0.084624, -0.007512, -0.041113, 0.054203, - 0.017879, -0.029747, 0.059865, -0.048281, -0.111513, - -0.022478, 0.002059, 0.022383, -0.12536, 0.058216, - 0.002386, -0.0816, 0.049288, 0.157428, 0.057724, - 0.005046, 0.102125, -0.083473, 0.044059, -0.094864, - 0.03912, -0.063306, 0.057341, 0.060519, 0.107383, - 0.007076, -0.009373, -0.012555, -0.06663, 0.117121, - 0.025254, -0.008796, -0.062102, -0.083164, -0.079007, - 0.084839, 0.042308, -0.055353, 0.036386, 0.132641, - 0.084464, 0.056288, -0.011636, -0.059554, -0.087748, - -0.147377, -0.052414, -0.010203, -0.009159, -0.018829, - 0.009621, 0.061633, 0.015716, 0.086332, -0.061465, - -0.011833, -0.062998, -0.021168, 0.125194, 0.045025, - 0.052316, 0.02572, 0.095155, -0.093252, 0.02872, - 0.056113, 0.063321, -0.045315, 0.025199, 0.023591, - -0.070481, 0.07235, 0.092458, 0.047973, -0.025439, - -0.001281, 0.021028, 0.034576, 0.084779, 0.006867, - -0.010323, -0.04633, -0.009172, 0.030485, -0.117679, - -0.021782, -0.034737, -0.086292, -0.045885, 0.009655, - -0.037167, -0.123331, 0.017291, -0.028319, 0.071447, - -0.05718, -0.032912, -0.139418, -0.025966, -0.039305, - 0.009411, -0.054017, 0.076307, -0.060252, 0.110087, - -0.061366, 0.038897, -0.098107, 0.046119, 0.043021, - -0.02913, -0.096885, 0.007623, 0.090513, -0.097416, - 0.053264, 0.058296, 0.054372, 0.060769, 0.015586, - -0.067956, 0.059996, -0.03785, 0.005986, 0.000778, - 0.045873, -0.065546, 0.0779, -0.085638, 0.000698, - 0.027694, -0.021241, -0.002777, 0.034509, -0.048173, - 0.009988, 0.001008, -0.077434, 0.026002, 0.13949, - 0.00891, 0.007791, 0.059292, -0.057047, 0.014127, - -0.022959, 0.08571, -0.068087, -0.081561, 0.005935, - 0.007577, 0.061544, 0.076542, 0.00166, -0.113279, - 0.024973, 0.08675, -0.061674, 0.095059, 0.089352, - -0.024436, 0.024181, -0.016117, -0.073634, -0.067986, - 0.074701, -0.046868, -0.054634, -0.092485, 0.006662, - -0.033256, -0.053774, 0.049001, -0.002339, 0.013545, - -0.006432, -0.012089, -0.086842, 0.104105, 0.061991 -}; - /* codebook/lspjvm3.txt */ -static const float codes2[] = { - 0.007066, 0.075781, -0.070082, -0.092014, -0.066477, - 0.09051, 0.106622, 0.025911, -0.01676, 0.003724, - -0.024628, 0.058332, 0.012876, 0.059557, -0.002092, - -0.065092, -0.096975, -0.041837, -0.002432, 0.058918, - 0.014358, 0.080049, -0.008803, -0.002091, -0.097584, - 0.085323, -0.026053, -0.086585, -0.009541, 0.130555, - 0.045391, 0.037557, 0.074726, -0.050453, 0.033517, - -0.035576, -0.084211, -0.08643, 0.00891, -0.072674, - -0.098699, -0.02454, -0.048972, -0.066975, -0.048791, - 0.032184, 0.070992, -0.014416, 0.141892, -0.044249, - -0.108921, -0.02045, 0.115988, 0.011287, -0.026273, - 0.024341, 0.138519, -0.036467, 0.020684, 0.074258, - -0.053563, 0.077463, 0.072166, 0.032112, -0.079303, - -0.025039, 0.079675, 0.094211, -0.115754, 0.038892, - 0.050897, -0.024639, 0.057826, -0.110429, 0.071184, - 0.015309, -0.034027, -0.055726, 0.043179, -0.063089, - 0.043359, -0.011698, 0.006637, 0.002751, 0.03011, - -0.001261, 0.11147, 0.043277, -0.004205, -0.021599, - -0.005698, 0.058842, 0.168422, 0.059313, -0.007971, - -0.087599, 0.073891, -0.083238, 0.099279, -0.017364, - -0.018429, 0.01404, -0.014864, -0.111512, 0.08945, - -0.028498, -0.087983, -0.07732, -0.062602, 0.000328, - -0.027152, -0.093796, 0.111381, -0.018603, 0.092394, - -0.007256, 0.025391, 0.011454, 0.012802, -0.04168, - 0.008078, 0.020905, -0.105401, -0.083265, 0.027756, - -0.04963, -0.044085, -0.051424, 0.104125, -0.000779, - -0.063079, -0.130699, 0.0705, 0.033468, -0.019802, - -0.061011, 0.094839, -0.040122, 0.118409, 0.05695, - 0.086391, -0.006615, 0.045337, -0.04419, -0.106474, - -0.081912, 0.067557, -0.031649, -0.014437, 0.057585, - -0.121755, -0.049113, 0.057109, -0.049872, 0.044104, - 0.064705, -0.091589, 0.037286, -0.048606, -0.045398, - 0.003456, 0.05723, 0.006262, -0.055206, -0.063871, - -0.005249, 0.081783, 0.134969, -0.002331, 0.052643, - -0.093346, 0.072093, 0.116025, -0.031453, -0.006012, - -0.038574, -0.030841, 0.010288, 0.02442, 0.051657, - -0.086584, 0.046381, 0.00541, 0.052622, -0.072741, - 0.079023, 0.078099, -0.093912, 0.005477, -0.006721, - 0.100232, -0.017587, 0.044819, 0.036655, 0.02158, - -0.006829, -0.050076, -0.00302, 0.088246, 0.01356, - -0.01569, 0.012477, -0.052595, -0.048861, -0.033688, - 0.055615, 0.092298, -0.066194, 0.016416, -0.066059, - 0.046976, 0.003023, 0.104646, 0.109136, 0.018293, - -0.016507, -0.006859, 0.004326, 0.070843, 0.14075, - 0.025774, 0.03473, -0.07959, 0.050054, -0.10795, - 0.002378, 0.097498, 0.027111, -0.122953, -0.002423, - -0.020539, -0.063263, -0.095493, -0.157361, -0.039183, - 0.025721, 0.026897, -0.0012, 0.033997, -0.001749, - 0.061593, -0.013053, -0.106317, -0.06819, 0.046352, - -0.05606, 0.157084, -0.049365, 0.053959, -0.051065, - -0.047672, 0.08157, 0.064342, -0.030705, -0.070806, - -0.076503, -0.059471, 0.012419, 0.073968, -0.026179, - -0.038473, 0.059013, -0.035783, -0.030057, -0.036346, - -0.052692, -0.015346, -0.022687, -0.035279, 0.013314, - 0.068397, -0.046609, -0.009593, -0.040796, 0.157438, - -0.07536, -0.110464, 0.031839, -0.029035, -0.015222, - 0.041013, -0.099212, -0.10892, -0.008627, 0.012095, - 0.020855, 0.009935, -0.086917, 0.058827, -0.006536, - 0.022104, -0.005013, 0.003496, 0.046663, -0.051061, - -0.036803, -0.067317, -0.007075, 0.18087, -0.027434, - -0.025056, -0.039341, -0.073918, -0.00318, -0.11093, - -0.042711, 0.005519, -0.035005, -0.088419, 0.170942, - 0.001503, -0.121485, 0.066383, -0.067346, 0.005643, - 0.080088, -0.042562, -0.006668, -0.036538, 0.020683, - 0.042848, 0.027852, -0.029088, -0.156468, 0.006503, - 0.037716, 0.032082, 0.038416, 0.021835, -0.106963, - -0.043017, 0.018166, 0.070409, -0.005426, -0.035585, - -0.111071, -0.039986, 0.05043, 0.035157, 0.066902, - -0.040684, 0.060527, 0.036225, 0.002527, -0.015087, - 0.059243, 0.021268, -0.010682, -0.018434, 0.059128, - 0.111314, -0.05407, 0.105744, -0.051476, -0.01297, - -0.000358, -0.099249, -0.077385, 0.069924, -0.039101, - -0.072139, -0.049069, -0.088018, 0.006144, 0.000712, - 0.08103, 0.021987, -0.046031, 0.058087, -0.00132, - -0.046851, -0.011062, 0.108321, -0.001146, -0.071193, - 0.044973, -0.002915, -0.003323, 0.041735, 0.094566, - 0.05353, 0.035927, 0.100282, 0.059082, -0.054059, - -0.012158, -0.035417, 0.020412, -0.073193, 0.059296, - -0.040489, -0.09525, -0.003821, -0.084904, 0.053925, - 0.109183, -0.005862, -0.036538, 0.080962, -0.040647, - 0.02007, 0.057778, -0.020197, -0.079626, -0.003186, - -0.050855, 0.128185, 0.034731, 0.05746, -0.035236, - -0.057096, -0.001238, 0.122018, -0.071204, -0.047253, - -0.051767, 0.048301, -0.052678, 0.02599, -0.017481, - -0.029379, 0.030738, 0.047207, -0.047864, -0.033561, - 0.029884, -0.091175, -0.085446, -0.02614, 0.092628, - 0.067706, -0.085617, 0.081433, 0.047305, 0.031945, - -0.048728, -0.040387, 0.046206, 0.010578, -0.037639, - 0.011328, -0.042458, -0.149597, 0.033882, -0.061869, - 0.0088, 0.057754, -0.095876, 0.03823, 0.096876, - -0.033487, -0.141669, -0.014172, 0.028439, -0.092764, - -0.053714, 0.086926, 0.034786, 0.136053, -0.005569, - 0.028753, 0.00963, 0.044114, -0.050365, -0.066224, - 0.006017, 0.014348, 0.024471, 0.000489, 0.067234, - -0.021678, -0.11876, 0.036349, -0.040295, 0.076358, - -0.008444, -0.086082, -0.044018, -0.025804, 0.028971, - -0.009233, 0.053026, -0.035341, -0.182193, -0.102515, - 0.08921, 0.066812, 0.032417, 0.046882, -0.034815, - -0.052293, 0.022814, 0.129622, 0.128232, -0.012105, - -0.087084, 0.004762, 0.086538, 0.046566, 0.098359, - -0.018713, 0.039204, -0.021707, -0.06011, -0.117527, - -0.005459, 0.060994, -0.057718, -0.021783, 0.035154, - 0.100557, -0.01547, -0.025818, 0.00845, 0.051535, - -0.001388, -0.11461, -0.057903, 0.041862, 0.061778, - 0.045701, -0.078563, -0.070166, -0.04845, -0.08853, - 0.021375, -0.004598, -0.09071, -0.009399, -0.073952, - -0.035575, -0.05028, 0.11478, 0.137866, 0.065234, - 0.003594, -0.066802, -0.144989, 0.166201, 0.039564, - -0.022457, -0.03009, 0.016187, 0.115443, -0.097331, - -0.019139, 0.09944, 0.002198, -0.030953, 0.021099, - -0.045399, -0.046871, 0.022533, -0.064657, 0.005776, - 0.049063, -0.028478, 0.019268, 0.054265, 0.028042, - 0.045559, -0.005541, -0.01441, -0.024165, -0.054976, - -0.073258, 0.084205, 0.036077, -0.068683, 0.004708, - -0.085228, 0.001234, 0.046261, -0.050496, -0.028227, - -0.086828, -0.001218, 0.021865, 0.003791, -0.000568, - -0.088733, -0.040041, -0.035891, -0.054915, 0.073463, - -0.132031, -0.012844, -0.068544, 0.013052, 0.087335, - 0.038603, -0.115382, -0.010433, -0.007113, 0.095126, - -0.047378, -0.081353, 0.018021, -0.021156, -0.120774, - 0.040038, 0.007633, -0.088728, -0.009928, 0.020142, - 0.052024, -0.021063, -0.118121, 0.102739, -0.055837, - 0.005253, -0.061924, 0.06368, -0.014512, -0.020259, - 0.029493, -0.013435, -0.020638, 0.089342, 0.001092, - -0.046491, -0.145634, -0.083159, -0.158142, -0.279281, - 0.003611, 0.055863, -0.064655, -0.088773, 0.089283, - -0.029619, -0.089949, 0.017197, -0.066633, -0.052347, - 0.090828, -0.087551, 0.000338, 0.085238, -0.005313, - 0.096211, 0.071381, -0.076546, -0.077927, -0.040864, - 0.062936, 0.041559, 0.016235, -0.017513, 0.014773, - -0.025734, 0.028586, 0.070292, 0.055794, -0.026131, - -0.076954, -0.082228, 0.043947, -0.035921, 0.152668, - -0.04951, 0.023159, 0.008506, -0.044773, -0.160358, - 0.024984, -0.025587, -0.071627, -0.038376, 0.088478, - 0.120568, 0.046723, 0.086731, 0.000695, -0.015751, - -0.027837, -0.160937, -0.095031, 0.036271, -0.009061, - -0.015078, -0.036281, -0.103665, -0.058258, -0.049573, - 0.022021, 0.108296, -0.002586, 0.065655, -0.018584, - -0.046441, -0.031018, 0.06735, 0.014328, 0.00886, - -0.000245, 0.0634, -0.00181, 0.043515, 0.090344, - -0.063845, 0.020485, 0.079401, 0.070558, -0.116428, - 0.032628, 0.068949, 0.052238, -0.04453, 0.096813, - 0.029911, -0.008814, 0.044352, -0.168172, 0.009604, - 0.055828, -0.100739, -0.026013, 0.021193, -0.051425, - 0.035891, -0.004085, 0.030216, -0.060801, 0.037202, - 0.007262, 0.120686, 0.026846, 0.058464, -0.100792, - -0.009176, 0.027589, 0.123957, -0.011283, -0.025744, - -0.105081, 0.118244, -0.042122, -0.025404, 0.000873, - -0.012703, 0.084159, -0.067539, -0.140536, 0.041637, - -0.014485, -0.043382, -0.048004, -0.075416, 0.054401, - -0.018651, -0.032908, 0.164231, -0.053236, 0.033946, - -0.021681, -0.012655, -0.037049, -0.001613, -0.053393, - -0.014635, 0.017954, -0.116115, -0.027232, 0.034005, - -0.035376, 0.026492, -0.03725, 0.070733, 0.074835, - -0.021378, -0.14298, 0.123195, 0.003699, 0.025398, - 0.015629, 0.07737, 0.032623, 0.12158, 0.0971, - 0.000946, -0.056355, 0.042065, 0.008184, -0.081824, - -0.101937, 0.065473, 0.00336, 0.069241, 0.073002, - -0.053844, -0.044301, 0.080351, -0.091833, 0.044288, - 0.007447, -0.120723, -0.013806, -0.023636, -0.064616, - 0.030556, 0.07263, 0.074428, -0.087759, -0.02644, - 0.06484, 0.049162, 0.091053, 0.023891, 0.033811, - -0.027746, 0.116392, 0.106126, -0.056644, -0.014781, - 0.036137, -0.002632, 0.055512, 0.070077, 0.067819, - -0.030625, 0.053772, -0.078457, -0.021351, -0.113011, - 0.052797, 0.044875, -0.077269, -0.009867, 0.101493, - 0.073477, -0.024103, 0.049145, -0.004706, -0.025211, - -0.053731, -0.049009, -0.035786, 0.05443, 0.046515, - 0.025154, -0.043569, -0.034789, -0.05861, 0.006931, - 0.012049, 0.046809, -0.129441, 0.025541, -0.030933, - 0.000297, -0.054058, 0.179837, 0.081515, 0.004932, - -0.028445, -0.073753, 0.010629, 0.080042, 0.09871, - -0.014017, 0.057597, 0.00101, 0.071658, -0.06757, - 0.074384, 0.110366, -0.018121, -0.108754, 0.037793, - 0.028041, -0.047508, -0.031359, -0.098913, -0.036486, - -0.017311, -0.001279, -0.013694, 0.051968, 0.036512, - 0.088201, 0.031155, -0.043442, -0.065045, 0.023486, - 0.027, 0.104768, -0.015176, -0.038754, -0.004178, - 0.003732, 0.062166, 0.085438, -0.077368, -0.101645, - -0.118347, 0.007589, -0.056489, 0.082268, 0.020253, - -0.035623, 0.034235, -0.099354, -0.061237, -0.024285, - 0.005441, -0.039694, -0.025957, -0.004411, 0.049903, - 0.00304, 0.036243, 0.023552, -0.007334, 0.128963, - -0.077727, -0.059175, -0.019437, -0.024872, 0.004339, - 0.084006, -0.076605, -0.102261, 0.036714, -0.035205, - -0.007642, -0.005125, -0.030525, 0.09639, -0.053138, - -0.002192, -0.024851, 0.050645, 0.04149, -0.043183, - 0.046796, -0.050894, 0.055023, 0.133834, -0.024013, - 0.000872, -0.057072, -0.00063, 0.04207, -0.129339, - -0.064283, 0.037836, -0.066393, 0.004438, 0.125379, - -0.062213, -0.067468, 0.090177, -0.046094, -0.025725, - 0.079101, -0.074909, -0.04373, -0.073483, 0.069672, - -0.020413, -7.9e-05, -0.049725, -0.120751, -0.04698, - 0.039894, 0.072305, 0.009798, 0.005613, -0.045217, - 0.006862, 0.036285, 0.074819, -0.006747, 0.015144, - -0.071562, 0.012324, -0.001082, 0.014835, 0.07996, - -0.027804, 0.103358, -0.017203, 0.014914, -0.056687, - 0.030827, 0.028076, 0.003395, -0.073255, 0.11031, - 0.056498, -0.044893, 0.110122, -0.109058, -0.052302, - -0.001604, -0.089977, -0.060548, 0.107808, 0.025463, - -0.070203, -0.000513, -0.123913, 0.046247, -0.085392, - 0.096343, 0.09589, -0.06495, 0.070363, 0.034272, - 0.037773, -0.07695, 0.124858, -0.009008, -0.010115, - 0.083868, 0.051242, 0.039149, 0.015185, 0.083375, - 0.029773, -0.045961, 0.100395, 0.003743, -0.138294, - -0.041755, 0.010806, 0.057797, -0.147374, 0.095858, - -0.009929, -0.103347, -0.03231, -0.11056, 0.121377, - 0.145244, 0.017079, -0.080587, 0.020516, -0.044939, - -0.010477, 0.038347, -0.003466, -0.001618, 0.0196, - -0.021762, 0.125482, 0.011074, 0.065815, 0.040298, - 0.009202, -0.051686, 0.129684, -0.131135, 0.044536, - 0.009313, 0.102518, -0.075351, 0.054338, 0.020273, - -0.045753, 0.031345, 0.000407, -0.097294, -0.000416, - -0.007466, -0.044972, -0.078744, 0.042414, 0.066624, - 0.030318, -0.067852, 0.061416, -0.028992, 0.056606, - 0.004038, -0.036253, -0.014279, 0.023123, -0.007832, - -0.000137, -0.027684, -0.127648, -0.007713, -0.008746, - -0.0265, 0.049032, -0.183319, 0.059107, 0.0665, - 0.016902, -0.093331, 0.090129, 0.016648, -0.083492, - -0.023669, -0.010473, 0.027614, 0.145068, 0.000681, - 0.044133, -0.035809, 0.005668, -0.090461, -0.090732, - -0.033927, 0.042997, 0.0217, -0.046955, 0.044487, - -0.026444, -0.061011, 0.01011, -0.023804, 0.030427, - -0.015195, -0.155603, -0.016584, 0.021461, -0.003528, - -0.059784, 0.032214, 0.000847, -0.098859, -0.07898, - 0.043188, 0.066433, 0.062309, 0.144507, 0.006865, - -0.068953, 0.046698, 0.099369, 0.043354, -0.014309, - -0.033202, -0.00295, 0.040734, 0.083454, 0.039319, - 0.051358, 0.006074, -0.073465, -0.090554, -0.120787, - -0.040676, 0.092412, -0.085151, -0.021699, 0.005813, - 0.103135, 0.024964, 0.025832, -0.075982, 0.035699, - -0.02731, -0.153007, 0.03642, 0.0576, 0.08163, - 0.001605, -0.054191, -0.033043, -0.01439, -0.071383, - 0.03618, 0.03586, -0.04698, 0.038541, -0.044757, - -0.078032, -0.029878, 0.078183, 0.082251, 0.010549, - 0.053317, -0.038231, -0.06561, 0.055798, 0.037504, - 0.076317, -0.027605, 0.010349, 0.095361, -0.088636, - 0.049089, 0.113316, 0.051084, 0.038589, 0.03433, - -0.055948, -0.037217, -0.015418, -0.139976, 0.036306, - 0.039306, -0.009889, -0.04491, 0.016559, -5e-05, - 0.106073, 0.01528, -0.002563, -0.109085, -0.048475, - -0.035319, 0.16386, 0.032981, -0.044932, 0.003227, - -0.123233, -0.010638, 0.055479, -0.003666, -0.072249, - -0.111158, 0.065365, 0.010691, 0.039119, -0.001837, - -0.118729, 0.06147, -0.002077, -0.033335, -0.060165, - -0.026081, -0.001806, -0.079616, -7.5e-05, 0.080598, - 0.032908, -0.03514, -0.003136, -0.029024, 0.094622, - -0.075773, -0.022898, -0.014817, 0.058393, -0.111505, - 0.036794, -0.01576, -0.112602, 0.030323, 0.085897, - -0.020834, 0.056079, -0.103762, 0.117671, -0.041205, - 0.041684, -0.084336, 0.034186, 0.011973, -0.006313, - 0.040836, -0.035709, 0.03417, 0.122672, 0.090973, - -0.053182, -0.059371, 0.091017, -0.090998, -0.116986, - 0.001405, 0.138364, 0.017107, -0.064076, 0.103486, - -0.031142, -0.030068, 0.046547, -0.133471, -0.042055, - 0.140418, -0.125084, 0.035218, -0.001162, -0.02113, - -0.012034, 0.097413, -0.079006, -0.03903, -0.054011, - 0.143887, 0.078835, -0.000601, -0.021173, -0.039895, - -0.02505, 0.075865, 0.039221, 0.032458, 0.038206, - -0.038873, -0.085003, -0.032736, -0.026956, 0.113525, - -0.023933, 0.120794, -0.003862, -0.026459, -0.138724, - 0.089559, 0.029002, -0.052098, -0.085692, 0.115174, - 0.083497, 0.024179, 0.119021, -0.067541, 0.019047, - -0.02772, -0.086083, -0.055329, 0.020087, -0.027086, - -0.047858, -0.051975, -0.035205, -0.059342, -0.068582, - 0.058936, 0.044141, -0.080315, 0.119744, -0.046518, - -0.064588, -0.027212, 0.147823, 0.032404, 0.01669, - 0.024302, 0.08556, -0.001525, 0.016469, 0.038891, - -0.020146, 0.019943, 0.045067, 0.03807, -0.086274, - -0.025769, 0.044192, 0.102141, -0.064765, 0.055849, - 0.048803, -0.030066, -0.00922, -0.116655, 0.068295, - 0.04758, -0.076138, -0.070307, 0.047582, -0.111342, - 0.004656, -0.004452, 0.029703, -0.004259, 0.01113, - 0.014446, 0.166086, 0.059565, 0.000985, -0.052607, - 0.013251, 0.094476, 0.106216, 0.016715, -0.025581, - -0.101244, 0.072897, -0.114526, 0.024681, 0.010784, - -0.051759, 0.032389, -0.050202, -0.083316, 0.052334, - -0.0351, -0.116721, -0.110336, -0.053391, 0.065541, - -0.02979, -0.020457, 0.135285, -0.004142, 0.111508, - -0.030936, 0.018549, -0.016034, 0.018572, -0.084336, - -0.048615, -0.018739, -0.096815, -0.090162, 0.01941, - -0.040821, -0.009925, -0.097427, 0.091891, 0.031793, - -0.024598, -0.132848, 0.078353, 0.089339, -0.068562, - -0.020779, 0.040974, -0.055675, 0.169131, 0.029649, - 0.078165, -0.050679, -0.005881, -0.004983, -0.104324, - -0.069096, 0.12796, 0.011392, -0.000769, 0.062168, - -0.079842, 0.001606, 0.089284, -0.035465, 0.031075, - 0.029519, -0.102956, -0.010902, -0.06403, -0.019669, - 0.057492, 0.075802, -0.008904, -0.060743, -0.053144, - 0.005126, 0.06298, 0.085674, 0.019895, 0.104448, - -0.086473, 0.056906, 0.056795, -0.01294, 0.036606, - -0.008604, -0.04045, 0.042062, 0.04181, 0.02768, - -0.092256, 0.091237, -0.0395, 0.024761, -0.088978, - 0.068585, 0.088295, -0.048033, -0.017808, 0.04537, - 0.1246, -0.03532, 0.056751, 0.092751, 0.054025, - -0.015725, -0.061938, 0.036806, 0.078768, -0.016065, - 0.002444, -0.023887, -0.072177, -0.02979, -0.00586, - 0.015478, 0.129142, -0.091024, 0.071482, -0.065445, - 0.005867, -0.006051, 0.098646, 0.054089, 0.018713, - 0.033837, -0.008355, -0.051959, 0.05744, 0.160305, - -0.001863, 0.016738, -0.033705, 0.062233, -0.140759, - 0.027342, 0.060074, 0.030362, -0.117875, 0.06102, - -0.028026, -0.088238, -0.003782, -0.146288, -0.080395, - 0.050048, 0.036136, 0.0195, 0.066902, 0.020355, - 0.024817, -0.056254, -0.140918, -0.085803, 0.02054, - -0.00373, 0.161411, -0.049408, 0.000219, -0.002348, - -0.055021, 0.06782, 0.126483, -0.031063, -0.119299, - -0.102834, 0.001133, 0.010172, 0.107707, -0.029106, - -0.059813, 0.036698, -0.02172, -0.043189, -0.00227, - -0.031694, 0.009605, -0.022459, -0.036417, 0.053675, - 0.061561, -0.012723, 0.05004, -0.02945, 0.131044, - -0.124516, -0.107579, -0.012171, 0.011761, 0.002599, - 0.016327, -0.060854, -0.08091, 0.030875, -0.002997, - -0.02097, -0.01188, -0.086096, 0.037912, 0.012421, - 0.055253, -0.00725, 0.04174, 0.055596, -0.02442, - -0.017564, -0.079202, 0.008897, 0.180091, 0.05449, - 0.001772, -0.022151, -0.082048, -0.010559, -0.163377, - -0.02066, -0.017827, -0.0308, -0.045856, 0.122405, - -0.052946, -0.13049, 0.097383, -0.116737, 0.039855, - 0.056504, -0.059549, -0.059931, -0.018658, 0.034898, - 0.054889, 0.005373, -0.066796, -0.12736, 0.04796, - 0.071746, 0.02741, -0.006212, 0.024132, -0.094062, - 0.005369, -0.008926, 0.073085, -0.014265, -0.029204, - -0.100025, -0.072076, 0.014651, 0.069368, 0.048275, - -0.066823, 0.086074, 0.014921, -0.015395, -0.045138, - 0.026224, 0.000902, -0.038208, -0.035221, 0.057397, - 0.097606, -0.073195, 0.051626, -0.033488, 0.027813, - 0.00207, -0.09751, -0.057877, 0.12668, -0.082194, - -0.072597, 0.006014, -0.093185, -0.016853, -0.02279, - 0.138461, 0.005394, -0.056485, 0.102778, 0.028918, - -0.045604, -0.060041, 0.121251, 0.02926, -0.101404, - 0.061194, 0.033039, -0.016798, 0.064263, 0.065144, - 0.010925, 0.023151, 0.107623, 0.027977, -0.090356, - -0.024863, -0.00644, 0.04787, -0.047486, 0.088211, - -0.012139, -0.116121, -0.000525, -0.140961, 0.016604, - 0.06349, -0.022732, -0.046944, 0.06697, -0.068838, - 0.016143, 0.026202, -0.043344, -0.064881, 0.024877, - -0.072845, 0.120531, 0.077901, 0.047272, 0.011713, - -0.044646, 0.040932, 0.076164, -0.101233, -0.029615, - -0.065118, 0.050966, -0.023273, 0.053517, 0.02371, - -0.007489, 0.035822, 0.023439, -0.055528, -0.004033, - -0.007662, -0.096546, -0.081662, 0.037141, 0.137562, - 0.075526, -0.097496, 0.12399, 0.013996, 0.087005, - -0.019788, -0.082043, 0.020524, 0.007027, -0.021537, - -0.036264, -0.090952, -0.177722, -0.009306, -0.031473, - -0.009287, 0.047557, -0.090241, 0.089347, 0.056375, - -0.005506, -0.112128, 0.004356, 0.064421, -0.038478, - -0.035674, 0.040616, 0.007731, 0.160236, -0.054199, - -0.007537, 0.012434, 0.022001, -0.021567, -0.075163, - -0.026053, 0.015909, 0.041015, 0.021832, 0.034152, - -0.048539, -0.086655, 0.047465, 0.000682, 0.04264, - 0.023697, -0.095971, -0.022874, -0.000369, 0.003413, - 0.046005, 0.064807, 0.010131, -0.129517, -0.092254, - 0.116469, 0.053796, 0.03811, 0.09447, 0.018435, - -0.034803, 0.073591, 0.108348, 0.104096, 0.049884, - -0.021274, 0.022097, 0.065347, 0.065555, 0.089319, - 0.000474, -0.004186, -0.040493, -0.065543, -0.083167, - -0.017425, 0.049177, -0.044248, 0.008399, 0.06818, - 0.154778, 0.027549, -0.008012, 0.01495, 0.043254, - 0.039599, -0.136415, -0.018716, 0.0619, 0.031263, - 0.058118, -0.0372, -0.114692, -0.080876, -0.053238, - 0.077436, 0.015015, -0.092517, 0.005804, -0.065541, - -0.005653, -0.073184, 0.095594, 0.08247, 0.060989, - -0.000262, -0.035766, -0.083441, 0.122634, 0.088429, - -0.014397, -0.055434, -0.005659, 0.069697, -0.064892, - 0.008824, 0.082498, 0.051866, -0.03607, 0.033403, - -0.082855, -0.087376, 0.002714, -0.097121, -0.01917, - 0.027179, -0.06987, -0.009316, 0.04745, 0.040657, - 0.060527, 0.00462, -0.040264, -0.051228, -0.029023, - -0.071384, 0.101421, 0.009538, -0.099185, 0.0601, - -0.048395, -0.024677, 0.025125, -0.056043, -0.058045, - -0.054059, 0.008107, 0.021078, 0.04529, -0.018459, - -0.113359, 0.014009, -0.006826, -0.052747, 0.046922, - -0.075976, 0.008538, -0.084411, -0.004369, 0.045801, - 0.075392, -0.06734, 0.014454, 0.032407, 0.092478, - -0.061859, -0.083458, 0.051442, 0.031695, -0.080233, - 0.054028, 0.027, -0.073549, 0.0323, 0.036501, - -0.011384, -0.02078, -0.124142, 0.093905, -0.028332, - 0.039139, -0.030944, 0.079952, -0.001717, 0.013976, - 0.038005, -0.001751, -0.044097, 0.129827, 0.014385, - -0.001682, -0.063458, -0.002511, -0.07815, -0.141236, - 0.021955, 0.104851, -0.093246, -0.060019, 0.069998, - 0.004399, -0.096408, 0.059327, -0.062268, -0.074327, - 0.108063, -0.090534, -0.045654, 0.048119, 0.049187, - 0.042105, 0.043964, -0.091516, -0.047999, -0.028881, - 0.070471, 0.055401, -0.025605, 0.011176, 0.008475, - 0.022254, 0.038266, 0.048106, 0.047176, -0.017967, - -0.010978, -0.088762, 0.034806, 0.019311, 0.126815, - -0.010571, 0.053073, 0.032162, -0.00078, -0.1522, - -0.014253, -0.021954, -0.13104, -0.061376, 0.113838, - 0.060725, 0.020201, 0.102533, -0.011392, -0.052046, - -0.069625, -0.091011, -0.097954, 0.067847, 0.017856, - -0.053461, -0.040679, -0.121664, -0.077208, -0.106919, - 0.057996, 0.069756, -0.012433, 0.069569, -0.055159, - -0.024801, -0.060448, 0.1017, 0.014619, 0.03658, - -0.004526, 0.093977, -0.028211, 0.045261, 0.149736, - -0.014691, -0.007959, 0.097708, 0.107128, -0.079723, - 0.029157, 0.020116, 0.104828, -0.064208, 0.119172, - 0.039583, -0.029446, 0.006628, -0.110398, 0.004062, - 0.048132, -0.060601, 0.009448, 0.051777, -0.053127, - 0.050551, -0.001924, 0.028079, -0.050618, -0.013698, - 0.00192, 0.088162, 0.073078, 0.085795, -0.066788, - 0.014025, 0.042699, 0.176241, -0.046674, -0.034822, - -0.051433, 0.121729, -0.057076, 0.023901, 0.045075, - -0.057182, 0.05478, -0.01728, -0.146674, 0.00209, - -0.016223, -0.044841, -0.084524, -0.152479, 0.072688, - -0.006962, 0.008711, 0.127455, -0.003876, 0.053162, - -0.013682, -0.025386, -0.000427, -0.024811, -0.024474, - -0.056267, 0.062116, -0.121311, -0.053011, 0.065651, - -0.075385, -0.00868, -0.063033, 0.083039, 0.110577, - -0.000152, -0.127017, 0.055904, 0.013659, 0.005664, - -0.002852, 0.047248, 0.001128, 0.100773, 0.037274, - 0.026368, -0.042205, 0.021887, -0.020247, -0.056678, - -0.077475, 0.089799, 0.058003, 0.039741, 0.106663, - -0.016853, -0.015972, 0.075741, -0.048829, 0.015374, - -0.032657, -0.125677, -0.06206, -0.057409, -0.061287, - 0.073151, 0.050357, 0.053547, -0.059886, -0.051298, - 0.057954, -0.003817, 0.076028, 0.006757, 0.061109, - -0.03803, 0.143209, 0.092207, -0.018493, 0.062291, - 0.005751, -0.036449, 0.067582, 0.031449, 0.101894, - -0.080754, 0.011515, -0.049485, -0.016137, -0.087818, - 0.108851, 0.038222, -0.099315, -0.003117, 0.052278, - 0.107517, -0.036233, 0.06537, 0.040409, -0.057029, - -0.033167, -0.081758, -0.019502, 0.033438, 0.013365, - -0.01776, -0.025906, -0.020244, -0.078722, -0.011697, - -0.028246, 0.068647, -0.106417, 0.026956, -0.064914, - 0.062711, -0.017857, 0.151539, 0.044613, -0.01782, - 0.009085, -0.032785, -0.025795, 0.07579, 0.075667, - -0.040398, 0.058556, -0.042634, 0.093973, -0.099529, - 0.057103, 0.073562, 0.01264, -0.066141, 0.029558, - 0.060219, -0.083699, -0.054799, -0.120442, -0.000374, - 0.006521, 0.034512, -0.039558, 0.042191, 0.033865, - 0.103992, -0.014977, -0.077384, -0.05134, 0.001873, - 0.047451, 0.140612, -0.024885, -0.02142, -0.046604, - 0.030606, 0.10066, 0.076356, -0.019288, -0.09857, - -0.114463, -0.010855, -0.034657, 0.025618, -0.003356, - -0.087913, 0.064346, -0.07554, -0.091569, -0.024965, - -0.021232, -0.017255, -0.056931, -0.003104, 0.030219, - -0.020112, -0.012334, 0.035298, 0.001405, 0.161753, - -0.064618, -0.064401, -0.007218, -0.00012, -0.047208, - 0.116105, -0.056464, -0.069645, -0.007032, -0.01209, - -0.023237, 0.016, -0.039802, 0.074319, -0.012604, - 0.014863, -0.058081, 0.093219, 0.062253, -0.040302, - 0.027405, -0.128683, 0.039923, 0.116808, -0.011706, - 0.012483, -0.017698, 0.003645, -0.007588, -0.120662, - -0.032868, 0.066217, -0.031343, -0.034166, 0.146334, - -0.031228, -0.125921, 0.117756, -0.042686, -0.062094, - 0.049375, -0.112262, 0.010166, -0.073599, 0.04869, - 0.028292, 0.020076, -0.062865, -0.106114, -0.0253, - 0.066916, 0.029279, 0.028191, -0.003599, -0.040614, - 0.020491, 0.060238, 0.052747, -0.01039, -0.022389, - -0.063358, -0.028707, 0.035907, -0.011898, 0.079703, - -0.003758, 0.078051, -0.017869, 0.009045, -0.018982, - 0.034974, 0.069405, -0.018909, -0.038613, 0.083909, - 0.033935, -0.036607, 0.088891, -0.052599, -0.059839, - 0.052758, -0.068308, -0.063615, 0.126093, -0.00946, - -0.042175, -0.011113, -0.073071, 0.052086, -0.052619, - 0.049226, 0.066898, -0.045666, 0.117923, 0.053656, - -0.010739, -0.043962, 0.141903, 0.001792, -0.035469, - 0.090671, 0.043993, -0.013655, 0.018989, 0.127223, - 0.00103, -0.001154, 0.081839, -0.024979, -0.103704, - -0.07792, 0.036083, 0.06822, -0.06221, 0.11373, - -0.010501, -0.065801, 0.050885, -0.104304, 0.121937, - 0.11185, 0.00968, -0.011791, 0.001677, -0.035029, - 0.010677, 0.024572, -0.01286, -0.030323, -0.010466, - 0.011279, 0.167752, 0.003136, 0.109709, 0.007292, - 0.000987, 0.004572, 0.108706, -0.113192, -0.012431, - -0.015225, 0.073653, -0.051275, 0.077928, -0.012752, - -0.011708, 0.014172, 0.025162, -0.095378, 0.026382, - -0.028889, -0.058569, -0.129329, 0.011087, 0.061452, - 0.056893, -0.058004, 0.103586, -0.060752, 0.081824, - -0.042805, -0.015991, -0.024444, 0.028952, -0.013528, - 0.042851, 0.019988, -0.165741, -0.031012, -0.014713, - -0.026059, 0.031698, -0.134343, 0.03209, 0.020828, - 0.051674, -0.128006, 0.050856, 0.02222, -0.073513, - -0.00934, 0.013756, 0.036163, 0.098407, -0.023495, - 0.023858, 0.008121, 0.02222, -0.103489, -0.046663, - -0.033, 0.063565, 0.029224, -0.012693, 0.084202, - 0.012187, -0.051, 0.026126, -0.043293, 0.008675, - -0.019812, -0.16507, -0.014555, -0.047431, 0.01799, - -0.040073, 0.107192, 0.022228, -0.089023, -0.066885, - 0.01463, 0.073186, 0.069902, 0.072634, 0.019593, - -0.041539, 0.031788, 0.09231, 0.027223, 0.034027, - -0.051855, 0.000391, 0.007869, 0.13191, 0.069384, - 0.046276, 0.04044, -0.037093, -0.031393, -0.112828, - 0.015709, 0.096749, -0.103205, -0.021284, 0.011405, - 0.158287, -0.021028, 0.042219, -0.050759, 0.069715, - -0.042907, -0.11698, 0.014224, 0.094648, 0.028395, - 0.041535, -0.057033, -0.047607, -0.024419, -0.034905, - 0.010125, 0.036728, -0.052503, -0.001839, -0.033477, - -0.053414, -0.070394, 0.092895, 0.1006, -0.026352, - 0.080574, -0.028763, -0.059548, 0.094571, 0.091787, - 0.041437, 0.014312, 0.045792, 0.108269, -0.081586, - 0.056288, 0.137447, 0.054718, -0.032474, 0.054502, - -0.100144, -0.00646, 0.024739, -0.117043, -0.008919, - 0.070299, -0.036862, -0.014543, 0.0245, -0.015222, - 0.114975, -0.043705, 0.000421, -0.061872, -0.035148, - -0.022797, 0.128575, -0.031798, -0.086718, -0.007172, - -0.071706, -0.006833, 0.028645, -0.007011, -0.096745, - -0.142269, 0.027996, 0.06521, 0.061381, 0.000741, - -0.140531, 0.01748, -0.014986, -0.040893, -0.012718, - -0.012494, -0.021869, -0.032923, 0.016456, 0.104475, - 0.010792, -0.066178, 0.019097, -0.001893, 0.067513, - -0.092673, -0.059851, -0.045936, 0.052642, -0.0625, - 0.065013, -0.025659, -0.149301, 0.051705, 0.035692, - -0.04579, -0.007482, -0.069141, 0.149365, -0.042039, - 0.018492, -0.081315, 0.05588, 0.058158, 0.019669, - 0.063836, -0.012391, 0.007057, 0.155454, 0.033854, - -0.016532, -0.007661, 0.043113, -0.080283, -0.10867, - -0.029344, 0.093781, -0.01584, -0.068134, 0.091804, - 0.004148, -0.058507, 0.059633, -0.095883, -0.004939, - 0.086151, -0.113571, -0.019466, -0.009167, 0.003662 -}; - -const struct lsp_codebook lsp_cbjvm[] = { - /* codebook/lspjvm1.txt */ - { - 10, - 9, - 512, - codes0 - }, - /* codebook/lspjvm2.txt */ - { - 5, - 9, - 512, - codes1 - }, - /* codebook/lspjvm3.txt */ - { - 5, - 9, - 512, - codes2 - }, - { 0, 0, 0, 0 } -}; diff --git a/codebooklspmelvq.c b/codebooklspmelvq.c deleted file mode 100644 index f49ff36..0000000 --- a/codebooklspmelvq.c +++ /dev/null @@ -1,247 +0,0 @@ -/* THIS IS A GENERATED FILE. Edit generate_codebook.c and its input */ - -/* - * This intermediary file and the files that used to create it are under - * The LGPL. See the file COPYING. - */ - -#include "defines.h" - - /* /Users/erdgeist/Coding/codec2/src/codebook/lspmelvq1.txt */ -#ifdef __EMBEDDED__ -static const float codes0[] = { -#else -static float codes0[] = { -#endif - 640.185, 893.139, 1393.85, 1494.06, 1656.26, 1700.82, - 558.516, 716.906, 1057.36, 1182.62, 1503.8, 1610.03, - 615.108, 769.622, 1120.16, 1222.84, 1366.46, 1465.05, - 663.458, 736.833, 964.764, 1043.54, 1623.17, 1681.29, - 487.957, 577.723, 1017.43, 1177.04, 1552.1, 1615.69, - 536.099, 733.407, 1292.28, 1406.09, 1577.7, 1637.49, - 473.015, 542.559, 877.397, 1285.82, 1591.04, 1647.44, - 525.343, 652.014, 1206.83, 1493.96, 1647.97, 1698.3, - 510.887, 572.868, 945.226, 1445.68, 1678.17, 1705.53, - 534.915, 721.265, 1275.92, 1415.76, 1648.5, 1695.73, - 865.189, 1047, 1267.14, 1389.32, 1646.57, 1696.97, - 608.033, 869.887, 1300.95, 1432.87, 1639.74, 1689.41, - 554.972, 649.352, 866.845, 979.873, 1645.31, 1695.39, - 696.079, 813.97, 1102.49, 1219.79, 1536.49, 1621.94, - 553.879, 691.097, 1200.84, 1339.34, 1629.08, 1683.5, - 778.561, 997.776, 1258.63, 1390.34, 1601.99, 1657.86, - 713.107, 778.893, 992.875, 1051.95, 1497.45, 1650.66, - 490.27, 598.18, 1116.02, 1244.13, 1622.26, 1672.21, - 448.556, 512.085, 1271.7, 1448.18, 1579.37, 1642.48, - 465.688, 535.312, 1099.19, 1535.79, 1684.29, 1710.9, - 812.222, 1087.53, 1470.44, 1559.73, 1692.18, 1726.38, - 428.174, 489.426, 1160.33, 1409.3, 1597.5, 1651.3, - 712.81, 957.56, 1433.02, 1516.37, 1675.39, 1710.06, - 717.255, 934.073, 1305.2, 1436.72, 1647.2, 1693.09, - 492.888, 580.393, 1339.52, 1461.07, 1592, 1653.42, - 550.467, 675.888, 990.888, 1177.44, 1615.64, 1658, - 714.528, 801.792, 1072.94, 1146.08, 1637.06, 1706.58, - 513.819, 590.989, 798.691, 895.755, 1557.76, 1624.56, - 436.653, 518.413, 1281.99, 1547.08, 1685.12, 1717.76, - 681.854, 758.354, 1046.65, 1120.92, 1412.25, 1603.42, - 873.962, 1118.49, 1376.61, 1465.07, 1665.38, 1707.18, - 553.529, 634.092, 1144.77, 1284.8, 1542.87, 1620.63, - 448.532, 519.097, 1054.57, 1319.66, 1591.26, 1649.85, - 742.267, 885.293, 1152.83, 1318.51, 1569.36, 1631.45, - 529.03, 654.522, 1355.76, 1511.75, 1662.39, 1706.4, - 463.794, 597.77, 1176.05, 1366.13, 1629.37, 1678.01, - 626.936, 706.66, 1058.04, 1323.62, 1473.28, 1599.68, - 477.322, 615.5, 1488.89, 1550.5, 1683.1, 1712.34, - 547.442, 815.442, 1313.38, 1486.96, 1671.97, 1717.4, - 610.671, 819.955, 1219.11, 1363.66, 1592.05, 1654.31, - 547.414, 746.54, 1438.43, 1517.72, 1659.64, 1695.57, - 604.823, 821.146, 1137.94, 1358.29, 1598.94, 1655.64, - 525.935, 616.739, 1060.13, 1427.33, 1593.35, 1657.48, - 622.5, 762.143, 1318.65, 1410.96, 1618.12, 1680.06, - 436.917, 516.583, 1390.29, 1475.86, 1594.71, 1633.74, - 792.487, 1031.24, 1362.62, 1472.68, 1649.26, 1697.35, - 457.707, 526.207, 865.966, 1120.47, 1564.83, 1625.28, - 526.39, 624.21, 1269.65, 1374.23, 1558.07, 1620.96, - 483.768, 573.505, 1440.66, 1512.43, 1622.37, 1671.31, - 953.061, 1194.03, 1416.67, 1515.82, 1678.82, 1718.21, - 499.947, 627.358, 1299.94, 1394.23, 1643.17, 1685.33, - 648.723, 838.181, 1225.5, 1383.45, 1637.46, 1691.67, - 672.588, 1022.6, 1346.21, 1443.75, 1651.15, 1695.43, - 581.833, 674.944, 955.167, 1020.5, 1370.5, 1503.11, - 536.143, 652.531, 1243.84, 1315.27, 1425.1, 1505.73, - 560.558, 786.65, 1224.66, 1373.98, 1630.06, 1682.68, - 591.926, 783.722, 982, 1140.81, 1581.61, 1625.28, - 548.537, 644.524, 940.451, 1048.74, 1557.89, 1609.48, - 516.916, 723.253, 1135.95, 1309.19, 1600.08, 1669.48, - 426.521, 506.077, 1457.73, 1535.02, 1641.35, 1678.45, - 645.189, 776.595, 1020.78, 1240.07, 1597, 1648.7, - 637.105, 941.474, 1242.21, 1372.49, 1646.7, 1694.8, - 691.228, 788.141, 1202.12, 1294.89, 1626.97, 1681.77, - 699.08, 886.655, 1300.9, 1399.28, 1579.94, 1646.79 -}; - /* /Users/erdgeist/Coding/codec2/src/codebook/lspmelvq2.txt */ -#ifdef __EMBEDDED__ -static const float codes1[] = { -#else -static float codes1[] = { -#endif - 4.44342, 51.1708, 7.45726, -27.4373, -18.5056, -18.1989, - 51.58, 63.3166, 57.7796, -44.1591, -18.4834, -6.93392, - -20.2795, -21.7454, 4.66947, 52.1569, 30.4367, 36.8582, - -29.1104, -5.63933, -3.45383, -63.0261, -20.4423, -19.0485, - 2.91622, 40.8374, 16.579, -51.8461, 38.5045, 18.1728, - -20.6977, -11.4022, -36.6173, -16.6116, -56.8965, -24.301, - -20.2385, 26.6332, 33.1191, 27.6284, -36.7493, -25.6041, - 54.9871, 0.71748, 23.0674, -22.1031, 11.6643, 10.9938, - -62.7215, 21.7547, 21.2907, -7.64891, -4.5533, -9.71777, - -9.56338, -3.85841, 25.0454, -9.45216, 6.05017, 5.35043, - 47.3823, 56.6122, -27.0315, -24.67, 4.86343, -0.225495, - 26.3997, 26.7857, -1.66167, 62.8366, -19.7653, -8.55169, - -8.77648, -9.04545, -7.88996, 28.2433, -35.0963, -21.9709, - 14.8423, 25.4563, -56.1262, -50.2934, -22.9393, -15.8113, - 4.94186, 27.7798, 8.34579, 10.8553, -3.12587, -3.97807, - 12.6426, -52.2317, 37.2487, -57.2067, -14.5125, -5.54035, - 13.485, 15.3246, -23.9644, -21.3135, 19.5779, 14.1597, - -55.3543, -45.2077, 10.5185, 43.0461, -24.9859, -19.3484, - 27.7226, 32.1882, 20.0321, 24.3328, -72.8194, -51.1823, - -31.3818, -5.25745, -43.7806, 14.1312, 17.6392, 9.81024, - -48.26, -26.2973, -44.1428, -31.9001, 22.5085, -0.467938, - 7.37202, -7.79071, -12.5732, 27.1074, 9.34052, 14.4477, - 14.5295, 8.82597, 57.0009, -16.3234, -32.4142, -21.0224, - 32.4616, 48.6062, 38.5452, 9.77182, 1.82856, 11.5063, - -43.8275, -22.6263, -29.8278, 13.6115, 9.66849, -63.5218, - -11.9967, 2.74308, -73.6375, -20.9809, -4.11839, 7.71405, - 24.0162, -2.29513, -6.80983, -26.4043, -21.8529, -16.3381, - -16.1484, 35.9086, -3.0837, 3.83958, 42.3003, 17.5003, - 54.1225, -48.7513, -14.8712, -38.1256, 15.2903, 7.33079, - 53.0929, 13.9221, 10.6536, 24.345, -16.5952, -16.0365, - 33.1415, 38.5714, -26.0251, 22.021, 15.6866, 13.2593, - 15.7194, -49.4061, 31.4552, 10.1896, 0.219911, 1.62902, - 4.10868, 14.2755, 58.475, -1.16668, 52.6265, 43.4938, - 358.653, -112.587, 85.9867, 52.08, -52.88, -249.24, - -12.5792, -6.64039, -33.0106, 1.51449, 50.3259, 61.6091, - -6.81685, 14.3146, 14.1563, 53.6363, 83.6051, 38.174, - -18.0006, 41.3575, -46.3736, 8.47794, -10.4611, -11.3847, - 28.7711, 31.4689, -39.5744, 1.43977, -37.7309, -30.5309, - -34.4692, -11.0778, 44.4681, -60.0045, -44.9729, -34.8364, - 38.7401, 41.0529, -7.92946, 20.0279, 74.4246, 54.6498, - 81.8008, 133.531, -5.47375, 34.4759, 75.7417, 52.6112, - -61.5067, -76.6328, -47.2471, -43.5928, -9.46878, 0.832598, - -11.544, -44.7728, -13.9257, -3.32122, 24.816, 21.9064, - 2.83945, -45.0522, -36.8776, -14.7577, -11.9912, -8.75366, - -8.97657, -14.0499, 39.2628, 48.8038, -14.3789, -4.79625, - 31.6292, 32.0168, 5.52278, -79.8411, -24.1789, -15.7597, - 15.893, 10.4667, -43.9057, -20.4885, 80.7594, 6.8023, - 22.3285, -69.4942, -5.16156, 48.8868, 4.01995, -3.04376, - 31.4062, -20.0952, -55.1259, 0.505988, 20.86, 15.0816, - -12.9696, 37.2548, 18.1009, 51.0767, 18.2053, 19.8474, - -45.4855, -45.3454, -4.22795, -15.8693, -6.07272, -1.99631, - -9.25462, 45.0241, 70.2879, -44.4484, 2.63165, 4.15336, - -51.1589, -27.7586, 19.7999, -9.87882, 63.4125, 48.3124, - -8.94084, -13.4815, -44.9602, 52.839, -17.2582, -1.59439, - 23.18, -3.00374, 33.162, 31.5424, 29.111, 25.9327, - -28.4665, -10.6868, 88.7543, -3.88024, 17.5881, 13.7336, - -10.6578, 7.43021, -20.945, -17.6491, -11.2815, -10.8001, - -35.6182, -6.90301, 3.92829, 26.9695, 2.8894, 5.01685, - -3.78263, -19.2095, -10.5568, -67.7468, 20.3733, 29.552, - 53.8109, -33.8374, -27.8223, -7.73289, -31.3462, -23.5678, - -38.8762, -17.7679, 11.457, 28.4607, 50.7006, -19.2488, - -44.6024, -60.2806, 56.35, 21.7545, 5.23677, 7.66608, - -3.80758, -39.1425, 28.8305, -3.09285, -42.7534, -25.1803, - 45.2559, 28.8742, 60.0723, 64.461, 3.51203, -27.883 -}; - /* /Users/erdgeist/Coding/codec2/src/codebook/lspmelvq3.txt */ -#ifdef __EMBEDDED__ -static const float codes2[] = { -#else -static float codes2[] = { -#endif - -9.63558, 27.5501, 15.4445, -4.34872, -1.8587, 1.27054, - -15.5343, 23.0515, -15.4436, -2.01887, -6.19433, -13.5085, - 8.38867, -1.60998, -32.3903, 10.1765, 1.9467, 12.2454, - -3.06306, -9.55983, 14.367, -1.87159, 19.6192, -3.78366, - -18.495, -13.3811, -23.8928, -20.3745, -6.87856, -17.4887, - 15.4925, 14.707, -0.0697855, 15.7541, 12.6051, -3.19768, - 9.60466, -4.56494, 10.1616, 15.5594, 6.89224, -31.5602, - -11.5625, -23.0872, 34.9163, 12.3052, 7.67426, -1.26298, - 2.5486, -3.90251, -19.1132, 7.6131, -31.0016, 12.4759, - 2.74156, 12.4124, -39.5057, -0.325024, -22.9186, -28.5606, - 6.30148, 15.4402, -2.6284, -20.1603, 5.22906, -12.3451, - -6.91862, 16.6335, -1.65064, 2.99602, -23.9479, -1.43947, - -14.3907, -31.417, 10.1113, 1.70013, -21.5733, 4.736, - -1.67171, 6.22751, -13.7187, 21.0936, -9.69243, -10.5756, - 2.15266, 21.2198, -13.0171, -1.43135, 18.8831, 10.6664, - 13.8913, 27.3565, 0.472838, -7.40477, -14.8705, 25.7448, - 28.402, -2.05484, -9.32712, -17.3169, 15.643, 6.96908, - -15.863, -17.8482, -24.9238, 12.5574, 7.17566, 0.0161972, - 5.99291, -41.0228, 1.95791, -6.78012, 9.20162, 4.6234, - -6.33629, -7.61679, 27.7318, -8.9214, -14.1931, 7.88247, - -12.2367, -21.245, -2.5927, 13.7776, -2.7864, -24.5072, - 23.15, -9.93687, -2.92559, 3.88086, 11.2667, 11.1998, - 9.67437, -9.4269, 6.2582, 36.5694, 2.88654, 1.82052, - 15.385, -2.88243, 19.8377, -14.5111, 5.92264, -2.55757, - -20.9648, 3.76147, 18.5074, -13.5547, -7.84261, -19.98, - 24.6032, 16.989, -19.1622, 1.35535, -0.0122027, 0.166227, - 9.98886, -6.89666, -20.5111, -2.89196, 2.58467, -17.049, - -9.17761, -23.7209, 12.6088, -18.2654, 2.17718, -13.0865, - -9.73326, -12.2682, 6.80914, 20.3469, -10.2912, 4.85191, - -5.19406, 6.78014, 18.0099, 14.3782, -0.124328, -10.0141, - -4.69806, 6.71393, -19.1371, 8.19814, 23.3987, -10.3316, - 1.02965, -4.63654, 21.9822, 11.5088, -30.9617, -20.6354, - -33.2824, 31.4666, -11.4837, 11.5144, -1.36834, 9.44599, - -37.5431, -3.16317, -2.09497, -2.62712, 40.4714, -33.0527, - -8.79595, -15.5174, -15.7916, 7.97003, 37.2542, 40.7063, - -14.7261, -12.6884, 2.42105, -10.2686, 25.9033, 14.8525, - 22.9598, -16.6224, -3.64949, 4.44269, -22.3897, 13.6968, - -10.874, 4.18931, -24.2284, -3.63764, -15.1379, 40.9515, - 28.2393, -8.63225, -12.544, 28.8282, -0.987894, -4.9824, - -25.0777, -0.481678, -3.37082, 5.55114, -9.89898, -8.07628, - 23.3581, 3.12034, -8.63348, 0.63042, -18.2216, -22.1886, - 44.9505, 19.8267, 23.7129, 8.58075, 7.80458, 1.78796, - -8.13112, -2.1262, -7.12776, -25.0529, -16.7287, 8.41402, - 2.01965, 19.2579, 20.0963, 5.99199, 28.1098, 5.96128, - 2.42493, -6.33216, -26.5858, -23.8607, 8.27049, 3.05805, - 0.0153248, 0.446112, -4.92759, 19.0023, 22.7346, 15.5451, - -7.39591, 40.285, 10.8414, 25.7961, -8.81069, -13.5, - 5.81306, 11.2384, 6.93765, -9.43067, 9.51418, 22.9709, - -9.17611, -16.4993, -1.56929, -2.9111, 4.17113, 10.9228, - 10.0376, -27.4993, -8.25332, -1.715, -11.5063, -10.467, - 23.6637, -13.8338, 14.7284, 8.00341, -2.71881, -8.80708, - 27.101, 2.42801, 11.4599, -24.1577, -20.9901, 4.52358, - 16.8065, 19.3315, 11.1219, 13.3391, -13.1522, 0.91428, - -25.2603, 6.04837, 12.1994, 21.9372, 14.8795, 6.93368, - -1.24639, -7.96856, 16.4064, -2.36409, -25.9093, 46.0938, - 8.81687, 24.8004, 11.4475, -13.261, -19.8693, -28.4793, - 15.3175, -12.5335, 24.1778, 10.5133, 22.2244, 9.93191, - -18.7982, 38.939, -20.0631, -35.4052, 7.5879, -0.599373, - -18.1388, 9.5843, 17.4375, -21.057, 8.1634, 6.31216, - -61.5486, -8.71159, 19.7502, -25.2365, 3.56558, -1.64973, - -26.9863, 0.291017, -12.5337, -10.505, 11.0614, 4.84072, - -0.630579, -3.87056, -0.707795, -13.1306, -19.6548, -16.2436, - 4.87022, -5.90744, 3.46971, -40.0866, 16.8741, 10.3333, - -1.00985, 16.234, -0.475836, 28.3848, 1.75473, 28.2608 -}; - -const struct lsp_codebook lspmelvq_cb[] = { - /* /Users/erdgeist/Coding/codec2/src/codebook/lspmelvq1.txt */ - { - 6, - 6, - 64, - codes0 - }, - /* /Users/erdgeist/Coding/codec2/src/codebook/lspmelvq2.txt */ - { - 6, - 6, - 64, - codes1 - }, - /* /Users/erdgeist/Coding/codec2/src/codebook/lspmelvq3.txt */ - { - 6, - 6, - 64, - codes2 - }, - { 0, 0, 0, 0 } -}; diff --git a/codebookmel.c b/codebookmel.c deleted file mode 100644 index a548db5..0000000 --- a/codebookmel.c +++ /dev/null @@ -1,145 +0,0 @@ -/* THIS IS A GENERATED FILE. Edit generate_codebook.c and its input */ - -/* - * This intermediary file and the files that used to create it are under - * The LGPL. See the file COPYING. - */ - -#include "defines.h" - - /* /Users/erdgeist/Coding/codec2/src/codebook/mel1.txt */ -#ifdef __EMBEDDED__ -static const float codes0[] = { -#else -static float codes0[] = { -#endif - 550, - 600, - 650, - 700, - 750, - 800, - 850, - 900 -}; - /* /Users/erdgeist/Coding/codec2/src/codebook/mel2.txt */ -#ifdef __EMBEDDED__ -static const float codes1[] = { -#else -static float codes1[] = { -#endif - 50, - 100, - 200, - 300 -}; - /* /Users/erdgeist/Coding/codec2/src/codebook/mel3.txt */ -#ifdef __EMBEDDED__ -static const float codes2[] = { -#else -static float codes2[] = { -#endif - 800, - 850, - 900, - 950, - 1000, - 1050, - 1100, - 1150, - 1200, - 1250, - 1300, - 1350, - 1400, - 1450, - 1500, - 1650 -}; - /* /Users/erdgeist/Coding/codec2/src/codebook/mel4.txt */ -#ifdef __EMBEDDED__ -static const float codes3[] = { -#else -static float codes3[] = { -#endif - 25, - 50, - 75, - 100, - 125, - 150, - 175, - 250 -}; - /* /Users/erdgeist/Coding/codec2/src/codebook/mel5.txt */ -#ifdef __EMBEDDED__ -static const float codes4[] = { -#else -static float codes4[] = { -#endif - 1350, - 1400, - 1450, - 1500, - 1550, - 1600, - 1650, - 1700 -}; - /* /Users/erdgeist/Coding/codec2/src/codebook/mel6.txt */ -#ifdef __EMBEDDED__ -static const float codes5[] = { -#else -static float codes5[] = { -#endif - 25, - 50, - 100, - 150 -}; - -const struct lsp_codebook mel_cb[] = { - /* /Users/erdgeist/Coding/codec2/src/codebook/mel1.txt */ - { - 1, - 3, - 8, - codes0 - }, - /* /Users/erdgeist/Coding/codec2/src/codebook/mel2.txt */ - { - 1, - 2, - 4, - codes1 - }, - /* /Users/erdgeist/Coding/codec2/src/codebook/mel3.txt */ - { - 1, - 4, - 16, - codes2 - }, - /* /Users/erdgeist/Coding/codec2/src/codebook/mel4.txt */ - { - 1, - 3, - 8, - codes3 - }, - /* /Users/erdgeist/Coding/codec2/src/codebook/mel5.txt */ - { - 1, - 3, - 8, - codes4 - }, - /* /Users/erdgeist/Coding/codec2/src/codebook/mel6.txt */ - { - 1, - 2, - 4, - codes5 - }, - { 0, 0, 0, 0 } -}; diff --git a/codebooknewamp1.c b/codebooknewamp1.c index 6de33ee..4705acb 100644 --- a/codebooknewamp1.c +++ b/codebooknewamp1.c @@ -7,8 +7,12 @@ #include "defines.h" - /* /home/david/codec2-dev/src/codebook/train_120_1.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/train_120_1.txt */ +#ifdef __EMBEDDED__ static const float codes0[] = { +#else +static float codes0[] = { +#endif 6.7484, 7.6125, 6.0332, 5.2789, 1.5239, 2.2353, 2.0748, 0.5289, 0.8748, 2.5432, -2.2863, -3.191, -0.0434, -1.9857, -3.3605, 0.7069, -5.9493, -0.5672, -0.6798, -18.0977, 4.0503, 3.9086, 2.9225, 2.3773, 0.658, -0.4363, -0.0644, 2.4063, 1.3428, 2.4542, 0.5275, 0.982, -1.3277, 0.6811, 0.0273, -0.1838, -0.0222, -0.6478, -2.2405, -17.4152, 13.3284, 12.1212, 10.6531, 9.8214, 11.0388, 15.812, 19.711, 16.5488, 16.1068, 15.8771, 7.2553, 4.2486, -6.0036, -12.5476, -20.1299, -28.2803, -25.3971, -21.7907, -11.5143, -26.859, @@ -522,8 +526,12 @@ static const float codes0[] = { 18.9039, 18.0327, 13.6297, 9.7561, 7.4319, 5.3744, 2.9646, 1.7415, 0.6716, 0.6859, 2.7446, 0.5342, -4.3187, -6.1877, -6.9311, -9.8734, -11.9041, -9.1281, -8.9591, -25.169, 6.4513, 6.7843, 9.4438, 12.9549, 16.4801, 14.9093, 8.2954, 1.6877, -2.5193, -4.4922, -6.7348, -6.9853, -4.6783, 0.7181, 1.0483, -5.1128, -1.1161, -7.5305, -12.398, -27.2058 }; - /* /home/david/codec2-dev/src/codebook/train_120_2.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/train_120_2.txt */ +#ifdef __EMBEDDED__ static const float codes1[] = { +#else +static float codes1[] = { +#endif -1.2668, -1.2477, -0.0681, 3.8419, -0.0693, -1.7919, -1.5943, 0.8402, 0.155, -3.1526, -3.0204, 0.7337, -0.2603, 1.659, 0.023, 5.5893, -2.4959, 1.9604, -0.6348, 0.7999, 2.6673, 1.4923, 1.1408, -0.7478, -1.0755, -1.3421, -0.4884, 0.2535, 0.2951, 1.5088, 1.9447, -2.662, 2.3751, 1.5298, 4.1357, -6.563, -2.1766, -2.7535, -0.7706, 1.2362, -0.6415, -0.4348, -1.2178, -0.987, -1.1057, -2.1421, -2.3594, -0.4977, -4.1484, -4.712, 5.5425, 3.0695, 3.661, 2.9729, 2.4379, -1.6136, -1.3052, 2.1342, 1.9164, -0.5692, @@ -1039,14 +1047,14 @@ static const float codes1[] = { }; const struct lsp_codebook newamp1vq_cb[] = { - /* /home/david/codec2-dev/src/codebook/train_120_1.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/train_120_1.txt */ { 20, 9, 512, codes0 }, - /* /home/david/codec2-dev/src/codebook/train_120_2.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/train_120_2.txt */ { 20, 9, diff --git a/codebooknewamp1_energy.c b/codebooknewamp1_energy.c index 6ecdd7c..7e6a092 100644 --- a/codebooknewamp1_energy.c +++ b/codebooknewamp1_energy.c @@ -7,8 +7,12 @@ #include "defines.h" - /* /home/david/codec2-dev/src/codebook/newamp1_energy_q.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/newamp1_energy_q.txt */ +#ifdef __EMBEDDED__ static const float codes0[] = { +#else +static float codes0[] = { +#endif 10, 12.5, 15, @@ -28,7 +32,7 @@ static const float codes0[] = { }; const struct lsp_codebook newamp1_energy_cb[] = { - /* /home/david/codec2-dev/src/codebook/newamp1_energy_q.txt */ + /* /Users/erdgeist/Coding/codec2/src/codebook/newamp1_energy_q.txt */ { 1, 4, diff --git a/codebooknewamp2.c b/codebooknewamp2.c index c8389b0..f3e37dd 100644 --- a/codebooknewamp2.c +++ b/codebooknewamp2.c @@ -519,7 +519,7 @@ const struct lsp_codebook newamp2vq_cb[] = { /* /Users/erdgeist/Coding/codec2/src/codebook/codes_450.txt */ { 41, - 8.96578, + 9, 500, codes0 }, diff --git a/codec2.c b/codec2.c index 2697356..b27626a 100644 --- a/codec2.c +++ b/codec2.c @@ -26,33 +26,31 @@ along with this program; if not, see . */ +#include "codec2.h" + #include +#include +#include #include #include -#include #include -#include -#include "defines.h" +#include "bpf.h" +#include "bpfb.h" #include "codec2_fft.h" -#include "sine.h" -#include "nlp.h" +#include "codec2_internal.h" +#include "debug_alloc.h" +#include "defines.h" #include "dump.h" -#include "lpc.h" -#include "quantise.h" -#include "phase.h" #include "interp.h" -#include "postfilter.h" -#include "codec2.h" +#include "lpc.h" #include "lsp.h" -#include "newamp2.h" -#include "codec2_internal.h" #include "machdep.h" -#include "bpf.h" -#include "bpfb.h" -#include "c2wideband.h" - -#include "debug_alloc.h" +#include "nlp.h" +#include "phase.h" +#include "postfilter.h" +#include "quantise.h" +#include "sine.h" /*---------------------------------------------------------------------------* \ @@ -62,32 +60,30 @@ void analyse_one_frame(struct CODEC2 *c2, MODEL *model, short speech[]); void synthesise_one_frame(struct CODEC2 *c2, short speech[], MODEL *model, - COMP Aw[], float gain); -void codec2_encode_3200(struct CODEC2 *c2, unsigned char * bits, short speech[]); -void codec2_decode_3200(struct CODEC2 *c2, short speech[], const unsigned char * bits); -void codec2_encode_2400(struct CODEC2 *c2, unsigned char * bits, short speech[]); -void codec2_decode_2400(struct CODEC2 *c2, short speech[], const unsigned char * bits); -void codec2_encode_1600(struct CODEC2 *c2, unsigned char * bits, short speech[]); -void codec2_decode_1600(struct CODEC2 *c2, short speech[], const unsigned char * bits); -void codec2_encode_1400(struct CODEC2 *c2, unsigned char * bits, short speech[]); -void codec2_decode_1400(struct CODEC2 *c2, short speech[], const unsigned char * bits); -void codec2_encode_1300(struct CODEC2 *c2, unsigned char * bits, short speech[]); -void codec2_decode_1300(struct CODEC2 *c2, short speech[], const unsigned char * bits, float ber_est); -void codec2_encode_1200(struct CODEC2 *c2, unsigned char * bits, short speech[]); -void codec2_decode_1200(struct CODEC2 *c2, short speech[], const unsigned char * bits); -void codec2_encode_700(struct CODEC2 *c2, unsigned char * bits, short speech[]); -void codec2_decode_700(struct CODEC2 *c2, short speech[], const unsigned char * bits); -void codec2_encode_700b(struct CODEC2 *c2, unsigned char * bits, short speech[]); -void codec2_decode_700b(struct CODEC2 *c2, short speech[], const unsigned char * bits); -void codec2_encode_700c(struct CODEC2 *c2, unsigned char * bits, short speech[]); -void codec2_decode_700c(struct CODEC2 *c2, short speech[], const unsigned char * bits); -void codec2_encode_450(struct CODEC2 *c2, unsigned char * bits, short speech[]); -void codec2_decode_450(struct CODEC2 *c2, short speech[], const unsigned char * bits); -void codec2_decode_450pwb(struct CODEC2 *c2, short speech[], const unsigned char * bits); + COMP Aw[], float gain); +void codec2_encode_3200(struct CODEC2 *c2, unsigned char *bits, short speech[]); +void codec2_decode_3200(struct CODEC2 *c2, short speech[], + const unsigned char *bits); +void codec2_encode_2400(struct CODEC2 *c2, unsigned char *bits, short speech[]); +void codec2_decode_2400(struct CODEC2 *c2, short speech[], + const unsigned char *bits); +void codec2_encode_1600(struct CODEC2 *c2, unsigned char *bits, short speech[]); +void codec2_decode_1600(struct CODEC2 *c2, short speech[], + const unsigned char *bits); +void codec2_encode_1400(struct CODEC2 *c2, unsigned char *bits, short speech[]); +void codec2_decode_1400(struct CODEC2 *c2, short speech[], + const unsigned char *bits); +void codec2_encode_1300(struct CODEC2 *c2, unsigned char *bits, short speech[]); +void codec2_decode_1300(struct CODEC2 *c2, short speech[], + const unsigned char *bits, float ber_est); +void codec2_encode_1200(struct CODEC2 *c2, unsigned char *bits, short speech[]); +void codec2_decode_1200(struct CODEC2 *c2, short speech[], + const unsigned char *bits); +void codec2_encode_700c(struct CODEC2 *c2, unsigned char *bits, short speech[]); +void codec2_decode_700c(struct CODEC2 *c2, short speech[], + const unsigned char *bits); static void ear_protection(float in_out[], int n); - - /*---------------------------------------------------------------------------*\ FUNCTIONS @@ -108,247 +104,170 @@ static void ear_protection(float in_out[], int n); \*---------------------------------------------------------------------------*/ - -//Don't create CODEC2_MODE_450PWB for Encoding as it has undefined behavior ! -struct CODEC2 * codec2_create(int mode) -{ - struct CODEC2 *c2; - int i,l; - - // ALL POSSIBLE MODES MUST BE CHECKED HERE! - // we test if the desired mode is enabled at compile time - // and return NULL if not - - if (false == ( CODEC2_MODE_ACTIVE(CODEC2_MODE_3200, mode) - || CODEC2_MODE_ACTIVE(CODEC2_MODE_2400, mode) - || CODEC2_MODE_ACTIVE(CODEC2_MODE_1600, mode) - || CODEC2_MODE_ACTIVE(CODEC2_MODE_1400, mode) - || CODEC2_MODE_ACTIVE(CODEC2_MODE_1300, mode) - || CODEC2_MODE_ACTIVE(CODEC2_MODE_1200, mode) - || CODEC2_MODE_ACTIVE(CODEC2_MODE_700, mode) - || CODEC2_MODE_ACTIVE(CODEC2_MODE_700B, mode) - || CODEC2_MODE_ACTIVE(CODEC2_MODE_700C, mode) - || CODEC2_MODE_ACTIVE(CODEC2_MODE_450, mode) - || CODEC2_MODE_ACTIVE(CODEC2_MODE_450PWB, mode) - ) ) - { - return NULL; - } - - c2 = (struct CODEC2*)MALLOC(sizeof(struct CODEC2)); - if (c2 == NULL) - return NULL; - - c2->mode = mode; - - /* store constants in a few places for convenience */ - - if( CODEC2_MODE_ACTIVE(CODEC2_MODE_450PWB, mode) == 0){ - c2->c2const = c2const_create(8000, N_S); - }else{ - c2->c2const = c2const_create(16000, N_S); - } - c2->Fs = c2->c2const.Fs; - int n_samp = c2->n_samp = c2->c2const.n_samp; - int m_pitch = c2->m_pitch = c2->c2const.m_pitch; - - c2->Pn = (float*)MALLOC(2*n_samp*sizeof(float)); - if (c2->Pn == NULL) { - return NULL; - } - c2->Sn_ = (float*)MALLOC(2*n_samp*sizeof(float)); - if (c2->Sn_ == NULL) { - FREE(c2->Pn); - return NULL; - } - c2->w = (float*)MALLOC(m_pitch*sizeof(float)); - if (c2->w == NULL) { - FREE(c2->Pn); - FREE(c2->Sn_); - return NULL; - } - c2->Sn = (float*)MALLOC(m_pitch*sizeof(float)); - if (c2->Sn == NULL) { - FREE(c2->Pn); - FREE(c2->Sn_); - FREE(c2->w); - return NULL; - } - - for(i=0; iSn[i] = 1.0; - c2->hpf_states[0] = c2->hpf_states[1] = 0.0; - for(i=0; i<2*n_samp; i++) - c2->Sn_[i] = 0; - c2->fft_fwd_cfg = codec2_fft_alloc(FFT_ENC, 0, NULL, NULL); - c2->fftr_fwd_cfg = codec2_fftr_alloc(FFT_ENC, 0, NULL, NULL); - make_analysis_window(&c2->c2const, c2->fft_fwd_cfg, c2->w,c2->W); - make_synthesis_window(&c2->c2const, c2->Pn); - c2->fftr_inv_cfg = codec2_fftr_alloc(FFT_DEC, 1, NULL, NULL); - quantise_init(); - c2->prev_f0_enc = 1/P_MAX_S; - c2->bg_est = 0.0; - c2->ex_phase = 0.0; - - for(l=1; l<=MAX_AMP; l++) - c2->prev_model_dec.A[l] = 0.0; - c2->prev_model_dec.Wo = TWO_PI/c2->c2const.p_max; - c2->prev_model_dec.L = PI/c2->prev_model_dec.Wo; - c2->prev_model_dec.voiced = 0; - - for(i=0; iprev_lsps_dec[i] = i*PI/(LPC_ORD+1); - } - c2->prev_e_dec = 1; - - c2->nlp = nlp_create(&c2->c2const); - if (c2->nlp == NULL) { - return NULL; - } - - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_700B, mode)) - c2->gray = 0; // natural binary better for trellis decoding (hopefully added later) - else - c2->gray = 1; - - c2->lpc_pf = 1; c2->bass_boost = 1; c2->beta = LPCPF_BETA; c2->gamma = LPCPF_GAMMA; - - c2->xq_enc[0] = c2->xq_enc[1] = 0.0; - c2->xq_dec[0] = c2->xq_dec[1] = 0.0; - - c2->smoothing = 0; - c2->se = 0.0; c2->nse = 0; - c2->user_rate_K_vec_no_mean_ = NULL; - c2->post_filter_en = 1; - - c2->bpf_buf = (float*)MALLOC(sizeof(float)*(BPF_N+4*c2->n_samp)); - assert(c2->bpf_buf != NULL); - for(i=0; in_samp; i++) - c2->bpf_buf[i] = 0.0; - - c2->softdec = NULL; - - /* newamp1 initialisation */ - - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_700C, c2->mode)) { - mel_sample_freqs_kHz(c2->rate_K_sample_freqs_kHz, NEWAMP1_K, ftomel(200.0), ftomel(3700.0) ); - int k; - for(k=0; kprev_rate_K_vec_[k] = 0.0; - c2->eq[k] = 0.0; - } - c2->eq_en = 0; - c2->Wo_left = 0.0; - c2->voicing_left = 0;; - c2->phase_fft_fwd_cfg = codec2_fft_alloc(NEWAMP1_PHASE_NFFT, 0, NULL, NULL); - c2->phase_fft_inv_cfg = codec2_fft_alloc(NEWAMP1_PHASE_NFFT, 1, NULL, NULL); - } - - /* newamp2 initialisation */ - - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_450, c2->mode)) { - n2_mel_sample_freqs_kHz(c2->n2_rate_K_sample_freqs_kHz, NEWAMP2_K); - int k; - for(k=0; kn2_prev_rate_K_vec_[k] = 0.0; - } - c2->Wo_left = 0.0; - c2->voicing_left = 0;; - c2->phase_fft_fwd_cfg = codec2_fft_alloc(NEWAMP2_PHASE_NFFT, 0, NULL, NULL); - c2->phase_fft_inv_cfg = codec2_fft_alloc(NEWAMP2_PHASE_NFFT, 1, NULL, NULL); - } - /* newamp2 PWB initialisation */ - - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_450PWB, c2->mode)) { - n2_mel_sample_freqs_kHz(c2->n2_pwb_rate_K_sample_freqs_kHz, NEWAMP2_16K_K); - int k; - for(k=0; kn2_pwb_prev_rate_K_vec_[k] = 0.0; - } - c2->Wo_left = 0.0; - c2->voicing_left = 0;; - c2->phase_fft_fwd_cfg = codec2_fft_alloc(NEWAMP2_PHASE_NFFT, 0, NULL, NULL); - c2->phase_fft_inv_cfg = codec2_fft_alloc(NEWAMP2_PHASE_NFFT, 1, NULL, NULL); - } - - c2->fmlfeat = NULL; - - // make sure that one of the two decode function pointers is empty - // for the encode function pointer this is not required since we always set it - // to a meaningful value - - c2->decode = NULL; - c2->decode_ber = NULL; - - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_3200, c2->mode)) - { - c2->encode = codec2_encode_3200; - c2->decode = codec2_decode_3200; - } - - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_2400, c2->mode)) - { - c2->encode = codec2_encode_2400; - c2->decode = codec2_decode_2400; - } - - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_1600, c2->mode)) - { - c2->encode = codec2_encode_1600; - c2->decode = codec2_decode_1600; - } - - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_1400, c2->mode)) - { - c2->encode = codec2_encode_1400; - c2->decode = codec2_decode_1400; - } - - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_1300, c2->mode)) - { - c2->encode = codec2_encode_1300; - c2->decode_ber = codec2_decode_1300; - } - - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_1200, c2->mode)) - { - c2->encode = codec2_encode_1200; - c2->decode = codec2_decode_1200; - } - - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_700, c2->mode)) - { - c2->encode = codec2_encode_700; - c2->decode = codec2_decode_700; - } - - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_700B, c2->mode)) - { - c2->encode = codec2_encode_700b; - c2->decode = codec2_decode_700b; - } - - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_700C, c2->mode)) - { - c2->encode = codec2_encode_700c; - c2->decode = codec2_decode_700c; - } - - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_450, c2->mode)) - { - c2->encode = codec2_encode_450; - c2->decode = codec2_decode_450; - } - - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_450PWB, c2->mode)) - { - //Encode PWB doesnt make sense - c2->encode = codec2_encode_450; - c2->decode = codec2_decode_450pwb; - } - - - return c2; +struct CODEC2 *codec2_create(int mode) { + struct CODEC2 *c2; + int i, l; + + // ALL POSSIBLE MODES MUST BE CHECKED HERE! + // we test if the desired mode is enabled at compile time + // and return NULL if not + + if (false == (CODEC2_MODE_ACTIVE(CODEC2_MODE_3200, mode) || + CODEC2_MODE_ACTIVE(CODEC2_MODE_2400, mode) || + CODEC2_MODE_ACTIVE(CODEC2_MODE_1600, mode) || + CODEC2_MODE_ACTIVE(CODEC2_MODE_1400, mode) || + CODEC2_MODE_ACTIVE(CODEC2_MODE_1300, mode) || + CODEC2_MODE_ACTIVE(CODEC2_MODE_1200, mode) || + CODEC2_MODE_ACTIVE(CODEC2_MODE_700C, mode))) { + return NULL; + } + + c2 = (struct CODEC2 *)MALLOC(sizeof(struct CODEC2)); + if (c2 == NULL) return NULL; + + c2->mode = mode; + + /* store constants in a few places for convenience */ + + c2->c2const = c2const_create(8000, N_S); + c2->Fs = c2->c2const.Fs; + int n_samp = c2->n_samp = c2->c2const.n_samp; + int m_pitch = c2->m_pitch = c2->c2const.m_pitch; + + c2->Pn = (float *)MALLOC(2 * n_samp * sizeof(float)); + if (c2->Pn == NULL) { + return NULL; + } + c2->Sn_ = (float *)MALLOC(2 * n_samp * sizeof(float)); + if (c2->Sn_ == NULL) { + FREE(c2->Pn); + return NULL; + } + c2->w = (float *)MALLOC(m_pitch * sizeof(float)); + if (c2->w == NULL) { + FREE(c2->Pn); + FREE(c2->Sn_); + return NULL; + } + c2->Sn = (float *)MALLOC(m_pitch * sizeof(float)); + if (c2->Sn == NULL) { + FREE(c2->Pn); + FREE(c2->Sn_); + FREE(c2->w); + return NULL; + } + + for (i = 0; i < m_pitch; i++) c2->Sn[i] = 1.0; + c2->hpf_states[0] = c2->hpf_states[1] = 0.0; + for (i = 0; i < 2 * n_samp; i++) c2->Sn_[i] = 0; + c2->fft_fwd_cfg = codec2_fft_alloc(FFT_ENC, 0, NULL, NULL); + c2->fftr_fwd_cfg = codec2_fftr_alloc(FFT_ENC, 0, NULL, NULL); + make_analysis_window(&c2->c2const, c2->fft_fwd_cfg, c2->w, c2->W); + make_synthesis_window(&c2->c2const, c2->Pn); + c2->fftr_inv_cfg = codec2_fftr_alloc(FFT_DEC, 1, NULL, NULL); + c2->prev_f0_enc = 1 / P_MAX_S; + c2->bg_est = 0.0; + c2->ex_phase = 0.0; + + for (l = 1; l <= MAX_AMP; l++) c2->prev_model_dec.A[l] = 0.0; + c2->prev_model_dec.Wo = TWO_PI / c2->c2const.p_max; + c2->prev_model_dec.L = PI / c2->prev_model_dec.Wo; + c2->prev_model_dec.voiced = 0; + + for (i = 0; i < LPC_ORD; i++) { + c2->prev_lsps_dec[i] = i * PI / (LPC_ORD + 1); + } + c2->prev_e_dec = 1; + + c2->nlp = nlp_create(&c2->c2const); + if (c2->nlp == NULL) { + return NULL; + } + + c2->lpc_pf = 1; + c2->bass_boost = 1; + c2->beta = LPCPF_BETA; + c2->gamma = LPCPF_GAMMA; + + c2->xq_enc[0] = c2->xq_enc[1] = 0.0; + c2->xq_dec[0] = c2->xq_dec[1] = 0.0; + + c2->smoothing = 0; + c2->se = 0.0; + c2->nse = 0; + c2->user_rate_K_vec_no_mean_ = NULL; + c2->post_filter_en = true; + + c2->bpf_buf = (float *)MALLOC(sizeof(float) * (BPF_N + 4 * c2->n_samp)); + assert(c2->bpf_buf != NULL); + for (i = 0; i < BPF_N + 4 * c2->n_samp; i++) c2->bpf_buf[i] = 0.0; + + c2->softdec = NULL; + c2->gray = 1; + + /* newamp1 initialisation */ + + if (CODEC2_MODE_ACTIVE(CODEC2_MODE_700C, c2->mode)) { + mel_sample_freqs_kHz(c2->rate_K_sample_freqs_kHz, NEWAMP1_K, ftomel(200.0), + ftomel(3700.0)); + int k; + for (k = 0; k < NEWAMP1_K; k++) { + c2->prev_rate_K_vec_[k] = 0.0; + c2->eq[k] = 0.0; + } + c2->eq_en = false; + c2->Wo_left = 0.0; + c2->voicing_left = 0; + c2->phase_fft_fwd_cfg = codec2_fft_alloc(NEWAMP1_PHASE_NFFT, 0, NULL, NULL); + c2->phase_fft_inv_cfg = codec2_fft_alloc(NEWAMP1_PHASE_NFFT, 1, NULL, NULL); + } + + c2->fmlfeat = NULL; + c2->fmlmodel = NULL; + + // make sure that one of the two decode function pointers is empty + // for the encode function pointer this is not required since we always set it + // to a meaningful value + + c2->decode = NULL; + c2->decode_ber = NULL; + + if (CODEC2_MODE_ACTIVE(CODEC2_MODE_3200, c2->mode)) { + c2->encode = codec2_encode_3200; + c2->decode = codec2_decode_3200; + } + + if (CODEC2_MODE_ACTIVE(CODEC2_MODE_2400, c2->mode)) { + c2->encode = codec2_encode_2400; + c2->decode = codec2_decode_2400; + } + + if (CODEC2_MODE_ACTIVE(CODEC2_MODE_1600, c2->mode)) { + c2->encode = codec2_encode_1600; + c2->decode = codec2_decode_1600; + } + + if (CODEC2_MODE_ACTIVE(CODEC2_MODE_1400, c2->mode)) { + c2->encode = codec2_encode_1400; + c2->decode = codec2_decode_1400; + } + + if (CODEC2_MODE_ACTIVE(CODEC2_MODE_1300, c2->mode)) { + c2->encode = codec2_encode_1300; + c2->decode_ber = codec2_decode_1300; + } + + if (CODEC2_MODE_ACTIVE(CODEC2_MODE_1200, c2->mode)) { + c2->encode = codec2_encode_1200; + c2->decode = codec2_decode_1200; + } + + if (CODEC2_MODE_ACTIVE(CODEC2_MODE_700C, c2->mode)) { + c2->encode = codec2_encode_700c; + c2->decode = codec2_decode_700c; + } + + return c2; } /*---------------------------------------------------------------------------*\ @@ -361,31 +280,22 @@ struct CODEC2 * codec2_create(int mode) \*---------------------------------------------------------------------------*/ -void codec2_destroy(struct CODEC2 *c2) -{ - assert(c2 != NULL); - FREE(c2->bpf_buf); - nlp_destroy(c2->nlp); - codec2_fft_free(c2->fft_fwd_cfg); - codec2_fftr_free(c2->fftr_fwd_cfg); - codec2_fftr_free(c2->fftr_inv_cfg); - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_700C, c2->mode)) { - codec2_fft_free(c2->phase_fft_fwd_cfg); - codec2_fft_free(c2->phase_fft_inv_cfg); - } - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_450, c2->mode)) { - codec2_fft_free(c2->phase_fft_fwd_cfg); - codec2_fft_free(c2->phase_fft_inv_cfg); - } - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_450PWB, c2->mode)) { - codec2_fft_free(c2->phase_fft_fwd_cfg); - codec2_fft_free(c2->phase_fft_inv_cfg); - } - FREE(c2->Pn); - FREE(c2->Sn); - FREE(c2->w); - FREE(c2->Sn_); - FREE(c2); +void codec2_destroy(struct CODEC2 *c2) { + assert(c2 != NULL); + FREE(c2->bpf_buf); + nlp_destroy(c2->nlp); + codec2_fft_free(c2->fft_fwd_cfg); + codec2_fftr_free(c2->fftr_fwd_cfg); + codec2_fftr_free(c2->fftr_inv_cfg); + if (CODEC2_MODE_ACTIVE(CODEC2_MODE_700C, c2->mode)) { + codec2_fft_free(c2->phase_fft_fwd_cfg); + codec2_fft_free(c2->phase_fft_inv_cfg); + } + FREE(c2->Pn); + FREE(c2->Sn); + FREE(c2->w); + FREE(c2->Sn_); + FREE(c2); } /*---------------------------------------------------------------------------*\ @@ -399,32 +309,31 @@ void codec2_destroy(struct CODEC2 *c2) \*---------------------------------------------------------------------------*/ int codec2_bits_per_frame(struct CODEC2 *c2) { - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_3200, c2->mode)) - return 64; - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_2400, c2->mode)) - return 48; - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_1600, c2->mode)) - return 64; - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_1400, c2->mode)) - return 56; - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_1300, c2->mode)) - return 52; - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_1200, c2->mode)) - return 48; - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_700, c2->mode)) - return 28; - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_700B, c2->mode)) - return 28; - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_700C, c2->mode)) - return 28; - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_450, c2->mode)) - return 18; - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_450PWB, c2->mode)) - return 18; - - return 0; /* shouldn't get here */ + if (CODEC2_MODE_ACTIVE(CODEC2_MODE_3200, c2->mode)) return 64; + if (CODEC2_MODE_ACTIVE(CODEC2_MODE_2400, c2->mode)) return 48; + if (CODEC2_MODE_ACTIVE(CODEC2_MODE_1600, c2->mode)) return 64; + if (CODEC2_MODE_ACTIVE(CODEC2_MODE_1400, c2->mode)) return 56; + if (CODEC2_MODE_ACTIVE(CODEC2_MODE_1300, c2->mode)) return 52; + if (CODEC2_MODE_ACTIVE(CODEC2_MODE_1200, c2->mode)) return 48; + if (CODEC2_MODE_ACTIVE(CODEC2_MODE_700C, c2->mode)) return 28; + + return 0; /* shouldn't get here */ } +/*---------------------------------------------------------------------------*\ + + FUNCTION....: codec2_bytes_per_frame + DATE CREATED: April 2021 + + Returns the number of bytes per frame. Useful for allocated storage for + codec2_encode()/codec2_decode(). Note the number of bits may not be a + multiple of 8, therefore some bits in the last byte may be unused. + +\*---------------------------------------------------------------------------*/ + +int codec2_bytes_per_frame(struct CODEC2 *c2) { + return (codec2_bits_per_frame(c2) + 7) / 8; +} /*---------------------------------------------------------------------------*\ @@ -437,60 +346,61 @@ int codec2_bits_per_frame(struct CODEC2 *c2) { \*---------------------------------------------------------------------------*/ int codec2_samples_per_frame(struct CODEC2 *c2) { - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_3200, c2->mode)) - return 160; - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_2400, c2->mode)) - return 160; - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_1600, c2->mode)) - return 320; - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_1400, c2->mode)) - return 320; - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_1300, c2->mode)) - return 320; - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_1200, c2->mode)) - return 320; - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_700, c2->mode)) - return 320; - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_700B, c2->mode)) - return 320; - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_700C, c2->mode)) - return 320; - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_450, c2->mode)) - return 320; - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_450PWB, c2->mode)) - return 640; - return 0; /* shouldnt get here */ + if (CODEC2_MODE_ACTIVE(CODEC2_MODE_3200, c2->mode)) return 160; + if (CODEC2_MODE_ACTIVE(CODEC2_MODE_2400, c2->mode)) return 160; + if (CODEC2_MODE_ACTIVE(CODEC2_MODE_1600, c2->mode)) return 320; + if (CODEC2_MODE_ACTIVE(CODEC2_MODE_1400, c2->mode)) return 320; + if (CODEC2_MODE_ACTIVE(CODEC2_MODE_1300, c2->mode)) return 320; + if (CODEC2_MODE_ACTIVE(CODEC2_MODE_1200, c2->mode)) return 320; + if (CODEC2_MODE_ACTIVE(CODEC2_MODE_700C, c2->mode)) return 320; + return 0; /* shouldn't get here */ } -void codec2_encode(struct CODEC2 *c2, unsigned char *bits, short speech[]) -{ - assert(c2 != NULL); - assert(c2->encode != NULL); +/*---------------------------------------------------------------------------*\ + + FUNCTION....: codec2_encode + AUTHOR......: David Rowe + DATE CREATED: Nov 14 2011 + + Take an input buffer of speech samples, and compress them to a packed buffer + of bytes. - c2->encode(c2, bits, speech); +\*---------------------------------------------------------------------------*/ -} +void codec2_encode(struct CODEC2 *c2, unsigned char *bytes, short speech[]) { + assert(c2 != NULL); + assert(c2->encode != NULL); -void codec2_decode(struct CODEC2 *c2, short speech[], const unsigned char *bits) -{ - codec2_decode_ber(c2, speech, bits, 0.0); + c2->encode(c2, bytes, speech); } -void codec2_decode_ber(struct CODEC2 *c2, short speech[], const unsigned char *bits, float ber_est) -{ - assert(c2 != NULL); - assert(c2->decode != NULL || c2->decode_ber != NULL); +/*---------------------------------------------------------------------------*\ - if (c2->decode != NULL) - { - c2->decode(c2, speech, bits); - } - else - { - c2->decode_ber(c2, speech, bits, ber_est); - } + FUNCTION....: codec2_decode + AUTHOR......: David Rowe + DATE CREATED: Nov 14 2011 + + Take an input packed buffer of bytes, and decode them to a buffer of speech + samples. + +\*---------------------------------------------------------------------------*/ + +void codec2_decode(struct CODEC2 *c2, short speech[], + const unsigned char *bytes) { + codec2_decode_ber(c2, speech, bytes, 0.0); } +void codec2_decode_ber(struct CODEC2 *c2, short speech[], + const unsigned char *bits, float ber_est) { + assert(c2 != NULL); + assert(c2->decode != NULL || c2->decode_ber != NULL); + + if (c2->decode != NULL) { + c2->decode(c2, speech, bits); + } else { + c2->decode_ber(c2, speech, bits, ber_est); + } +} /*---------------------------------------------------------------------------*\ @@ -503,60 +413,60 @@ void codec2_decode_ber(struct CODEC2 *c2, short speech[], const unsigned char *b The codec2 algorithm actually operates internally on 10ms (80 sample) frames, so we run the encoding algorithm twice. On the first frame we just send the voicing bits. On the second frame we - send all model parameters. Compared to 2400 we use a larger number - of bits for the LSPs and non-VQ pitch and energy. + send all model parameters. Compared to 2400 we encode the LSP + differences, a larger number of bits for the LSP(d)s and scalar + (non-VQ) quantisation for pitch and energy. The bit allocation is: - Parameter bits/frame - -------------------------------------- - Harmonic magnitudes (LSPs) 50 - Pitch (Wo) 7 - Energy 5 - Voicing (10ms update) 2 - TOTAL 64 + Parameter bits/frame + ------------------------------------------------------ + Harmonic magnitudes (LSP differerences) 50 + Pitch (Wo) 7 + Energy 5 + Voicing (10ms update) 2 + TOTAL 64 \*---------------------------------------------------------------------------*/ -void codec2_encode_3200(struct CODEC2 *c2, unsigned char * bits, short speech[]) -{ - MODEL model; - float ak[LPC_ORD+1]; - float lsps[LPC_ORD]; - float e; - int Wo_index, e_index; - int lspd_indexes[LPC_ORD]; - int i; - unsigned int nbit = 0; +void codec2_encode_3200(struct CODEC2 *c2, unsigned char *bits, + short speech[]) { + MODEL model; + float ak[LPC_ORD + 1]; + float lsps[LPC_ORD]; + float e; + int Wo_index, e_index; + int lspd_indexes[LPC_ORD]; + int i; + unsigned int nbit = 0; - assert(c2 != NULL); + assert(c2 != NULL); - memset(bits, '\0', ((codec2_bits_per_frame(c2) + 7) / 8)); + memset(bits, '\0', ((codec2_bits_per_frame(c2) + 7) / 8)); - /* first 10ms analysis frame - we just want voicing */ + /* first 10ms analysis frame - we just want voicing */ - analyse_one_frame(c2, &model, speech); - pack(bits, &nbit, model.voiced, 1); + analyse_one_frame(c2, &model, speech); + pack(bits, &nbit, model.voiced, 1); - /* second 10ms analysis frame */ + /* second 10ms analysis frame */ - analyse_one_frame(c2, &model, &speech[c2->n_samp]); - pack(bits, &nbit, model.voiced, 1); - Wo_index = encode_Wo(&c2->c2const, model.Wo, WO_BITS); - pack(bits, &nbit, Wo_index, WO_BITS); + analyse_one_frame(c2, &model, &speech[c2->n_samp]); + pack(bits, &nbit, model.voiced, 1); + Wo_index = encode_Wo(&c2->c2const, model.Wo, WO_BITS); + pack(bits, &nbit, Wo_index, WO_BITS); - e = speech_to_uq_lsps(lsps, ak, c2->Sn, c2->w, c2->m_pitch, LPC_ORD); - e_index = encode_energy(e, E_BITS); - pack(bits, &nbit, e_index, E_BITS); + e = speech_to_uq_lsps(lsps, ak, c2->Sn, c2->w, c2->m_pitch, LPC_ORD); + e_index = encode_energy(e, E_BITS); + pack(bits, &nbit, e_index, E_BITS); - encode_lspds_scalar(lspd_indexes, lsps, LPC_ORD); - for(i=0; ic2const, Wo_index, WO_BITS); - model[1].L = PI/model[1].Wo; + Wo_index = unpack(bits, &nbit, WO_BITS); + model[1].Wo = decode_Wo(&c2->c2const, Wo_index, WO_BITS); + model[1].L = PI / model[1].Wo; - e_index = unpack(bits, &nbit, E_BITS); - e[1] = decode_energy(e_index, E_BITS); + e_index = unpack(bits, &nbit, E_BITS); + e[1] = decode_energy(e_index, E_BITS); - for(i=0; iprev_model_dec, &model[1], c2->c2const.Wo_min); - e[0] = interp_energy(c2->prev_e_dec, e[1]); + interp_Wo(&model[0], &c2->prev_model_dec, &model[1], c2->c2const.Wo_min); + e[0] = interp_energy(c2->prev_e_dec, e[1]); - /* LSPs are sampled every 20ms so we interpolate the frame in - between, then recover spectral amplitudes */ + /* LSPs are sampled every 20ms so we interpolate the frame in + between, then recover spectral amplitudes */ - interpolate_lsp_ver2(&lsps[0][0], c2->prev_lsps_dec, &lsps[1][0], 0.5, LPC_ORD); + interpolate_lsp_ver2(&lsps[0][0], c2->prev_lsps_dec, &lsps[1][0], 0.5, + LPC_ORD); - for(i=0; i<2; i++) { - lsp_to_lpc(&lsps[i][0], &ak[i][0], LPC_ORD); - aks_to_M2(c2->fftr_fwd_cfg, &ak[i][0], LPC_ORD, &model[i], e[i], &snr, 0, 0, - c2->lpc_pf, c2->bass_boost, c2->beta, c2->gamma, Aw); - apply_lpc_correction(&model[i]); - synthesise_one_frame(c2, &speech[c2->n_samp*i], &model[i], Aw, 1.0); - } + for (i = 0; i < 2; i++) { + lsp_to_lpc(&lsps[i][0], &ak[i][0], LPC_ORD); + aks_to_M2(c2->fftr_fwd_cfg, &ak[i][0], LPC_ORD, &model[i], e[i], &snr, 0, 0, + c2->lpc_pf, c2->bass_boost, c2->beta, c2->gamma, Aw); + apply_lpc_correction(&model[i]); + synthesise_one_frame(c2, &speech[c2->n_samp * i], &model[i], Aw, 1.0); + } - /* update memories for next frame ----------------------------*/ + /* update memories for next frame ----------------------------*/ - c2->prev_model_dec = model[1]; - c2->prev_e_dec = e[1]; - for(i=0; iprev_lsps_dec[i] = lsps[1][i]; + c2->prev_model_dec = model[1]; + c2->prev_e_dec = e[1]; + for (i = 0; i < LPC_ORD; i++) c2->prev_lsps_dec[i] = lsps[1][i]; } - /*---------------------------------------------------------------------------*\ FUNCTION....: codec2_encode_2400 @@ -663,46 +571,45 @@ void codec2_decode_3200(struct CODEC2 *c2, short speech[], const unsigned char * \*---------------------------------------------------------------------------*/ -void codec2_encode_2400(struct CODEC2 *c2, unsigned char * bits, short speech[]) -{ - MODEL model; - float ak[LPC_ORD+1]; - float lsps[LPC_ORD]; - float e; - int WoE_index; - int lsp_indexes[LPC_ORD]; - int i; - int spare = 0; - unsigned int nbit = 0; +void codec2_encode_2400(struct CODEC2 *c2, unsigned char *bits, + short speech[]) { + MODEL model; + float ak[LPC_ORD + 1]; + float lsps[LPC_ORD]; + float e; + int WoE_index; + int lsp_indexes[LPC_ORD]; + int i; + int spare = 0; + unsigned int nbit = 0; - assert(c2 != NULL); + assert(c2 != NULL); - memset(bits, '\0', ((codec2_bits_per_frame(c2) + 7) / 8)); + memset(bits, '\0', ((codec2_bits_per_frame(c2) + 7) / 8)); - /* first 10ms analysis frame - we just want voicing */ + /* first 10ms analysis frame - we just want voicing */ - analyse_one_frame(c2, &model, speech); - pack(bits, &nbit, model.voiced, 1); + analyse_one_frame(c2, &model, speech); + pack(bits, &nbit, model.voiced, 1); - /* second 10ms analysis frame */ + /* second 10ms analysis frame */ - analyse_one_frame(c2, &model, &speech[c2->n_samp]); - pack(bits, &nbit, model.voiced, 1); + analyse_one_frame(c2, &model, &speech[c2->n_samp]); + pack(bits, &nbit, model.voiced, 1); - e = speech_to_uq_lsps(lsps, ak, c2->Sn, c2->w, c2->m_pitch, LPC_ORD); - WoE_index = encode_WoE(&model, e, c2->xq_enc); - pack(bits, &nbit, WoE_index, WO_E_BITS); + e = speech_to_uq_lsps(lsps, ak, c2->Sn, c2->w, c2->m_pitch, LPC_ORD); + WoE_index = encode_WoE(&model, e, c2->xq_enc); + pack(bits, &nbit, WoE_index, WO_E_BITS); - encode_lsps_scalar(lsp_indexes, lsps, LPC_ORD); - for(i=0; ic2const, &model[1], &e[1], c2->xq_dec, WoE_index); + model[1].voiced = unpack(bits, &nbit, 1); + WoE_index = unpack(bits, &nbit, WO_E_BITS); + decode_WoE(&c2->c2const, &model[1], &e[1], c2->xq_dec, WoE_index); - for(i=0; iprev_model_dec, &model[1], c2->c2const.Wo_min); - e[0] = interp_energy(c2->prev_e_dec, e[1]); - - /* LSPs are sampled every 20ms so we interpolate the frame in - between, then recover spectral amplitudes */ - - interpolate_lsp_ver2(&lsps[0][0], c2->prev_lsps_dec, &lsps[1][0], 0.5, LPC_ORD); - for(i=0; i<2; i++) { - lsp_to_lpc(&lsps[i][0], &ak[i][0], LPC_ORD); - aks_to_M2(c2->fftr_fwd_cfg, &ak[i][0], LPC_ORD, &model[i], e[i], &snr, 0, 0, - c2->lpc_pf, c2->bass_boost, c2->beta, c2->gamma, Aw); - apply_lpc_correction(&model[i]); - synthesise_one_frame(c2, &speech[c2->n_samp*i], &model[i], Aw, 1.0); - - /* dump parameters for deep learning experiments */ - - if (c2->fmlfeat != NULL) { - /* 10 LSPs - energy - Wo - voicing flag - 10 LPCs */ - fwrite(&lsps[i][0], LPC_ORD, sizeof(float), c2->fmlfeat); - fwrite(&e[i], 1, sizeof(float), c2->fmlfeat); - fwrite(&model[i].Wo, 1, sizeof(float), c2->fmlfeat); - float voiced_float = model[i].voiced; - fwrite(&voiced_float, 1, sizeof(float), c2->fmlfeat); - fwrite(&ak[i][1], LPC_ORD, sizeof(float), c2->fmlfeat); - } + for (i = 0; i < LSP_SCALAR_INDEXES; i++) { + lsp_indexes[i] = unpack(bits, &nbit, lsp_bits(i)); + } + decode_lsps_scalar(&lsps[1][0], lsp_indexes, LPC_ORD); + check_lsp_order(&lsps[1][0], LPC_ORD); + bw_expand_lsps(&lsps[1][0], LPC_ORD, 50.0, 100.0); + + /* interpolate ------------------------------------------------*/ + + /* Wo and energy are sampled every 20ms, so we interpolate just 1 + 10ms frame between 20ms samples */ + + interp_Wo(&model[0], &c2->prev_model_dec, &model[1], c2->c2const.Wo_min); + e[0] = interp_energy(c2->prev_e_dec, e[1]); + + /* LSPs are sampled every 20ms so we interpolate the frame in + between, then recover spectral amplitudes */ + + interpolate_lsp_ver2(&lsps[0][0], c2->prev_lsps_dec, &lsps[1][0], 0.5, + LPC_ORD); + for (i = 0; i < 2; i++) { + lsp_to_lpc(&lsps[i][0], &ak[i][0], LPC_ORD); + aks_to_M2(c2->fftr_fwd_cfg, &ak[i][0], LPC_ORD, &model[i], e[i], &snr, 0, 0, + c2->lpc_pf, c2->bass_boost, c2->beta, c2->gamma, Aw); + apply_lpc_correction(&model[i]); + synthesise_one_frame(c2, &speech[c2->n_samp * i], &model[i], Aw, 1.0); + + /* dump parameters for deep learning experiments */ + + if (c2->fmlfeat != NULL) { + /* 10 LSPs - energy - Wo - voicing flag - 10 LPCs */ + fwrite(&lsps[i][0], LPC_ORD, sizeof(float), c2->fmlfeat); + fwrite(&e[i], 1, sizeof(float), c2->fmlfeat); + fwrite(&model[i].Wo, 1, sizeof(float), c2->fmlfeat); + float voiced_float = model[i].voiced; + fwrite(&voiced_float, 1, sizeof(float), c2->fmlfeat); + fwrite(&ak[i][1], LPC_ORD, sizeof(float), c2->fmlfeat); } + } - /* update memories for next frame ----------------------------*/ + /* update memories for next frame ----------------------------*/ - c2->prev_model_dec = model[1]; - c2->prev_e_dec = e[1]; - for(i=0; iprev_lsps_dec[i] = lsps[1][i]; + c2->prev_model_dec = model[1]; + c2->prev_e_dec = e[1]; + for (i = 0; i < LPC_ORD; i++) c2->prev_lsps_dec[i] = lsps[1][i]; } - /*---------------------------------------------------------------------------*\ FUNCTION....: codec2_encode_1600 @@ -821,65 +726,64 @@ void codec2_decode_2400(struct CODEC2 *c2, short speech[], const unsigned char * \*---------------------------------------------------------------------------*/ -void codec2_encode_1600(struct CODEC2 *c2, unsigned char * bits, short speech[]) -{ - MODEL model; - float lsps[LPC_ORD]; - float ak[LPC_ORD+1]; - float e; - int lsp_indexes[LPC_ORD]; - int Wo_index, e_index; - int i; - unsigned int nbit = 0; +void codec2_encode_1600(struct CODEC2 *c2, unsigned char *bits, + short speech[]) { + MODEL model; + float lsps[LPC_ORD]; + float ak[LPC_ORD + 1]; + float e; + int lsp_indexes[LPC_ORD]; + int Wo_index, e_index; + int i; + unsigned int nbit = 0; - assert(c2 != NULL); + assert(c2 != NULL); - memset(bits, '\0', ((codec2_bits_per_frame(c2) + 7) / 8)); + memset(bits, '\0', ((codec2_bits_per_frame(c2) + 7) / 8)); - /* frame 1: - voicing ---------------------------------------------*/ + /* frame 1: - voicing ---------------------------------------------*/ - analyse_one_frame(c2, &model, speech); - pack(bits, &nbit, model.voiced, 1); + analyse_one_frame(c2, &model, speech); + pack(bits, &nbit, model.voiced, 1); - /* frame 2: - voicing, scalar Wo & E -------------------------------*/ + /* frame 2: - voicing, scalar Wo & E -------------------------------*/ - analyse_one_frame(c2, &model, &speech[c2->n_samp]); - pack(bits, &nbit, model.voiced, 1); + analyse_one_frame(c2, &model, &speech[c2->n_samp]); + pack(bits, &nbit, model.voiced, 1); - Wo_index = encode_Wo(&c2->c2const, model.Wo, WO_BITS); - pack(bits, &nbit, Wo_index, WO_BITS); + Wo_index = encode_Wo(&c2->c2const, model.Wo, WO_BITS); + pack(bits, &nbit, Wo_index, WO_BITS); - /* need to run this just to get LPC energy */ - e = speech_to_uq_lsps(lsps, ak, c2->Sn, c2->w, c2->m_pitch, LPC_ORD); - e_index = encode_energy(e, E_BITS); - pack(bits, &nbit, e_index, E_BITS); + /* need to run this just to get LPC energy */ + e = speech_to_uq_lsps(lsps, ak, c2->Sn, c2->w, c2->m_pitch, LPC_ORD); + e_index = encode_energy(e, E_BITS); + pack(bits, &nbit, e_index, E_BITS); - /* frame 3: - voicing ---------------------------------------------*/ + /* frame 3: - voicing ---------------------------------------------*/ - analyse_one_frame(c2, &model, &speech[2*c2->n_samp]); - pack(bits, &nbit, model.voiced, 1); + analyse_one_frame(c2, &model, &speech[2 * c2->n_samp]); + pack(bits, &nbit, model.voiced, 1); - /* frame 4: - voicing, scalar Wo & E, scalar LSPs ------------------*/ + /* frame 4: - voicing, scalar Wo & E, scalar LSPs ------------------*/ - analyse_one_frame(c2, &model, &speech[3*c2->n_samp]); - pack(bits, &nbit, model.voiced, 1); + analyse_one_frame(c2, &model, &speech[3 * c2->n_samp]); + pack(bits, &nbit, model.voiced, 1); - Wo_index = encode_Wo(&c2->c2const, model.Wo, WO_BITS); - pack(bits, &nbit, Wo_index, WO_BITS); + Wo_index = encode_Wo(&c2->c2const, model.Wo, WO_BITS); + pack(bits, &nbit, Wo_index, WO_BITS); - e = speech_to_uq_lsps(lsps, ak, c2->Sn, c2->w, c2->m_pitch, LPC_ORD); - e_index = encode_energy(e, E_BITS); - pack(bits, &nbit, e_index, E_BITS); + e = speech_to_uq_lsps(lsps, ak, c2->Sn, c2->w, c2->m_pitch, LPC_ORD); + e_index = encode_energy(e, E_BITS); + pack(bits, &nbit, e_index, E_BITS); - encode_lsps_scalar(lsp_indexes, lsps, LPC_ORD); - for(i=0; ic2const, Wo_index, WO_BITS); - model[1].L = PI/model[1].Wo; - - e_index = unpack(bits, &nbit, E_BITS); - e[1] = decode_energy(e_index, E_BITS); - - model[2].voiced = unpack(bits, &nbit, 1); - - model[3].voiced = unpack(bits, &nbit, 1); - Wo_index = unpack(bits, &nbit, WO_BITS); - model[3].Wo = decode_Wo(&c2->c2const, Wo_index, WO_BITS); - model[3].L = PI/model[3].Wo; - - e_index = unpack(bits, &nbit, E_BITS); - e[3] = decode_energy(e_index, E_BITS); - - for(i=0; iprev_model_dec, &model[1], c2->c2const.Wo_min); - e[0] = interp_energy(c2->prev_e_dec, e[1]); - interp_Wo(&model[2], &model[1], &model[3], c2->c2const.Wo_min); - e[2] = interp_energy(e[1], e[3]); - - /* LSPs are sampled every 40ms so we interpolate the 3 frames in - between, then recover spectral amplitudes */ - - for(i=0, weight=0.25; i<3; i++, weight += 0.25) { - interpolate_lsp_ver2(&lsps[i][0], c2->prev_lsps_dec, &lsps[3][0], weight, LPC_ORD); - } - for(i=0; i<4; i++) { - lsp_to_lpc(&lsps[i][0], &ak[i][0], LPC_ORD); - aks_to_M2(c2->fftr_fwd_cfg, &ak[i][0], LPC_ORD, &model[i], e[i], &snr, 0, 0, - c2->lpc_pf, c2->bass_boost, c2->beta, c2->gamma, Aw); - apply_lpc_correction(&model[i]); - synthesise_one_frame(c2, &speech[c2->n_samp*i], &model[i], Aw, 1.0); - } - - /* update memories for next frame ----------------------------*/ - - c2->prev_model_dec = model[3]; - c2->prev_e_dec = e[3]; - for(i=0; iprev_lsps_dec[i] = lsps[3][i]; - +void codec2_decode_1600(struct CODEC2 *c2, short speech[], + const unsigned char *bits) { + MODEL model[4]; + int lsp_indexes[LPC_ORD]; + float lsps[4][LPC_ORD]; + int Wo_index, e_index; + float e[4]; + float snr; + float ak[4][LPC_ORD + 1]; + int i, j; + unsigned int nbit = 0; + float weight; + COMP Aw[FFT_ENC]; + + assert(c2 != NULL); + + /* only need to zero these out due to (unused) snr calculation */ + + for (i = 0; i < 4; i++) + for (j = 1; j <= MAX_AMP; j++) model[i].A[j] = 0.0; + + /* unpack bits from channel ------------------------------------*/ + + /* this will partially fill the model params for the 4 x 10ms + frames */ + + model[0].voiced = unpack(bits, &nbit, 1); + + model[1].voiced = unpack(bits, &nbit, 1); + Wo_index = unpack(bits, &nbit, WO_BITS); + model[1].Wo = decode_Wo(&c2->c2const, Wo_index, WO_BITS); + model[1].L = PI / model[1].Wo; + + e_index = unpack(bits, &nbit, E_BITS); + e[1] = decode_energy(e_index, E_BITS); + + model[2].voiced = unpack(bits, &nbit, 1); + + model[3].voiced = unpack(bits, &nbit, 1); + Wo_index = unpack(bits, &nbit, WO_BITS); + model[3].Wo = decode_Wo(&c2->c2const, Wo_index, WO_BITS); + model[3].L = PI / model[3].Wo; + + e_index = unpack(bits, &nbit, E_BITS); + e[3] = decode_energy(e_index, E_BITS); + + for (i = 0; i < LSP_SCALAR_INDEXES; i++) { + lsp_indexes[i] = unpack(bits, &nbit, lsp_bits(i)); + } + decode_lsps_scalar(&lsps[3][0], lsp_indexes, LPC_ORD); + check_lsp_order(&lsps[3][0], LPC_ORD); + bw_expand_lsps(&lsps[3][0], LPC_ORD, 50.0, 100.0); + + /* interpolate ------------------------------------------------*/ + + /* Wo and energy are sampled every 20ms, so we interpolate just 1 + 10ms frame between 20ms samples */ + + interp_Wo(&model[0], &c2->prev_model_dec, &model[1], c2->c2const.Wo_min); + e[0] = interp_energy(c2->prev_e_dec, e[1]); + interp_Wo(&model[2], &model[1], &model[3], c2->c2const.Wo_min); + e[2] = interp_energy(e[1], e[3]); + + /* LSPs are sampled every 40ms so we interpolate the 3 frames in + between, then recover spectral amplitudes */ + + for (i = 0, weight = 0.25; i < 3; i++, weight += 0.25) { + interpolate_lsp_ver2(&lsps[i][0], c2->prev_lsps_dec, &lsps[3][0], weight, + LPC_ORD); + } + for (i = 0; i < 4; i++) { + lsp_to_lpc(&lsps[i][0], &ak[i][0], LPC_ORD); + aks_to_M2(c2->fftr_fwd_cfg, &ak[i][0], LPC_ORD, &model[i], e[i], &snr, 0, 0, + c2->lpc_pf, c2->bass_boost, c2->beta, c2->gamma, Aw); + apply_lpc_correction(&model[i]); + synthesise_one_frame(c2, &speech[c2->n_samp * i], &model[i], Aw, 1.0); + } + + /* update memories for next frame ----------------------------*/ + + c2->prev_model_dec = model[3]; + c2->prev_e_dec = e[3]; + for (i = 0; i < LPC_ORD; i++) c2->prev_lsps_dec[i] = lsps[3][i]; } /*---------------------------------------------------------------------------*\ @@ -1004,60 +906,59 @@ void codec2_decode_1600(struct CODEC2 *c2, short speech[], const unsigned char * \*---------------------------------------------------------------------------*/ -void codec2_encode_1400(struct CODEC2 *c2, unsigned char * bits, short speech[]) -{ - MODEL model; - float lsps[LPC_ORD]; - float ak[LPC_ORD+1]; - float e; - int lsp_indexes[LPC_ORD]; - int WoE_index; - int i; - unsigned int nbit = 0; +void codec2_encode_1400(struct CODEC2 *c2, unsigned char *bits, + short speech[]) { + MODEL model; + float lsps[LPC_ORD]; + float ak[LPC_ORD + 1]; + float e; + int lsp_indexes[LPC_ORD]; + int WoE_index; + int i; + unsigned int nbit = 0; - assert(c2 != NULL); + assert(c2 != NULL); - memset(bits, '\0', ((codec2_bits_per_frame(c2) + 7) / 8)); + memset(bits, '\0', ((codec2_bits_per_frame(c2) + 7) / 8)); - /* frame 1: - voicing ---------------------------------------------*/ + /* frame 1: - voicing ---------------------------------------------*/ - analyse_one_frame(c2, &model, speech); - pack(bits, &nbit, model.voiced, 1); + analyse_one_frame(c2, &model, speech); + pack(bits, &nbit, model.voiced, 1); - /* frame 2: - voicing, joint Wo & E -------------------------------*/ + /* frame 2: - voicing, joint Wo & E -------------------------------*/ - analyse_one_frame(c2, &model, &speech[c2->n_samp]); - pack(bits, &nbit, model.voiced, 1); + analyse_one_frame(c2, &model, &speech[c2->n_samp]); + pack(bits, &nbit, model.voiced, 1); - /* need to run this just to get LPC energy */ - e = speech_to_uq_lsps(lsps, ak, c2->Sn, c2->w, c2->m_pitch, LPC_ORD); + /* need to run this just to get LPC energy */ + e = speech_to_uq_lsps(lsps, ak, c2->Sn, c2->w, c2->m_pitch, LPC_ORD); - WoE_index = encode_WoE(&model, e, c2->xq_enc); - pack(bits, &nbit, WoE_index, WO_E_BITS); + WoE_index = encode_WoE(&model, e, c2->xq_enc); + pack(bits, &nbit, WoE_index, WO_E_BITS); - /* frame 3: - voicing ---------------------------------------------*/ + /* frame 3: - voicing ---------------------------------------------*/ - analyse_one_frame(c2, &model, &speech[2*c2->n_samp]); - pack(bits, &nbit, model.voiced, 1); + analyse_one_frame(c2, &model, &speech[2 * c2->n_samp]); + pack(bits, &nbit, model.voiced, 1); - /* frame 4: - voicing, joint Wo & E, scalar LSPs ------------------*/ + /* frame 4: - voicing, joint Wo & E, scalar LSPs ------------------*/ - analyse_one_frame(c2, &model, &speech[3*c2->n_samp]); - pack(bits, &nbit, model.voiced, 1); + analyse_one_frame(c2, &model, &speech[3 * c2->n_samp]); + pack(bits, &nbit, model.voiced, 1); - e = speech_to_uq_lsps(lsps, ak, c2->Sn, c2->w, c2->m_pitch, LPC_ORD); - WoE_index = encode_WoE(&model, e, c2->xq_enc); - pack(bits, &nbit, WoE_index, WO_E_BITS); + e = speech_to_uq_lsps(lsps, ak, c2->Sn, c2->w, c2->m_pitch, LPC_ORD); + WoE_index = encode_WoE(&model, e, c2->xq_enc); + pack(bits, &nbit, WoE_index, WO_E_BITS); - encode_lsps_scalar(lsp_indexes, lsps, LPC_ORD); - for(i=0; ic2const, &model[1], &e[1], c2->xq_dec, WoE_index); - - model[2].voiced = unpack(bits, &nbit, 1); - - model[3].voiced = unpack(bits, &nbit, 1); - WoE_index = unpack(bits, &nbit, WO_E_BITS); - decode_WoE(&c2->c2const, &model[3], &e[3], c2->xq_dec, WoE_index); - - for(i=0; iprev_model_dec, &model[1], c2->c2const.Wo_min); - e[0] = interp_energy(c2->prev_e_dec, e[1]); - interp_Wo(&model[2], &model[1], &model[3], c2->c2const.Wo_min); - e[2] = interp_energy(e[1], e[3]); - - /* LSPs are sampled every 40ms so we interpolate the 3 frames in - between, then recover spectral amplitudes */ - - for(i=0, weight=0.25; i<3; i++, weight += 0.25) { - interpolate_lsp_ver2(&lsps[i][0], c2->prev_lsps_dec, &lsps[3][0], weight, LPC_ORD); - } - for(i=0; i<4; i++) { - lsp_to_lpc(&lsps[i][0], &ak[i][0], LPC_ORD); - aks_to_M2(c2->fftr_fwd_cfg, &ak[i][0], LPC_ORD, &model[i], e[i], &snr, 0, 0, - c2->lpc_pf, c2->bass_boost, c2->beta, c2->gamma, Aw); - apply_lpc_correction(&model[i]); - synthesise_one_frame(c2, &speech[c2->n_samp*i], &model[i], Aw, 1.0); - } - - /* update memories for next frame ----------------------------*/ - - c2->prev_model_dec = model[3]; - c2->prev_e_dec = e[3]; - for(i=0; iprev_lsps_dec[i] = lsps[3][i]; - +void codec2_decode_1400(struct CODEC2 *c2, short speech[], + const unsigned char *bits) { + MODEL model[4]; + int lsp_indexes[LPC_ORD]; + float lsps[4][LPC_ORD]; + int WoE_index; + float e[4]; + float snr; + float ak[4][LPC_ORD + 1]; + int i, j; + unsigned int nbit = 0; + float weight; + COMP Aw[FFT_ENC]; + + assert(c2 != NULL); + + /* only need to zero these out due to (unused) snr calculation */ + + for (i = 0; i < 4; i++) + for (j = 1; j <= MAX_AMP; j++) model[i].A[j] = 0.0; + + /* unpack bits from channel ------------------------------------*/ + + /* this will partially fill the model params for the 4 x 10ms + frames */ + + model[0].voiced = unpack(bits, &nbit, 1); + + model[1].voiced = unpack(bits, &nbit, 1); + WoE_index = unpack(bits, &nbit, WO_E_BITS); + decode_WoE(&c2->c2const, &model[1], &e[1], c2->xq_dec, WoE_index); + + model[2].voiced = unpack(bits, &nbit, 1); + + model[3].voiced = unpack(bits, &nbit, 1); + WoE_index = unpack(bits, &nbit, WO_E_BITS); + decode_WoE(&c2->c2const, &model[3], &e[3], c2->xq_dec, WoE_index); + + for (i = 0; i < LSP_SCALAR_INDEXES; i++) { + lsp_indexes[i] = unpack(bits, &nbit, lsp_bits(i)); + } + decode_lsps_scalar(&lsps[3][0], lsp_indexes, LPC_ORD); + check_lsp_order(&lsps[3][0], LPC_ORD); + bw_expand_lsps(&lsps[3][0], LPC_ORD, 50.0, 100.0); + + /* interpolate ------------------------------------------------*/ + + /* Wo and energy are sampled every 20ms, so we interpolate just 1 + 10ms frame between 20ms samples */ + + interp_Wo(&model[0], &c2->prev_model_dec, &model[1], c2->c2const.Wo_min); + e[0] = interp_energy(c2->prev_e_dec, e[1]); + interp_Wo(&model[2], &model[1], &model[3], c2->c2const.Wo_min); + e[2] = interp_energy(e[1], e[3]); + + /* LSPs are sampled every 40ms so we interpolate the 3 frames in + between, then recover spectral amplitudes */ + + for (i = 0, weight = 0.25; i < 3; i++, weight += 0.25) { + interpolate_lsp_ver2(&lsps[i][0], c2->prev_lsps_dec, &lsps[3][0], weight, + LPC_ORD); + } + for (i = 0; i < 4; i++) { + lsp_to_lpc(&lsps[i][0], &ak[i][0], LPC_ORD); + aks_to_M2(c2->fftr_fwd_cfg, &ak[i][0], LPC_ORD, &model[i], e[i], &snr, 0, 0, + c2->lpc_pf, c2->bass_boost, c2->beta, c2->gamma, Aw); + apply_lpc_correction(&model[i]); + synthesise_one_frame(c2, &speech[c2->n_samp * i], &model[i], Aw, 1.0); + } + + /* update memories for next frame ----------------------------*/ + + c2->prev_model_dec = model[3]; + c2->prev_e_dec = e[3]; + for (i = 0; i < LPC_ORD; i++) c2->prev_lsps_dec[i] = lsps[3][i]; } /*---------------------------------------------------------------------------*\ @@ -1175,66 +1074,56 @@ void codec2_decode_1400(struct CODEC2 *c2, short speech[], const unsigned char * \*---------------------------------------------------------------------------*/ -void codec2_encode_1300(struct CODEC2 *c2, unsigned char * bits, short speech[]) -{ - MODEL model; - float lsps[LPC_ORD]; - float ak[LPC_ORD+1]; - float e; - int lsp_indexes[LPC_ORD]; - int Wo_index, e_index; - int i; - unsigned int nbit = 0; - //#ifdef PROFILE - //unsigned int quant_start; - //#endif +void codec2_encode_1300(struct CODEC2 *c2, unsigned char *bits, + short speech[]) { + MODEL model; + float lsps[LPC_ORD]; + float ak[LPC_ORD + 1]; + float e; + int lsp_indexes[LPC_ORD]; + int Wo_index, e_index; + int i; + unsigned int nbit = 0; - assert(c2 != NULL); + assert(c2 != NULL); - memset(bits, '\0', ((codec2_bits_per_frame(c2) + 7) / 8)); + memset(bits, '\0', ((codec2_bits_per_frame(c2) + 7) / 8)); - /* frame 1: - voicing ---------------------------------------------*/ + /* frame 1: - voicing ---------------------------------------------*/ - analyse_one_frame(c2, &model, speech); - pack_natural_or_gray(bits, &nbit, model.voiced, 1, c2->gray); + analyse_one_frame(c2, &model, speech); + pack_natural_or_gray(bits, &nbit, model.voiced, 1, c2->gray); - /* frame 2: - voicing ---------------------------------------------*/ + /* frame 2: - voicing ---------------------------------------------*/ - analyse_one_frame(c2, &model, &speech[c2->n_samp]); - pack_natural_or_gray(bits, &nbit, model.voiced, 1, c2->gray); + analyse_one_frame(c2, &model, &speech[c2->n_samp]); + pack_natural_or_gray(bits, &nbit, model.voiced, 1, c2->gray); - /* frame 3: - voicing ---------------------------------------------*/ + /* frame 3: - voicing ---------------------------------------------*/ - analyse_one_frame(c2, &model, &speech[2*c2->n_samp]); - pack_natural_or_gray(bits, &nbit, model.voiced, 1, c2->gray); + analyse_one_frame(c2, &model, &speech[2 * c2->n_samp]); + pack_natural_or_gray(bits, &nbit, model.voiced, 1, c2->gray); - /* frame 4: - voicing, scalar Wo & E, scalar LSPs ------------------*/ + /* frame 4: - voicing, scalar Wo & E, scalar LSPs ------------------*/ - analyse_one_frame(c2, &model, &speech[3*c2->n_samp]); - pack_natural_or_gray(bits, &nbit, model.voiced, 1, c2->gray); + analyse_one_frame(c2, &model, &speech[3 * c2->n_samp]); + pack_natural_or_gray(bits, &nbit, model.voiced, 1, c2->gray); - Wo_index = encode_Wo(&c2->c2const, model.Wo, WO_BITS); - pack_natural_or_gray(bits, &nbit, Wo_index, WO_BITS, c2->gray); + Wo_index = encode_Wo(&c2->c2const, model.Wo, WO_BITS); + pack_natural_or_gray(bits, &nbit, Wo_index, WO_BITS, c2->gray); - //#ifdef PROFILE - //quant_start = machdep_profile_sample(); - //#endif - e = speech_to_uq_lsps(lsps, ak, c2->Sn, c2->w, c2->m_pitch, LPC_ORD); - e_index = encode_energy(e, E_BITS); - pack_natural_or_gray(bits, &nbit, e_index, E_BITS, c2->gray); + e = speech_to_uq_lsps(lsps, ak, c2->Sn, c2->w, c2->m_pitch, LPC_ORD); + e_index = encode_energy(e, E_BITS); + pack_natural_or_gray(bits, &nbit, e_index, E_BITS, c2->gray); - encode_lsps_scalar(lsp_indexes, lsps, LPC_ORD); - for(i=0; igray); - } - //#ifdef PROFILE - //machdep_profile_sample_and_log(quant_start, " quant/packing"); - //#endif + encode_lsps_scalar(lsp_indexes, lsps, LPC_ORD); + for (i = 0; i < LSP_SCALAR_INDEXES; i++) { + pack_natural_or_gray(bits, &nbit, lsp_indexes[i], lsp_bits(i), c2->gray); + } - assert(nbit == (unsigned)codec2_bits_per_frame(c2)); + assert(nbit == (unsigned)codec2_bits_per_frame(c2)); } - /*---------------------------------------------------------------------------*\ FUNCTION....: codec2_decode_1300 @@ -1244,118 +1133,106 @@ void codec2_encode_1300(struct CODEC2 *c2, unsigned char * bits, short speech[]) Decodes frames of 52 bits into 320 samples (40ms) of speech. \*---------------------------------------------------------------------------*/ -static int frames; -void codec2_decode_1300(struct CODEC2 *c2, short speech[], const unsigned char * bits, float ber_est) -{ - MODEL model[4]; - int lsp_indexes[LPC_ORD]; - float lsps[4][LPC_ORD]; - int Wo_index, e_index; - float e[4]; - float snr; - float ak[4][LPC_ORD+1]; - int i,j; - unsigned int nbit = 0; - float weight; - COMP Aw[FFT_ENC]; - //PROFILE_VAR(recover_start); - - assert(c2 != NULL); - frames+= 4; - /* only need to zero these out due to (unused) snr calculation */ - - for(i=0; i<4; i++) - for(j=1; j<=MAX_AMP; j++) - model[i].A[j] = 0.0; - - /* unpack bits from channel ------------------------------------*/ - - /* this will partially fill the model params for the 4 x 10ms - frames */ - - model[0].voiced = unpack_natural_or_gray(bits, &nbit, 1, c2->gray); - model[1].voiced = unpack_natural_or_gray(bits, &nbit, 1, c2->gray); - model[2].voiced = unpack_natural_or_gray(bits, &nbit, 1, c2->gray); - model[3].voiced = unpack_natural_or_gray(bits, &nbit, 1, c2->gray); - - Wo_index = unpack_natural_or_gray(bits, &nbit, WO_BITS, c2->gray); - model[3].Wo = decode_Wo(&c2->c2const, Wo_index, WO_BITS); - model[3].L = PI/model[3].Wo; - e_index = unpack_natural_or_gray(bits, &nbit, E_BITS, c2->gray); - e[3] = decode_energy(e_index, E_BITS); - //fprintf(stderr, "%d %f\n", e_index, e[3]); +void codec2_decode_1300(struct CODEC2 *c2, short speech[], + const unsigned char *bits, float ber_est) { + MODEL model[4]; + int lsp_indexes[LPC_ORD]; + float lsps[4][LPC_ORD]; + int Wo_index, e_index; + float e[4]; + float snr; + float ak[4][LPC_ORD + 1]; + int i, j; + unsigned int nbit = 0; + float weight; + COMP Aw[FFT_ENC]; + + assert(c2 != NULL); + + /* only need to zero these out due to (unused) snr calculation */ + + for (i = 0; i < 4; i++) + for (j = 1; j <= MAX_AMP; j++) model[i].A[j] = 0.0; + + /* unpack bits from channel ------------------------------------*/ + + /* this will partially fill the model params for the 4 x 10ms + frames */ + + model[0].voiced = unpack_natural_or_gray(bits, &nbit, 1, c2->gray); + model[1].voiced = unpack_natural_or_gray(bits, &nbit, 1, c2->gray); + model[2].voiced = unpack_natural_or_gray(bits, &nbit, 1, c2->gray); + model[3].voiced = unpack_natural_or_gray(bits, &nbit, 1, c2->gray); + + Wo_index = unpack_natural_or_gray(bits, &nbit, WO_BITS, c2->gray); + model[3].Wo = decode_Wo(&c2->c2const, Wo_index, WO_BITS); + model[3].L = PI / model[3].Wo; + + e_index = unpack_natural_or_gray(bits, &nbit, E_BITS, c2->gray); + e[3] = decode_energy(e_index, E_BITS); + + for (i = 0; i < LSP_SCALAR_INDEXES; i++) { + lsp_indexes[i] = unpack_natural_or_gray(bits, &nbit, lsp_bits(i), c2->gray); + } + decode_lsps_scalar(&lsps[3][0], lsp_indexes, LPC_ORD); + check_lsp_order(&lsps[3][0], LPC_ORD); + bw_expand_lsps(&lsps[3][0], LPC_ORD, 50.0, 100.0); + + if (ber_est > 0.15) { + model[0].voiced = model[1].voiced = model[2].voiced = model[3].voiced = 0; + e[3] = decode_energy(10, E_BITS); + bw_expand_lsps(&lsps[3][0], LPC_ORD, 200.0, 200.0); + // fprintf(stderr, "soft mute\n"); + } + + /* interpolate ------------------------------------------------*/ + + /* Wo, energy, and LSPs are sampled every 40ms so we interpolate + the 3 frames in between */ + + for (i = 0, weight = 0.25; i < 3; i++, weight += 0.25) { + interpolate_lsp_ver2(&lsps[i][0], c2->prev_lsps_dec, &lsps[3][0], weight, + LPC_ORD); + interp_Wo2(&model[i], &c2->prev_model_dec, &model[3], weight, + c2->c2const.Wo_min); + e[i] = interp_energy2(c2->prev_e_dec, e[3], weight); + } + + /* then recover spectral amplitudes */ + + for (i = 0; i < 4; i++) { + lsp_to_lpc(&lsps[i][0], &ak[i][0], LPC_ORD); + aks_to_M2(c2->fftr_fwd_cfg, &ak[i][0], LPC_ORD, &model[i], e[i], &snr, 0, 0, + c2->lpc_pf, c2->bass_boost, c2->beta, c2->gamma, Aw); + apply_lpc_correction(&model[i]); + synthesise_one_frame(c2, &speech[c2->n_samp * i], &model[i], Aw, 1.0); + + /* dump parameters for deep learning experiments */ - for(i=0; igray); - } - decode_lsps_scalar(&lsps[3][0], lsp_indexes, LPC_ORD); - check_lsp_order(&lsps[3][0], LPC_ORD); - bw_expand_lsps(&lsps[3][0], LPC_ORD, 50.0, 100.0); - - if (ber_est > 0.15) { - model[0].voiced = model[1].voiced = model[2].voiced = model[3].voiced = 0; - e[3] = decode_energy(10, E_BITS); - bw_expand_lsps(&lsps[3][0], LPC_ORD, 200.0, 200.0); - //fprintf(stderr, "soft mute\n"); - } - - /* interpolate ------------------------------------------------*/ - - /* Wo, energy, and LSPs are sampled every 40ms so we interpolate - the 3 frames in between */ - - //PROFILE_SAMPLE(recover_start); - for(i=0, weight=0.25; i<3; i++, weight += 0.25) { - interpolate_lsp_ver2(&lsps[i][0], c2->prev_lsps_dec, &lsps[3][0], weight, LPC_ORD); - interp_Wo2(&model[i], &c2->prev_model_dec, &model[3], weight, c2->c2const.Wo_min); - e[i] = interp_energy2(c2->prev_e_dec, e[3],weight); - } + if (c2->fmlfeat != NULL) { + /* 10 LSPs - energy - Wo - voicing flag - 10 LPCs */ + fwrite(&lsps[i][0], LPC_ORD, sizeof(float), c2->fmlfeat); + fwrite(&e[i], 1, sizeof(float), c2->fmlfeat); + fwrite(&model[i].Wo, 1, sizeof(float), c2->fmlfeat); + float voiced_float = model[i].voiced; + fwrite(&voiced_float, 1, sizeof(float), c2->fmlfeat); + fwrite(&ak[i][1], LPC_ORD, sizeof(float), c2->fmlfeat); + } + } + +#ifdef DUMP + dump_lsp_(&lsps[3][0]); + dump_ak_(&ak[3][0], LPC_ORD); +#endif - /* then recover spectral amplitudes */ - - for(i=0; i<4; i++) { - lsp_to_lpc(&lsps[i][0], &ak[i][0], LPC_ORD); - aks_to_M2(c2->fftr_fwd_cfg, &ak[i][0], LPC_ORD, &model[i], e[i], &snr, 0, 0, - c2->lpc_pf, c2->bass_boost, c2->beta, c2->gamma, Aw); - apply_lpc_correction(&model[i]); - synthesise_one_frame(c2, &speech[c2->n_samp*i], &model[i], Aw, 1.0); - - /* dump parameters for deep learning experiments */ - - if (c2->fmlfeat != NULL) { - /* 10 LSPs - energy - Wo - voicing flag - 10 LPCs */ - fwrite(&lsps[i][0], LPC_ORD, sizeof(float), c2->fmlfeat); - fwrite(&e[i], 1, sizeof(float), c2->fmlfeat); - fwrite(&model[i].Wo, 1, sizeof(float), c2->fmlfeat); - float voiced_float = model[i].voiced; - fwrite(&voiced_float, 1, sizeof(float), c2->fmlfeat); - fwrite(&ak[i][1], LPC_ORD, sizeof(float), c2->fmlfeat); - } - } - /* - for(i=0; i<4; i++) { - printf("%d Wo: %f L: %d v: %d\n", frames, model[i].Wo, model[i].L, model[i].voiced); - } - if (frames == 4*50) - exit(0); - */ - //PROFILE_SAMPLE_AND_LOG2(recover_start, " recover"); - #ifdef DUMP - dump_lsp_(&lsps[3][0]); - dump_ak_(&ak[3][0], LPC_ORD); - #endif - - /* update memories for next frame ----------------------------*/ - - c2->prev_model_dec = model[3]; - c2->prev_e_dec = e[3]; - for(i=0; iprev_lsps_dec[i] = lsps[3][i]; + /* update memories for next frame ----------------------------*/ + c2->prev_model_dec = model[3]; + c2->prev_e_dec = e[3]; + for (i = 0; i < LPC_ORD; i++) c2->prev_lsps_dec[i] = lsps[3][i]; } - /*---------------------------------------------------------------------------*\ FUNCTION....: codec2_encode_1200 @@ -1384,63 +1261,62 @@ void codec2_decode_1300(struct CODEC2 *c2, short speech[], const unsigned char * \*---------------------------------------------------------------------------*/ -void codec2_encode_1200(struct CODEC2 *c2, unsigned char * bits, short speech[]) -{ - MODEL model; - float lsps[LPC_ORD]; - float lsps_[LPC_ORD]; - float ak[LPC_ORD+1]; - float e; - int lsp_indexes[LPC_ORD]; - int WoE_index; - int i; - int spare = 0; - unsigned int nbit = 0; +void codec2_encode_1200(struct CODEC2 *c2, unsigned char *bits, + short speech[]) { + MODEL model; + float lsps[LPC_ORD]; + float lsps_[LPC_ORD]; + float ak[LPC_ORD + 1]; + float e; + int lsp_indexes[LPC_ORD]; + int WoE_index; + int i; + int spare = 0; + unsigned int nbit = 0; - assert(c2 != NULL); + assert(c2 != NULL); - memset(bits, '\0', ((codec2_bits_per_frame(c2) + 7) / 8)); + memset(bits, '\0', ((codec2_bits_per_frame(c2) + 7) / 8)); - /* frame 1: - voicing ---------------------------------------------*/ + /* frame 1: - voicing ---------------------------------------------*/ - analyse_one_frame(c2, &model, speech); - pack(bits, &nbit, model.voiced, 1); + analyse_one_frame(c2, &model, speech); + pack(bits, &nbit, model.voiced, 1); - /* frame 2: - voicing, joint Wo & E -------------------------------*/ + /* frame 2: - voicing, joint Wo & E -------------------------------*/ - analyse_one_frame(c2, &model, &speech[c2->n_samp]); - pack(bits, &nbit, model.voiced, 1); + analyse_one_frame(c2, &model, &speech[c2->n_samp]); + pack(bits, &nbit, model.voiced, 1); - /* need to run this just to get LPC energy */ - e = speech_to_uq_lsps(lsps, ak, c2->Sn, c2->w, c2->m_pitch, LPC_ORD); + /* need to run this just to get LPC energy */ + e = speech_to_uq_lsps(lsps, ak, c2->Sn, c2->w, c2->m_pitch, LPC_ORD); - WoE_index = encode_WoE(&model, e, c2->xq_enc); - pack(bits, &nbit, WoE_index, WO_E_BITS); + WoE_index = encode_WoE(&model, e, c2->xq_enc); + pack(bits, &nbit, WoE_index, WO_E_BITS); - /* frame 3: - voicing ---------------------------------------------*/ + /* frame 3: - voicing ---------------------------------------------*/ - analyse_one_frame(c2, &model, &speech[2*c2->n_samp]); - pack(bits, &nbit, model.voiced, 1); + analyse_one_frame(c2, &model, &speech[2 * c2->n_samp]); + pack(bits, &nbit, model.voiced, 1); - /* frame 4: - voicing, joint Wo & E, scalar LSPs ------------------*/ + /* frame 4: - voicing, joint Wo & E, scalar LSPs ------------------*/ - analyse_one_frame(c2, &model, &speech[3*c2->n_samp]); - pack(bits, &nbit, model.voiced, 1); + analyse_one_frame(c2, &model, &speech[3 * c2->n_samp]); + pack(bits, &nbit, model.voiced, 1); - e = speech_to_uq_lsps(lsps, ak, c2->Sn, c2->w, c2->m_pitch, LPC_ORD); - WoE_index = encode_WoE(&model, e, c2->xq_enc); - pack(bits, &nbit, WoE_index, WO_E_BITS); + e = speech_to_uq_lsps(lsps, ak, c2->Sn, c2->w, c2->m_pitch, LPC_ORD); + WoE_index = encode_WoE(&model, e, c2->xq_enc); + pack(bits, &nbit, WoE_index, WO_E_BITS); - encode_lsps_vq(lsp_indexes, lsps, lsps_, LPC_ORD); - for(i=0; ic2const, &model[1], &e[1], c2->xq_dec, WoE_index); - - model[2].voiced = unpack(bits, &nbit, 1); - - model[3].voiced = unpack(bits, &nbit, 1); - WoE_index = unpack(bits, &nbit, WO_E_BITS); - decode_WoE(&c2->c2const, &model[3], &e[3], c2->xq_dec, WoE_index); - - for(i=0; iprev_model_dec, &model[1], c2->c2const.Wo_min); - e[0] = interp_energy(c2->prev_e_dec, e[1]); - interp_Wo(&model[2], &model[1], &model[3], c2->c2const.Wo_min); - e[2] = interp_energy(e[1], e[3]); - - /* LSPs are sampled every 40ms so we interpolate the 3 frames in - between, then recover spectral amplitudes */ - - for(i=0, weight=0.25; i<3; i++, weight += 0.25) { - interpolate_lsp_ver2(&lsps[i][0], c2->prev_lsps_dec, &lsps[3][0], weight, LPC_ORD); - } - for(i=0; i<4; i++) { - lsp_to_lpc(&lsps[i][0], &ak[i][0], LPC_ORD); - aks_to_M2(c2->fftr_fwd_cfg, &ak[i][0], LPC_ORD, &model[i], e[i], &snr, 0, 0, - c2->lpc_pf, c2->bass_boost, c2->beta, c2->gamma, Aw); - apply_lpc_correction(&model[i]); - synthesise_one_frame(c2, &speech[c2->n_samp*i], &model[i], Aw, 1.0); - } - - /* update memories for next frame ----------------------------*/ - - c2->prev_model_dec = model[3]; - c2->prev_e_dec = e[3]; - for(i=0; iprev_lsps_dec[i] = lsps[3][i]; +void codec2_decode_1200(struct CODEC2 *c2, short speech[], + const unsigned char *bits) { + MODEL model[4]; + int lsp_indexes[LPC_ORD]; + float lsps[4][LPC_ORD]; + int WoE_index; + float e[4]; + float snr; + float ak[4][LPC_ORD + 1]; + int i, j; + unsigned int nbit = 0; + float weight; + COMP Aw[FFT_ENC]; + + assert(c2 != NULL); + + /* only need to zero these out due to (unused) snr calculation */ + + for (i = 0; i < 4; i++) + for (j = 1; j <= MAX_AMP; j++) model[i].A[j] = 0.0; + + /* unpack bits from channel ------------------------------------*/ + + /* this will partially fill the model params for the 4 x 10ms + frames */ + + model[0].voiced = unpack(bits, &nbit, 1); + + model[1].voiced = unpack(bits, &nbit, 1); + WoE_index = unpack(bits, &nbit, WO_E_BITS); + decode_WoE(&c2->c2const, &model[1], &e[1], c2->xq_dec, WoE_index); + + model[2].voiced = unpack(bits, &nbit, 1); + + model[3].voiced = unpack(bits, &nbit, 1); + WoE_index = unpack(bits, &nbit, WO_E_BITS); + decode_WoE(&c2->c2const, &model[3], &e[3], c2->xq_dec, WoE_index); + + for (i = 0; i < LSP_PRED_VQ_INDEXES; i++) { + lsp_indexes[i] = unpack(bits, &nbit, lsp_pred_vq_bits(i)); + } + decode_lsps_vq(lsp_indexes, &lsps[3][0], LPC_ORD, 0); + check_lsp_order(&lsps[3][0], LPC_ORD); + bw_expand_lsps(&lsps[3][0], LPC_ORD, 50.0, 100.0); + + /* interpolate ------------------------------------------------*/ + + /* Wo and energy are sampled every 20ms, so we interpolate just 1 + 10ms frame between 20ms samples */ + + interp_Wo(&model[0], &c2->prev_model_dec, &model[1], c2->c2const.Wo_min); + e[0] = interp_energy(c2->prev_e_dec, e[1]); + interp_Wo(&model[2], &model[1], &model[3], c2->c2const.Wo_min); + e[2] = interp_energy(e[1], e[3]); + + /* LSPs are sampled every 40ms so we interpolate the 3 frames in + between, then recover spectral amplitudes */ + + for (i = 0, weight = 0.25; i < 3; i++, weight += 0.25) { + interpolate_lsp_ver2(&lsps[i][0], c2->prev_lsps_dec, &lsps[3][0], weight, + LPC_ORD); + } + for (i = 0; i < 4; i++) { + lsp_to_lpc(&lsps[i][0], &ak[i][0], LPC_ORD); + aks_to_M2(c2->fftr_fwd_cfg, &ak[i][0], LPC_ORD, &model[i], e[i], &snr, 0, 0, + c2->lpc_pf, c2->bass_boost, c2->beta, c2->gamma, Aw); + apply_lpc_correction(&model[i]); + synthesise_one_frame(c2, &speech[c2->n_samp * i], &model[i], Aw, 1.0); + } + + /* update memories for next frame ----------------------------*/ + + c2->prev_model_dec = model[3]; + c2->prev_e_dec = e[3]; + for (i = 0; i < LPC_ORD; i++) c2->prev_lsps_dec[i] = lsps[3][i]; } - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: codec2_encode_700 - AUTHOR......: David Rowe - DATE CREATED: April 2015 - - Encodes 320 speech samples (40ms of speech) into 28 bits. - - The codec2 algorithm actually operates internally on 10ms (80 - sample) frames, so we run the encoding algorithm four times: - - frame 0: nothing - frame 1: nothing - frame 2: nothing - frame 3: voicing bit, scalar Wo and E, 17 bit LSP MEL scalar, 2 spare - - The bit allocation is: - - Parameter frames 1-3 frame 4 Total - ----------------------------------------------------------- - Harmonic magnitudes (LSPs) 0 17 17 - Energy 0 3 3 - log Wo 0 5 5 - Voicing 0 1 1 - spare 0 2 2 - TOTAL 0 28 28 - -\*---------------------------------------------------------------------------*/ - -void codec2_encode_700(struct CODEC2 *c2, unsigned char * bits, short speech[]) -{ - MODEL model; - float lsps[LPC_ORD_LOW]; - float mel[LPC_ORD_LOW]; - float ak[LPC_ORD_LOW+1]; - float e, f; - int indexes[LPC_ORD_LOW]; - int Wo_index, e_index, i; - unsigned int nbit = 0; - float bpf_out[4*c2->n_samp]; - short bpf_speech[4*c2->n_samp]; - int spare = 0; - - assert(c2 != NULL); - - memset(bits, '\0', ((codec2_bits_per_frame(c2) + 7) / 8)); - - /* band pass filter */ - - for(i=0; ibpf_buf[i] = c2->bpf_buf[4*c2->n_samp+i]; - for(i=0; i<4*c2->n_samp; i++) - c2->bpf_buf[BPF_N+i] = speech[i]; - inverse_filter(&c2->bpf_buf[BPF_N], bpf, 4*c2->n_samp, bpf_out, BPF_N-1); - for(i=0; i<4*c2->n_samp; i++) - bpf_speech[i] = bpf_out[i]; - - /* frame 1 --------------------------------------------------------*/ - - analyse_one_frame(c2, &model, bpf_speech); - - /* frame 2 --------------------------------------------------------*/ - - analyse_one_frame(c2, &model, &bpf_speech[c2->n_samp]); - - /* frame 3 --------------------------------------------------------*/ - - analyse_one_frame(c2, &model, &bpf_speech[2*c2->n_samp]); - - /* frame 4: - voicing, scalar Wo & E, scalar LSPs -----------------*/ - - analyse_one_frame(c2, &model, &bpf_speech[3*c2->n_samp]); - pack(bits, &nbit, model.voiced, 1); - Wo_index = encode_log_Wo(&c2->c2const, model.Wo, 5); - pack_natural_or_gray(bits, &nbit, Wo_index, 5, c2->gray); - - e = speech_to_uq_lsps(lsps, ak, c2->Sn, c2->w, c2->m_pitch, LPC_ORD_LOW); - e_index = encode_energy(e, 3); - pack_natural_or_gray(bits, &nbit, e_index, 3, c2->gray); - - for(i=0; igray); - } - - pack_natural_or_gray(bits, &nbit, spare, 2, c2->gray); - - assert(nbit == (unsigned)codec2_bits_per_frame(c2)); -} - - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: codec2_decode_700 - AUTHOR......: David Rowe - DATE CREATED: April 2015 - - Decodes frames of 28 bits into 320 samples (40ms) of speech. - -\*---------------------------------------------------------------------------*/ - -void codec2_decode_700(struct CODEC2 *c2, short speech[], const unsigned char * bits) -{ - MODEL model[4]; - int indexes[LPC_ORD_LOW]; - float mel[LPC_ORD_LOW]; - float lsps[4][LPC_ORD_LOW]; - int Wo_index, e_index; - float e[4]; - float snr, f_; - float ak[4][LPC_ORD_LOW+1]; - int i,j; - unsigned int nbit = 0; - float weight; - COMP Aw[FFT_ENC]; - - assert(c2 != NULL); - - /* only need to zero these out due to (unused) snr calculation */ - - for(i=0; i<4; i++) - for(j=1; j<=MAX_AMP; j++) - model[i].A[j] = 0.0; - - /* unpack bits from channel ------------------------------------*/ - - model[3].voiced = unpack(bits, &nbit, 1); - model[0].voiced = model[1].voiced = model[2].voiced = model[3].voiced; - - Wo_index = unpack_natural_or_gray(bits, &nbit, 5, c2->gray); - model[3].Wo = decode_log_Wo(&c2->c2const, Wo_index, 5); - model[3].L = PI/model[3].Wo; - - e_index = unpack_natural_or_gray(bits, &nbit, 3, c2->gray); - e[3] = decode_energy(e_index, 3); - - for(i=0; igray); - } - - decode_mels_scalar(mel, indexes, LPC_ORD_LOW); - for(i=0; isoftdec) { - float e = 0.0; - for(i=9; i<9+17; i++) - e += c2->softdec[i]*c2->softdec[i]; - e /= 6.0; - //fprintf(stderr, "e: %f\n", e); - //if (e < 0.3) - // bw_expand_lsps(&lsps[3][0], LPC_ORD_LOW, 150.0, 300.0); - } - #endif - - /* interpolate ------------------------------------------------*/ - - /* LSPs, Wo, and energy are sampled every 40ms so we interpolate - the 3 frames in between, then recover spectral amplitudes */ - - for(i=0, weight=0.25; i<3; i++, weight += 0.25) { - interpolate_lsp_ver2(&lsps[i][0], c2->prev_lsps_dec, &lsps[3][0], weight, LPC_ORD_LOW); - interp_Wo2(&model[i], &c2->prev_model_dec, &model[3], weight, c2->c2const.Wo_min); - e[i] = interp_energy2(c2->prev_e_dec, e[3],weight); - } - for(i=0; i<4; i++) { - lsp_to_lpc(&lsps[i][0], &ak[i][0], LPC_ORD_LOW); - aks_to_M2(c2->fftr_fwd_cfg, &ak[i][0], LPC_ORD_LOW, &model[i], e[i], &snr, 0, 0, - c2->lpc_pf, c2->bass_boost, c2->beta, c2->gamma, Aw); - apply_lpc_correction(&model[i]); - synthesise_one_frame(c2, &speech[c2->n_samp*i], &model[i], Aw, 1.0); - } - - #ifdef DUMP - dump_lsp_(&lsps[3][0]); - dump_ak_(&ak[3][0], LPC_ORD_LOW); - dump_model(&model[3]); - if (c2->softdec) - dump_softdec(c2->softdec, nbit); - #endif - - /* update memories for next frame ----------------------------*/ - - c2->prev_model_dec = model[3]; - c2->prev_e_dec = e[3]; - for(i=0; iprev_lsps_dec[i] = lsps[3][i]; -} - - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: codec2_encode_700b - AUTHOR......: David Rowe - DATE CREATED: August 2015 - - Version b of 700 bit/s codec. After some experiments over the air I - wanted was unhappy with the rate 700 codec so spent a few weeks - trying to improve the speech quality. This version uses a wider BPF - and vector quantised mel-lsps. - - Encodes 320 speech samples (40ms of speech) into 28 bits. - - The codec2 algorithm actually operates internally on 10ms (80 - sample) frames, so we run the encoding algorithm four times: - - frame 0: nothing - frame 1: nothing - frame 2: nothing - frame 3: voicing bit, 5 bit scalar Wo and 3 bit E, 18 bit LSP MEL VQ, - 1 spare - - The bit allocation is: - - Parameter frames 1-3 frame 4 Total - ----------------------------------------------------------- - Harmonic magnitudes (LSPs) 0 18 18 - Energy 0 3 3 - log Wo 0 5 5 - Voicing 0 1 1 - spare 0 1 1 - TOTAL 0 28 28 - -\*---------------------------------------------------------------------------*/ - -void codec2_encode_700b(struct CODEC2 *c2, unsigned char * bits, short speech[]) -{ - MODEL model; - float lsps[LPC_ORD_LOW]; - float mel[LPC_ORD_LOW]; - float mel_[LPC_ORD_LOW]; - float ak[LPC_ORD_LOW+1]; - float e, f; - int indexes[3]; - int Wo_index, e_index, i; - unsigned int nbit = 0; - float bpf_out[4*c2->n_samp]; - short bpf_speech[4*c2->n_samp]; - int spare = 0; - - assert(c2 != NULL); - - memset(bits, '\0', ((codec2_bits_per_frame(c2) + 7) / 8)); - - /* band pass filter */ - - for(i=0; ibpf_buf[i] = c2->bpf_buf[4*c2->n_samp+i]; - for(i=0; i<4*c2->n_samp; i++) - c2->bpf_buf[BPF_N+i] = speech[i]; - inverse_filter(&c2->bpf_buf[BPF_N], bpfb, 4*c2->n_samp, bpf_out, BPF_N-1); - for(i=0; i<4*c2->n_samp; i++) - bpf_speech[i] = bpf_out[i]; - - /* frame 1 --------------------------------------------------------*/ - - analyse_one_frame(c2, &model, bpf_speech); - - /* frame 2 --------------------------------------------------------*/ - - analyse_one_frame(c2, &model, &bpf_speech[c2->n_samp]); - - /* frame 3 --------------------------------------------------------*/ - - analyse_one_frame(c2, &model, &bpf_speech[2*c2->n_samp]); - - /* frame 4: - voicing, scalar Wo & E, VQ mel LSPs -----------------*/ - - analyse_one_frame(c2, &model, &bpf_speech[3*c2->n_samp]); - pack(bits, &nbit, model.voiced, 1); - Wo_index = encode_log_Wo(&c2->c2const, model.Wo, 5); - pack_natural_or_gray(bits, &nbit, Wo_index, 5, c2->gray); - - e = speech_to_uq_lsps(lsps, ak, c2->Sn, c2->w, c2->m_pitch, LPC_ORD_LOW); - e_index = encode_energy(e, 3); - pack_natural_or_gray(bits, &nbit, e_index, 3, c2->gray); - - for(i=0; igray); - } - - pack_natural_or_gray(bits, &nbit, spare, 1, c2->gray); - - assert(nbit == (unsigned)codec2_bits_per_frame(c2)); -} - - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: codec2_decode_700b - AUTHOR......: David Rowe - DATE CREATED: August 2015 - - Decodes frames of 28 bits into 320 samples (40ms) of speech. - -\*---------------------------------------------------------------------------*/ - -void codec2_decode_700b(struct CODEC2 *c2, short speech[], const unsigned char * bits) -{ - MODEL model[4]; - int indexes[3]; - float mel[LPC_ORD_LOW]; - float lsps[4][LPC_ORD_LOW]; - int Wo_index, e_index; - float e[4]; - float snr, f_; - float ak[4][LPC_ORD_LOW+1]; - int i,j; - unsigned int nbit = 0; - float weight; - COMP Aw[FFT_ENC]; - - assert(c2 != NULL); - - /* only need to zero these out due to (unused) snr calculation */ - - for(i=0; i<4; i++) - for(j=1; j<=MAX_AMP; j++) - model[i].A[j] = 0.0; - - /* unpack bits from channel ------------------------------------*/ - - model[3].voiced = unpack(bits, &nbit, 1); - model[0].voiced = model[1].voiced = model[2].voiced = model[3].voiced; - - Wo_index = unpack_natural_or_gray(bits, &nbit, 5, c2->gray); - model[3].Wo = decode_log_Wo(&c2->c2const, Wo_index, 5); - model[3].L = PI/model[3].Wo; - - e_index = unpack_natural_or_gray(bits, &nbit, 3, c2->gray); - e[3] = decode_energy(e_index, 3); - - for(i=0; i<3; i++) { - indexes[i] = unpack_natural_or_gray(bits, &nbit, lspmelvq_cb_bits(i), c2->gray); - } - - lspmelvq_decode(indexes, mel, LPC_ORD_LOW); - - #define MEL_ROUND 10 - for(i=1; iprev_lsps_dec, &lsps[3][0], weight, LPC_ORD_LOW); - interp_Wo2(&model[i], &c2->prev_model_dec, &model[3], weight, c2->c2const.Wo_min); - e[i] = interp_energy2(c2->prev_e_dec, e[3],weight); - } - for(i=0; i<4; i++) { - lsp_to_lpc(&lsps[i][0], &ak[i][0], LPC_ORD_LOW); - aks_to_M2(c2->fftr_fwd_cfg, &ak[i][0], LPC_ORD_LOW, &model[i], e[i], &snr, 0, 0, - c2->lpc_pf, c2->bass_boost, c2->beta, c2->gamma, Aw); - apply_lpc_correction(&model[i]); - synthesise_one_frame(c2, &speech[c2->n_samp*i], &model[i], Aw, 1.0); - } - - #ifdef DUMP - dump_lsp_(&lsps[3][0]); - dump_ak_(&ak[3][0], LPC_ORD_LOW); - dump_model(&model[3]); - if (c2->softdec) - dump_softdec(c2->softdec, nbit); - #endif - - /* update memories for next frame ----------------------------*/ - - c2->prev_model_dec = model[3]; - c2->prev_e_dec = e[3]; - for(i=0; iprev_lsps_dec[i] = lsps[3][i]; -} - - /*---------------------------------------------------------------------------*\ FUNCTION....: codec2_encode_700c @@ -1955,7 +1420,7 @@ void codec2_decode_700b(struct CODEC2 *c2, short speech[], const unsigned char * frame 0: nothing frame 1: nothing frame 2: nothing - frame 3: 18 bit 2 stage VQ (9 bits/stage), 4 bits energy, + frame 3: 18 bit 2 stage VQ (9 bits/stage), 4 bits energy, 6 bit scalar Wo/voicing. No spare bits. Voicing is encoded using the 0 index of the Wo quantiser. @@ -1971,52 +1436,54 @@ void codec2_decode_700b(struct CODEC2 *c2, short speech[], const unsigned char * \*---------------------------------------------------------------------------*/ -void codec2_encode_700c(struct CODEC2 *c2, unsigned char * bits, short speech[]) -{ - MODEL model; - int indexes[4], i, M=4; - unsigned int nbit = 0; +void codec2_encode_700c(struct CODEC2 *c2, unsigned char *bits, + short speech[]) { + MODEL model; + int indexes[4], i, M = 4; + unsigned int nbit = 0; - assert(c2 != NULL); + assert(c2 != NULL); - memset(bits, '\0', ((codec2_bits_per_frame(c2) + 7) / 8)); + memset(bits, '\0', ((codec2_bits_per_frame(c2) + 7) / 8)); - for(i=0; in_samp]); - } + for (i = 0; i < M; i++) { + analyse_one_frame(c2, &model, &speech[i * c2->n_samp]); + } - int K = 20; - float rate_K_vec[K], mean; - float rate_K_vec_no_mean[K], rate_K_vec_no_mean_[K]; - - newamp1_model_to_indexes(&c2->c2const, - indexes, - &model, - rate_K_vec, - c2->rate_K_sample_freqs_kHz, - K, - &mean, - rate_K_vec_no_mean, - rate_K_vec_no_mean_, &c2->se, c2->eq, c2->eq_en); - c2->nse += K; + int K = 20; + float rate_K_vec[K], mean; + float rate_K_vec_no_mean[K], rate_K_vec_no_mean_[K]; + + newamp1_model_to_indexes(&c2->c2const, indexes, &model, rate_K_vec, + c2->rate_K_sample_freqs_kHz, K, &mean, + rate_K_vec_no_mean, rate_K_vec_no_mean_, &c2->se, + c2->eq, c2->eq_en); + c2->nse += K; #ifndef CORTEX_M4 - /* dump features for deep learning experiments */ - if (c2->fmlfeat != NULL) { - fwrite(&mean, 1, sizeof(float), c2->fmlfeat); - fwrite(rate_K_vec_no_mean, K, sizeof(float), c2->fmlfeat); - fwrite(rate_K_vec_no_mean_, K, sizeof(float), c2->fmlfeat); - } + /* dump features for deep learning experiments */ + if (c2->fmlfeat != NULL) { + fwrite(&mean, 1, sizeof(float), c2->fmlfeat); + fwrite(rate_K_vec_no_mean, K, sizeof(float), c2->fmlfeat); + fwrite(rate_K_vec_no_mean_, K, sizeof(float), c2->fmlfeat); + MODEL model_; + memcpy(&model_, &model, sizeof(model)); + float rate_K_vec_[K]; + for (int k = 0; k < K; k++) rate_K_vec_[k] = rate_K_vec_no_mean_[k] + mean; + resample_rate_L(&c2->c2const, &model_, rate_K_vec_, + c2->rate_K_sample_freqs_kHz, K); + fwrite(&model_.A, MAX_AMP, sizeof(float), c2->fmlfeat); + } + if (c2->fmlmodel != NULL) fwrite(&model, sizeof(MODEL), 1, c2->fmlmodel); #endif - - pack_natural_or_gray(bits, &nbit, indexes[0], 9, 0); - pack_natural_or_gray(bits, &nbit, indexes[1], 9, 0); - pack_natural_or_gray(bits, &nbit, indexes[2], 4, 0); - pack_natural_or_gray(bits, &nbit, indexes[3], 6, 0); - assert(nbit == (unsigned)codec2_bits_per_frame(c2)); -} + pack_natural_or_gray(bits, &nbit, indexes[0], 9, 0); + pack_natural_or_gray(bits, &nbit, indexes[1], 9, 0); + pack_natural_or_gray(bits, &nbit, indexes[2], 4, 0); + pack_natural_or_gray(bits, &nbit, indexes[3], 6, 0); + assert(nbit == (unsigned)codec2_bits_per_frame(c2)); +} /*---------------------------------------------------------------------------*\ @@ -2028,46 +1495,53 @@ void codec2_encode_700c(struct CODEC2 *c2, unsigned char * bits, short speech[]) \*---------------------------------------------------------------------------*/ -void codec2_decode_700c(struct CODEC2 *c2, short speech[], const unsigned char * bits) -{ - MODEL model[4]; - int indexes[4]; - int i; - unsigned int nbit = 0; - - assert(c2 != NULL); - - /* unpack bits from channel ------------------------------------*/ - - indexes[0] = unpack_natural_or_gray(bits, &nbit, 9, 0); - indexes[1] = unpack_natural_or_gray(bits, &nbit, 9, 0); - indexes[2] = unpack_natural_or_gray(bits, &nbit, 4, 0); - indexes[3] = unpack_natural_or_gray(bits, &nbit, 6, 0); - - int M = 4; - COMP HH[M][MAX_AMP+1]; - float interpolated_surface_[M][NEWAMP1_K]; - - newamp1_indexes_to_model(&c2->c2const, - model, - (COMP*)HH, - (float*)interpolated_surface_, - c2->prev_rate_K_vec_, - &c2->Wo_left, - &c2->voicing_left, - c2->rate_K_sample_freqs_kHz, - NEWAMP1_K, - c2->phase_fft_fwd_cfg, - c2->phase_fft_inv_cfg, - indexes, - c2->user_rate_K_vec_no_mean_, - c2->post_filter_en); - - - for(i=0; in_samp*i], &model[i], &HH[i][0], 1.5); - } +void codec2_decode_700c(struct CODEC2 *c2, short speech[], + const unsigned char *bits) { + MODEL model[4]; + int indexes[4]; + int i; + unsigned int nbit = 0; + + assert(c2 != NULL); + + /* unpack bits from channel ------------------------------------*/ + + indexes[0] = unpack_natural_or_gray(bits, &nbit, 9, 0); + indexes[1] = unpack_natural_or_gray(bits, &nbit, 9, 0); + indexes[2] = unpack_natural_or_gray(bits, &nbit, 4, 0); + indexes[3] = unpack_natural_or_gray(bits, &nbit, 6, 0); + + int M = 4; + COMP HH[M][MAX_AMP + 1]; + float interpolated_surface_[M][NEWAMP1_K]; + + newamp1_indexes_to_model( + &c2->c2const, model, (COMP *)HH, (float *)interpolated_surface_, + c2->prev_rate_K_vec_, &c2->Wo_left, &c2->voicing_left, + c2->rate_K_sample_freqs_kHz, NEWAMP1_K, c2->phase_fft_fwd_cfg, + c2->phase_fft_inv_cfg, indexes, c2->user_rate_K_vec_no_mean_, + c2->post_filter_en); + + for (i = 0; i < M; i++) { + if (c2->fmlfeat != NULL) { + /* We use standard nb_features=55 feature records for compatibility with + * train_lpcnet.py */ + float features[55] = {0}; + /* just using 18/20 for compatibility with LPCNet, coarse scaling for NN + * input */ + for (int j = 0; j < 18; j++) + features[j] = (interpolated_surface_[i][j] - 30) / 40; + int pitch_index = 21 + 2.0 * M_PI / model[i].Wo; + features[36] = 0.02 * (pitch_index - 100); + features[37] = model[i].voiced; + fwrite(features, 55, sizeof(float), c2->fmlfeat); + } + + /* 700C is a little quieter so lets apply some experimentally derived audio + * gain */ + synthesise_one_frame(c2, &speech[c2->n_samp * i], &model[i], &HH[i][0], + 1.5); + } } /*---------------------------------------------------------------------------*\ @@ -2080,48 +1554,24 @@ void codec2_decode_700c(struct CODEC2 *c2, short speech[], const unsigned char * \*---------------------------------------------------------------------------*/ -float codec2_energy_700c(struct CODEC2 *c2, const unsigned char * bits) -{ - int indexes[4]; - unsigned int nbit = 0; +float codec2_energy_700c(struct CODEC2 *c2, const unsigned char *bits) { + int indexes[4]; + unsigned int nbit = 0; - assert(c2 != NULL); + assert(c2 != NULL); - /* unpack bits from channel ------------------------------------*/ + /* unpack bits from channel ------------------------------------*/ - indexes[0] = unpack_natural_or_gray(bits, &nbit, 9, 0); - indexes[1] = unpack_natural_or_gray(bits, &nbit, 9, 0); - indexes[2] = unpack_natural_or_gray(bits, &nbit, 4, 0); - indexes[3] = unpack_natural_or_gray(bits, &nbit, 6, 0); + indexes[0] = unpack_natural_or_gray(bits, &nbit, 9, 0); + indexes[1] = unpack_natural_or_gray(bits, &nbit, 9, 0); + indexes[2] = unpack_natural_or_gray(bits, &nbit, 4, 0); + indexes[3] = unpack_natural_or_gray(bits, &nbit, 6, 0); - float mean = newamp1_energy_cb[0].cb[indexes[2]]; - mean -= 10; - if (indexes[3] == 0) - mean -= 10; + float mean = newamp1_energy_cb[0].cb[indexes[2]]; + mean -= 10; + if (indexes[3] == 0) mean -= 10; - return POW10F(mean/10.0); -} - -float codec2_energy_450(struct CODEC2 *c2, const unsigned char * bits) -{ - int indexes[4]; - unsigned int nbit = 0; - - assert(c2 != NULL); - - /* unpack bits from channel ------------------------------------*/ - - indexes[0] = unpack_natural_or_gray(bits, &nbit, 9, 0); - //indexes[1] = unpack_natural_or_gray(bits, &nbit, 9, 0); - indexes[2] = unpack_natural_or_gray(bits, &nbit, 3, 0); - indexes[3] = unpack_natural_or_gray(bits, &nbit, 6, 0); - - float mean = newamp2_energy_cb[0].cb[indexes[2]]; - mean -= 10; - if (indexes[3] == 0) - mean -= 10; - - return POW10F(mean/10.0); + return POW10F(mean / 10.0); } /*---------------------------------------------------------------------------*\ @@ -2134,300 +1584,58 @@ float codec2_energy_450(struct CODEC2 *c2, const unsigned char * bits) \*---------------------------------------------------------------------------*/ -float codec2_get_energy(struct CODEC2 *c2, const unsigned char *bits) -{ - assert(c2 != NULL); - assert( - ( CODEC2_MODE_ACTIVE(CODEC2_MODE_3200, c2->mode)) || - ( CODEC2_MODE_ACTIVE(CODEC2_MODE_2400, c2->mode)) || - ( CODEC2_MODE_ACTIVE(CODEC2_MODE_1600, c2->mode)) || - ( CODEC2_MODE_ACTIVE(CODEC2_MODE_1400, c2->mode)) || - ( CODEC2_MODE_ACTIVE(CODEC2_MODE_1300, c2->mode)) || - ( CODEC2_MODE_ACTIVE(CODEC2_MODE_1200, c2->mode)) || - ( CODEC2_MODE_ACTIVE(CODEC2_MODE_700, c2->mode)) || - ( CODEC2_MODE_ACTIVE(CODEC2_MODE_700B, c2->mode)) || - ( CODEC2_MODE_ACTIVE(CODEC2_MODE_700C, c2->mode)) || - ( CODEC2_MODE_ACTIVE(CODEC2_MODE_450, c2->mode)) || - ( CODEC2_MODE_ACTIVE(CODEC2_MODE_450PWB, c2->mode)) - ); - MODEL model; - float xq_dec[2] = {}; - int e_index, WoE_index; - float e; - unsigned int nbit; - - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_3200, c2->mode)) { - nbit = 1 + 1 + WO_BITS; - e_index = unpack(bits, &nbit, E_BITS); - e = decode_energy(e_index, E_BITS); - } - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_2400, c2->mode)) { - nbit = 1 + 1; - WoE_index = unpack(bits, &nbit, WO_E_BITS); - decode_WoE(&c2->c2const, &model, &e, xq_dec, WoE_index); - } - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_1600, c2->mode)) { - nbit = 1 + 1 + WO_BITS; - e_index = unpack(bits, &nbit, E_BITS); - e = decode_energy(e_index, E_BITS); - } - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_1400, c2->mode)) { - nbit = 1 + 1; - WoE_index = unpack(bits, &nbit, WO_E_BITS); - decode_WoE(&c2->c2const, &model, &e, xq_dec, WoE_index); - } - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_1300, c2->mode)) { - nbit = 1 + 1 + 1 + 1 + WO_BITS; - e_index = unpack_natural_or_gray(bits, &nbit, E_BITS, c2->gray); - e = decode_energy(e_index, E_BITS); - } - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_1200, c2->mode)) { - nbit = 1 + 1; - WoE_index = unpack(bits, &nbit, WO_E_BITS); - decode_WoE(&c2->c2const, &model, &e, xq_dec, WoE_index); - } - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_700, c2->mode)) { - nbit = 1 + 5; - e_index = unpack_natural_or_gray(bits, &nbit, 3, c2->gray); - e = decode_energy(e_index, 3); - } - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_700B, c2->mode)) { - nbit = 1 + 5; - e_index = unpack_natural_or_gray(bits, &nbit, 3, c2->gray); - e = decode_energy(e_index, 3); - } - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_700C, c2->mode)) { - e = codec2_energy_700c(c2, bits); - } - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_450, c2->mode) || CODEC2_MODE_ACTIVE(CODEC2_MODE_450PWB, c2->mode)) { - e = codec2_energy_450(c2, bits); - } - - return e; -} - - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: codec2_encode_450 - AUTHOR......: Thomas Kurin and Stefan Erhardt - INSTITUTE...: Institute for Electronics Engineering, University of Erlangen-Nuremberg - DATE CREATED: July 2018 - - 450 bit/s codec that uses newamp2 fixed rate VQ of amplitudes. - - Encodes 320 speech samples (40ms of speech) into 28 bits. - - The codec2 algorithm actually operates internally on 10ms (80 - sample) frames, so we run the encoding algorithm four times: - - frame 0: nothing - frame 1: nothing - frame 2: nothing - frame 3: 9 bit 1 stage VQ, 3 bits energy, - 6 bit scalar Wo/voicing/plosive. No spare bits. - - If a plosive is detected the frame at the energy-step is encoded. - - Voicing is encoded using the 000000 index of the Wo quantiser. - Plosive is encoded using the 111111 index of the Wo quantiser. - - The bit allocation is: - - Parameter frames 1-3 frame 4 Total - ----------------------------------------------------------- - Harmonic magnitudes (rate k VQ) 0 9 9 - Energy 0 3 3 - log Wo/voicing/plosive 0 6 6 - TOTAL 0 18 18 - - -\*---------------------------------------------------------------------------*/ - -void codec2_encode_450(struct CODEC2 *c2, unsigned char * bits, short speech[]) -{ - MODEL model; - int indexes[4], i,h, M=4; - unsigned int nbit = 0; - int plosiv = 0; - float energydelta[M]; - int spectralCounter; - - assert(c2 != NULL); - - memset(bits, '\0', ((codec2_bits_per_frame(c2) + 7) / 8)); - for(i=0; in_samp]); - energydelta[i] = 0; - spectralCounter = 0; - for(h = 0;h<(model.L);h++){ - //only detect above 300 Hz - if(h*model.Wo*(c2->c2const.Fs/2000.0)/M_PI > 0.3){ - energydelta[i] = energydelta[i] + 20.0*log10(model.A[10]+1E-16); - spectralCounter = spectralCounter+1; - } - - } - energydelta[i] = energydelta[i] / spectralCounter ; - } - //Constants for plosive Detection tdB = threshold; minPwr = from below this level plosives have to rise - float tdB = 15; //not fixed can be changed - float minPwr = 15; //not fixed can be changed - if((c2->energy_prev)((c2->energy_prev)+tdB)){ - - plosiv = 1; - } - if(energydelta[0](energydelta[0]+tdB)){ - - plosiv = 2; - } - if(energydelta[1](energydelta[1]+tdB)){ - - plosiv = 3; - } - if(energydelta[2](energydelta[2]+tdB)){ - - plosiv = 4; - } - if(plosiv != 0 && plosiv != 4){ - analyse_one_frame(c2, &model, &speech[(plosiv-1)*c2->n_samp]); - } - - c2->energy_prev = energydelta[3]; - - - int K = 29; - float rate_K_vec[K], mean; - float rate_K_vec_no_mean[K], rate_K_vec_no_mean_[K]; - if(plosiv > 0){ - plosiv = 1; - } - newamp2_model_to_indexes(&c2->c2const, - indexes, - &model, - rate_K_vec, - c2->n2_rate_K_sample_freqs_kHz, - K, - &mean, - rate_K_vec_no_mean, - rate_K_vec_no_mean_, - plosiv); - - - pack_natural_or_gray(bits, &nbit, indexes[0], 9, 0); - //pack_natural_or_gray(bits, &nbit, indexes[1], 9, 0); - pack_natural_or_gray(bits, &nbit, indexes[2], 3, 0); - pack_natural_or_gray(bits, &nbit, indexes[3], 6, 0); - - assert(nbit == (unsigned)codec2_bits_per_frame(c2)); -} - - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: codec2_decode_450 - AUTHOR......: Thomas Kurin and Stefan Erhardt - INSTITUTE...: Institute for Electronics Engineering, University of Erlangen-Nuremberg - DATE CREATED: July 2018 - -\*---------------------------------------------------------------------------*/ - -void codec2_decode_450(struct CODEC2 *c2, short speech[], const unsigned char * bits) -{ - MODEL model[4]; - int indexes[4]; - int i; - unsigned int nbit = 0; - - assert(c2 != NULL); - - /* unpack bits from channel ------------------------------------*/ - - indexes[0] = unpack_natural_or_gray(bits, &nbit, 9, 0); - //indexes[1] = unpack_natural_or_gray(bits, &nbit, 9, 0); - indexes[2] = unpack_natural_or_gray(bits, &nbit, 3, 0); - indexes[3] = unpack_natural_or_gray(bits, &nbit, 6, 0); - - int M = 4; - COMP HH[M][MAX_AMP+1]; - float interpolated_surface_[M][NEWAMP2_K]; - int pwbFlag = 0; - - newamp2_indexes_to_model(&c2->c2const, - model, - (COMP*)HH, - (float*)interpolated_surface_, - c2->n2_prev_rate_K_vec_, - &c2->Wo_left, - &c2->voicing_left, - c2->n2_rate_K_sample_freqs_kHz, - NEWAMP2_K, - c2->phase_fft_fwd_cfg, - c2->phase_fft_inv_cfg, - indexes, - 1.5, - pwbFlag); - - - for(i=0; in_samp*i], &model[i], &HH[i][0], 1.5); - } -} - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: codec2_decode_450pwb - AUTHOR......: Thomas Kurin and Stefan Erhardt - INSTITUTE...: Institute for Electronics Engineering, University of Erlangen-Nuremberg - DATE CREATED: July 2018 - - Decodes the 450 codec data in pseudo wideband at 16kHz samplerate. - -\*---------------------------------------------------------------------------*/ +float codec2_get_energy(struct CODEC2 *c2, const unsigned char *bits) { + assert(c2 != NULL); + assert((CODEC2_MODE_ACTIVE(CODEC2_MODE_3200, c2->mode)) || + (CODEC2_MODE_ACTIVE(CODEC2_MODE_2400, c2->mode)) || + (CODEC2_MODE_ACTIVE(CODEC2_MODE_1600, c2->mode)) || + (CODEC2_MODE_ACTIVE(CODEC2_MODE_1400, c2->mode)) || + (CODEC2_MODE_ACTIVE(CODEC2_MODE_1300, c2->mode)) || + (CODEC2_MODE_ACTIVE(CODEC2_MODE_1200, c2->mode)) || + (CODEC2_MODE_ACTIVE(CODEC2_MODE_700C, c2->mode))); + MODEL model; + float xq_dec[2] = {}; + int e_index, WoE_index; + float e = 0.0f; + unsigned int nbit; + + if (CODEC2_MODE_ACTIVE(CODEC2_MODE_3200, c2->mode)) { + nbit = 1 + 1 + WO_BITS; + e_index = unpack(bits, &nbit, E_BITS); + e = decode_energy(e_index, E_BITS); + } + if (CODEC2_MODE_ACTIVE(CODEC2_MODE_2400, c2->mode)) { + nbit = 1 + 1; + WoE_index = unpack(bits, &nbit, WO_E_BITS); + decode_WoE(&c2->c2const, &model, &e, xq_dec, WoE_index); + } + if (CODEC2_MODE_ACTIVE(CODEC2_MODE_1600, c2->mode)) { + nbit = 1 + 1 + WO_BITS; + e_index = unpack(bits, &nbit, E_BITS); + e = decode_energy(e_index, E_BITS); + } + if (CODEC2_MODE_ACTIVE(CODEC2_MODE_1400, c2->mode)) { + nbit = 1 + 1; + WoE_index = unpack(bits, &nbit, WO_E_BITS); + decode_WoE(&c2->c2const, &model, &e, xq_dec, WoE_index); + } + if (CODEC2_MODE_ACTIVE(CODEC2_MODE_1300, c2->mode)) { + nbit = 1 + 1 + 1 + 1 + WO_BITS; + e_index = unpack_natural_or_gray(bits, &nbit, E_BITS, c2->gray); + e = decode_energy(e_index, E_BITS); + } + if (CODEC2_MODE_ACTIVE(CODEC2_MODE_1200, c2->mode)) { + nbit = 1 + 1; + WoE_index = unpack(bits, &nbit, WO_E_BITS); + decode_WoE(&c2->c2const, &model, &e, xq_dec, WoE_index); + } + if (CODEC2_MODE_ACTIVE(CODEC2_MODE_700C, c2->mode)) { + e = codec2_energy_700c(c2, bits); + } -void codec2_decode_450pwb(struct CODEC2 *c2, short speech[], const unsigned char * bits) -{ - MODEL model[4]; - int indexes[4]; - int i; - unsigned int nbit = 0; - - assert(c2 != NULL); - - /* unpack bits from channel ------------------------------------*/ - - indexes[0] = unpack_natural_or_gray(bits, &nbit, 9, 0); - //indexes[1] = unpack_natural_or_gray(bits, &nbit, 9, 0); - indexes[2] = unpack_natural_or_gray(bits, &nbit, 3, 0); - indexes[3] = unpack_natural_or_gray(bits, &nbit, 6, 0); - - int M = 4; - COMP HH[M][MAX_AMP+1]; - float interpolated_surface_[M][NEWAMP2_16K_K]; - int pwbFlag = 1; - - newamp2_indexes_to_model(&c2->c2const, - model, - (COMP*)HH, - (float*)interpolated_surface_, - c2->n2_pwb_prev_rate_K_vec_, - &c2->Wo_left, - &c2->voicing_left, - c2->n2_pwb_rate_K_sample_freqs_kHz, - NEWAMP2_16K_K, - c2->phase_fft_fwd_cfg, - c2->phase_fft_inv_cfg, - indexes, - 1.5, - pwbFlag); - - - for(i=0; in_samp*i], &model[i], &HH[i][0], 1.5); - } + return e; } - /*---------------------------------------------------------------------------* \ FUNCTION....: synthesise_one_frame() @@ -2438,56 +1646,41 @@ void codec2_decode_450pwb(struct CODEC2 *c2, short speech[], const unsigned char \*---------------------------------------------------------------------------*/ -void synthesise_one_frame(struct CODEC2 *c2, short speech[], MODEL *model, COMP Aw[], float gain) -{ - int i; - //PROFILE_VAR(phase_start, pf_start, synth_start); - - //#ifdef DUMP - //dump_quantised_model(model); - //#endif - - //PROFILE_SAMPLE(phase_start); - - if ( CODEC2_MODE_ACTIVE(CODEC2_MODE_700C, c2->mode) || CODEC2_MODE_ACTIVE(CODEC2_MODE_450, c2->mode) || CODEC2_MODE_ACTIVE(CODEC2_MODE_450PWB, c2->mode) ) { - /* newamp1/2, we've already worked out rate L phase */ - COMP *H = Aw; - phase_synth_zero_order(c2->n_samp, model, &c2->ex_phase, H); - } else { - /* LPC based phase synthesis */ - COMP H[MAX_AMP+1]; - sample_phase(model, H, Aw); - phase_synth_zero_order(c2->n_samp, model, &c2->ex_phase, H); - } - - //PROFILE_SAMPLE_AND_LOG(pf_start, phase_start, " phase_synth"); - - postfilter(model, &c2->bg_est); - - //PROFILE_SAMPLE_AND_LOG(synth_start, pf_start, " postfilter"); - - synthesise(c2->n_samp, c2->fftr_inv_cfg, c2->Sn_, model, c2->Pn, 1); - - for(i=0; in_samp; i++) { - c2->Sn_[i] *= gain; - } - - //PROFILE_SAMPLE_AND_LOG2(synth_start, " synth"); - - ear_protection(c2->Sn_, c2->n_samp); - - for(i=0; in_samp; i++) { - if (c2->Sn_[i] > 32767.0) - speech[i] = 32767; - else if (c2->Sn_[i] < -32767.0) - speech[i] = -32767; - else - speech[i] = c2->Sn_[i]; - } - +void synthesise_one_frame(struct CODEC2 *c2, short speech[], MODEL *model, + COMP Aw[], float gain) { + int i; + + if (CODEC2_MODE_ACTIVE(CODEC2_MODE_700C, c2->mode)) { + /* newamp1, we've already worked out rate L phase */ + COMP *H = Aw; + phase_synth_zero_order(c2->n_samp, model, &c2->ex_phase, H); + } else { + /* LPC based phase synthesis */ + COMP H[MAX_AMP + 1]; + sample_phase(model, H, Aw); + phase_synth_zero_order(c2->n_samp, model, &c2->ex_phase, H); + } + + postfilter(model, &c2->bg_est); + synthesise(c2->n_samp, c2->fftr_inv_cfg, c2->Sn_, model, c2->Pn, 1); + + for (i = 0; i < c2->n_samp; i++) { + c2->Sn_[i] *= gain; + } + + ear_protection(c2->Sn_, c2->n_samp); + + for (i = 0; i < c2->n_samp; i++) { + if (c2->Sn_[i] > 32767.0) + speech[i] = 32767; + else if (c2->Sn_[i] < -32767.0) + speech[i] = -32767; + else + speech[i] = c2->Sn_[i]; + } } -/*---------------------------------------------------------------------------*\ +/*---------------------------------------------------------------------------* \ FUNCTION....: analyse_one_frame() AUTHOR......: David Rowe @@ -2498,48 +1691,40 @@ void synthesise_one_frame(struct CODEC2 *c2, short speech[], MODEL *model, COMP \*---------------------------------------------------------------------------*/ -void analyse_one_frame(struct CODEC2 *c2, MODEL *model, short speech[]) -{ - COMP Sw[FFT_ENC]; - float pitch; - int i; - //PROFILE_VAR(dft_start, nlp_start, model_start, two_stage, estamps); - int n_samp = c2->n_samp; - int m_pitch = c2->m_pitch; +void analyse_one_frame(struct CODEC2 *c2, MODEL *model, short speech[]) { + COMP Sw[FFT_ENC]; + float pitch; + int i; + int n_samp = c2->n_samp; + int m_pitch = c2->m_pitch; - /* Read input speech */ + /* Read input speech */ - for(i=0; iSn[i] = c2->Sn[i+n_samp]; - for(i=0; iSn[i+m_pitch-n_samp] = speech[i]; + for (i = 0; i < m_pitch - n_samp; i++) c2->Sn[i] = c2->Sn[i + n_samp]; + for (i = 0; i < n_samp; i++) c2->Sn[i + m_pitch - n_samp] = speech[i]; - //PROFILE_SAMPLE(dft_start); - dft_speech(&c2->c2const, c2->fft_fwd_cfg, Sw, c2->Sn, c2->w); - //PROFILE_SAMPLE_AND_LOG(nlp_start, dft_start, " dft_speech"); + dft_speech(&c2->c2const, c2->fft_fwd_cfg, Sw, c2->Sn, c2->w); - /* Estimate pitch */ + /* Estimate pitch */ + nlp(c2->nlp, c2->Sn, n_samp, &pitch, Sw, c2->W, &c2->prev_f0_enc); + model->Wo = TWO_PI / pitch; + model->L = PI / model->Wo; - nlp(c2->nlp, c2->Sn, n_samp, &pitch, Sw, c2->W, &c2->prev_f0_enc); - //PROFILE_SAMPLE_AND_LOG(model_start, nlp_start, " nlp"); + /* estimate model parameters */ + two_stage_pitch_refinement(&c2->c2const, model, Sw); - model->Wo = TWO_PI/pitch; - model->L = PI/model->Wo; - - /* estimate model parameters */ - - two_stage_pitch_refinement(&c2->c2const, model, Sw); - //PROFILE_SAMPLE_AND_LOG(two_stage, model_start, " two_stage"); + /* estimate phases when doing ML experiments */ + if (c2->fmlfeat != NULL) + estimate_amplitudes(model, Sw, c2->W, 1); + else estimate_amplitudes(model, Sw, c2->W, 0); - //PROFILE_SAMPLE_AND_LOG(estamps, two_stage, " est_amps"); - est_voicing_mbe(&c2->c2const, model, Sw, c2->W); - //PROFILE_SAMPLE_AND_LOG2(estamps, " est_voicing"); - #ifdef DUMP - dump_model(model); - #endif + est_voicing_mbe(&c2->c2const, model, Sw, c2->W); +#ifdef DUMP + dump_model(model); +#endif } -/*---------------------------------------------------------------------------*\ +/*---------------------------------------------------------------------------* \ FUNCTION....: ear_protection() AUTHOR......: David Rowe @@ -2552,40 +1737,37 @@ void analyse_one_frame(struct CODEC2 *c2, MODEL *model, short speech[]) \*---------------------------------------------------------------------------*/ static void ear_protection(float in_out[], int n) { - float max_sample, over, gain; - int i; + float max_sample, over, gain; + int i; - /* find maximum sample in frame */ + /* find maximum sample in frame */ - max_sample = 0.0; - for(i=0; i max_sample) - max_sample = in_out[i]; + max_sample = 0.0; + for (i = 0; i < n; i++) + if (in_out[i] > max_sample) max_sample = in_out[i]; - /* determine how far above set point */ + /* determine how far above set point */ - over = max_sample/30000.0; + over = max_sample / 30000.0; - /* If we are x dB over set point we reduce level by 2x dB, this - attenuates major excursions in amplitude (likely to be caused - by bit errors) more than smaller ones */ + /* If we are x dB over set point we reduce level by 2x dB, this + attenuates major excursions in amplitude (likely to be caused + by bit errors) more than smaller ones */ - if (over > 1.0) { - gain = 1.0/(over*over); - //fprintf(stderr, "gain: %f\n", gain); - for(i=0; i 1.0) { + gain = 1.0 / (over * over); + for (i = 0; i < n; i++) in_out[i] *= gain; + } } -void codec2_set_lpc_post_filter(struct CODEC2 *c2, int enable, int bass_boost, float beta, float gamma) -{ - assert((beta >= 0.0) && (beta <= 1.0)); - assert((gamma >= 0.0) && (gamma <= 1.0)); - c2->lpc_pf = enable; - c2->bass_boost = bass_boost; - c2->beta = beta; - c2->gamma = gamma; +void codec2_set_lpc_post_filter(struct CODEC2 *c2, int enable, int bass_boost, + float beta, float gamma) { + assert((beta >= 0.0) && (beta <= 1.0)); + assert((gamma >= 0.0) && (gamma <= 1.0)); + c2->lpc_pf = enable; + c2->bass_boost = bass_boost; + c2->beta = beta; + c2->gamma = gamma; } /* @@ -2594,29 +1776,22 @@ void codec2_set_lpc_post_filter(struct CODEC2 *c2, int enable, int bass_boost, f Experimental method of sending voice/data frames for FreeDV. */ -int codec2_get_spare_bit_index(struct CODEC2 *c2) -{ - assert(c2 != NULL); +int codec2_get_spare_bit_index(struct CODEC2 *c2) { + assert(c2 != NULL); - switch(c2->mode) { + switch (c2->mode) { case CODEC2_MODE_1300: - return 2; // bit 2 (3th bit) is v2 (third voicing bit) - break; + return 2; // bit 2 (3th bit) is v2 (third voicing bit) + break; case CODEC2_MODE_1400: - return 10; // bit 10 (11th bit) is v2 (third voicing bit) - break; + return 10; // bit 10 (11th bit) is v2 (third voicing bit) + break; case CODEC2_MODE_1600: - return 15; // bit 15 (16th bit) is v2 (third voicing bit) - break; - case CODEC2_MODE_700: - return 26; // bits 26 and 27 are spare - break; - case CODEC2_MODE_700B: - return 27; // bit 27 is spare - break; - } + return 15; // bit 15 (16th bit) is v2 (third voicing bit) + break; + } - return -1; + return -1; } /* @@ -2624,111 +1799,123 @@ int codec2_get_spare_bit_index(struct CODEC2 *c2) for convenience. */ -int codec2_rebuild_spare_bit(struct CODEC2 *c2, int unpacked_bits[]) -{ - int v1,v3; +int codec2_rebuild_spare_bit(struct CODEC2 *c2, char unpacked_bits[]) { + int v1, v3; - assert(c2 != NULL); + assert(c2 != NULL); - v1 = unpacked_bits[1]; + v1 = unpacked_bits[1]; - switch(c2->mode) { + switch (c2->mode) { case CODEC2_MODE_1300: - v3 = unpacked_bits[1+1+1]; + v3 = unpacked_bits[1 + 1 + 1]; - /* if either adjacent frame is voiced, make this one voiced */ + /* if either adjacent frame is voiced, make this one voiced */ - unpacked_bits[2] = (v1 || v3); + unpacked_bits[2] = (v1 || v3); - return 0; + return 0; - break; + break; case CODEC2_MODE_1400: - v3 = unpacked_bits[1+1+8+1]; + v3 = unpacked_bits[1 + 1 + 8 + 1]; - /* if either adjacent frame is voiced, make this one voiced */ + /* if either adjacent frame is voiced, make this one voiced */ - unpacked_bits[10] = (v1 || v3); + unpacked_bits[10] = (v1 || v3); - return 0; + return 0; - break; + break; case CODEC2_MODE_1600: - v3 = unpacked_bits[1+1+8+5+1]; + v3 = unpacked_bits[1 + 1 + 8 + 5 + 1]; - /* if either adjacent frame is voiced, make this one voiced */ + /* if either adjacent frame is voiced, make this one voiced */ - unpacked_bits[15] = (v1 || v3); + unpacked_bits[15] = (v1 || v3); - return 0; + return 0; - break; - } + break; + } - return -1; + return -1; } -void codec2_set_natural_or_gray(struct CODEC2 *c2, int gray) -{ - assert(c2 != NULL); - c2->gray = gray; +void codec2_set_natural_or_gray(struct CODEC2 *c2, int gray) { + assert(c2 != NULL); + c2->gray = gray; } -void codec2_set_softdec(struct CODEC2 *c2, float *softdec) -{ - assert(c2 != NULL); - c2->softdec = softdec; +void codec2_set_softdec(struct CODEC2 *c2, float *softdec) { + assert(c2 != NULL); + c2->softdec = softdec; } -void codec2_open_mlfeat(struct CODEC2 *codec2_state, char *filename) { - if ((codec2_state->fmlfeat = fopen(filename, "wb")) == NULL) { - fprintf(stderr, "error opening machine learning feature file: %s\n", filename); - exit(1); - } +void codec2_open_mlfeat(struct CODEC2 *codec2_state, char *feat_fn, + char *model_fn) { + if ((codec2_state->fmlfeat = fopen(feat_fn, "wb")) == NULL) { + fprintf(stderr, "error opening machine learning feature file: %s\n", + feat_fn); + exit(1); + } + if (model_fn) { + if ((codec2_state->fmlmodel = fopen(model_fn, "wb")) == NULL) { + fprintf(stderr, "error opening machine learning Codec 2 model file: %s\n", + feat_fn); + exit(1); + } + } } #ifndef __EMBEDDED__ -void codec2_load_codebook(struct CODEC2 *codec2_state, int num, char *filename) { - FILE *f; - - if ((f = fopen(filename, "rb")) == NULL) { - fprintf(stderr, "error opening codebook file: %s\n", filename); - exit(1); - } - //fprintf(stderr, "reading newamp1vq_cb[%d] k=%d m=%d\n", num, newamp1vq_cb[num].k, newamp1vq_cb[num].m); - float tmp[newamp1vq_cb[num].k*newamp1vq_cb[num].m]; - int nread = fread(tmp, sizeof(float), newamp1vq_cb[num].k*newamp1vq_cb[num].m, f); - float *p = (float*)newamp1vq_cb[num].cb; - for(int i=0; inse) - return codec2_state->se/codec2_state->nse; - else - return 0; + if (codec2_state->nse) + return codec2_state->se / codec2_state->nse; + else + return 0; } float *codec2_enable_user_ratek(struct CODEC2 *codec2_state, int *K) { - codec2_state->user_rate_K_vec_no_mean_ = (float*)malloc(sizeof(float)*NEWAMP1_K); - *K = NEWAMP1_K; - return codec2_state->user_rate_K_vec_no_mean_; + codec2_state->user_rate_K_vec_no_mean_ = + (float *)malloc(sizeof(float) * NEWAMP1_K); + *K = NEWAMP1_K; + return codec2_state->user_rate_K_vec_no_mean_; } -void codec2_700c_post_filter(struct CODEC2 *codec2_state, int en) { - codec2_state->post_filter_en = en; +void codec2_700c_post_filter(struct CODEC2 *codec2_state, bool en) { + codec2_state->post_filter_en = en; } -void codec2_700c_eq(struct CODEC2 *codec2_state, int en) { - codec2_state->eq_en = en; - codec2_state->se = 0.0; codec2_state->nse = 0; +void codec2_700c_eq(struct CODEC2 *codec2_state, bool en) { + codec2_state->eq_en = en; + codec2_state->se = 0.0; + codec2_state->nse = 0; } diff --git a/codec2.h b/codec2.h index 709b462..97e9262 100644 --- a/codec2.h +++ b/codec2.h @@ -26,26 +26,22 @@ along with this program; if not, see . */ +#ifndef __CODEC2__ +#define __CODEC2__ +#include "version.h" +#include + #ifdef __cplusplus - extern "C" { +extern "C" { #endif -#ifndef __CODEC2__ -#define __CODEC2__ - -#include - -#define CODEC2_MODE_3200 0 -#define CODEC2_MODE_2400 1 -#define CODEC2_MODE_1600 2 -#define CODEC2_MODE_1400 3 -#define CODEC2_MODE_1300 4 -#define CODEC2_MODE_1200 5 -#define CODEC2_MODE_700 6 -#define CODEC2_MODE_700B 7 -#define CODEC2_MODE_700C 8 -#define CODEC2_MODE_450 10 -#define CODEC2_MODE_450PWB 11 +#define CODEC2_MODE_3200 0 +#define CODEC2_MODE_2400 1 +#define CODEC2_MODE_1600 2 +#define CODEC2_MODE_1400 3 +#define CODEC2_MODE_1300 4 +#define CODEC2_MODE_1200 5 +#define CODEC2_MODE_700C 8 #ifndef CODEC2_MODE_EN_DEFAULT #define CODEC2_MODE_EN_DEFAULT 1 @@ -55,76 +51,70 @@ // disable during compile time with -DCODEC2_MODE_1600_EN=0 // all but CODEC2 1600 are enabled then -//or the other way round -// -DCODEC2_MODE_EN_DEFAULT=0 -DCODEC2_MODE_1600_EN=1 -// only CODEC2 Mode 1600 +// or the other way round +// -DCODEC2_MODE_EN_DEFAULT=0 -DCODEC2_MODE_1600_EN=1 +// only CODEC2 Mode 1600 #if !defined(CODEC2_MODE_3200_EN) - #define CODEC2_MODE_3200_EN CODEC2_MODE_EN_DEFAULT +#define CODEC2_MODE_3200_EN CODEC2_MODE_EN_DEFAULT #endif #if !defined(CODEC2_MODE_2400_EN) - #define CODEC2_MODE_2400_EN CODEC2_MODE_EN_DEFAULT +#define CODEC2_MODE_2400_EN CODEC2_MODE_EN_DEFAULT #endif #if !defined(CODEC2_MODE_1600_EN) - #define CODEC2_MODE_1600_EN CODEC2_MODE_EN_DEFAULT +#define CODEC2_MODE_1600_EN CODEC2_MODE_EN_DEFAULT #endif #if !defined(CODEC2_MODE_1400_EN) - #define CODEC2_MODE_1400_EN CODEC2_MODE_EN_DEFAULT +#define CODEC2_MODE_1400_EN CODEC2_MODE_EN_DEFAULT #endif #if !defined(CODEC2_MODE_1300_EN) - #define CODEC2_MODE_1300_EN CODEC2_MODE_EN_DEFAULT +#define CODEC2_MODE_1300_EN CODEC2_MODE_EN_DEFAULT #endif #if !defined(CODEC2_MODE_1200_EN) - #define CODEC2_MODE_1200_EN CODEC2_MODE_EN_DEFAULT -#endif -#if !defined(CODEC2_MODE_700_EN) - #define CODEC2_MODE_700_EN CODEC2_MODE_EN_DEFAULT -#endif -#if !defined(CODEC2_MODE_700B_EN) - #define CODEC2_MODE_700B_EN CODEC2_MODE_EN_DEFAULT +#define CODEC2_MODE_1200_EN CODEC2_MODE_EN_DEFAULT #endif #if !defined(CODEC2_MODE_700C_EN) - #define CODEC2_MODE_700C_EN CODEC2_MODE_EN_DEFAULT -#endif -#if !defined(CODEC2_MODE_450_EN) - #define CODEC2_MODE_450_EN CODEC2_MODE_EN_DEFAULT -#endif -#if !defined(CODEC2_MODE_450PWB_EN) - #define CODEC2_MODE_450PWB_EN CODEC2_MODE_EN_DEFAULT +#define CODEC2_MODE_700C_EN CODEC2_MODE_EN_DEFAULT #endif -#define CODEC2_MODE_ACTIVE(mode_name, var) ((mode_name##_EN) == 0 ? 0: (var) == mode_name) +#define CODEC2_MODE_ACTIVE(mode_name, var) \ + ((mode_name##_EN) == 0 ? 0 : (var) == mode_name) struct CODEC2; -struct CODEC2 * codec2_create(int mode); +struct CODEC2 *codec2_create(int mode); void codec2_destroy(struct CODEC2 *codec2_state); -void codec2_encode(struct CODEC2 *codec2_state, unsigned char * bits, short speech_in[]); -void codec2_decode(struct CODEC2 *codec2_state, short speech_out[], const unsigned char *bits); -void codec2_decode_ber(struct CODEC2 *codec2_state, short speech_out[], const unsigned char *bits, float ber_est); -int codec2_samples_per_frame(struct CODEC2 *codec2_state); -int codec2_bits_per_frame(struct CODEC2 *codec2_state); - -void codec2_set_lpc_post_filter(struct CODEC2 *codec2_state, int enable, int bass_boost, float beta, float gamma); -int codec2_get_spare_bit_index(struct CODEC2 *codec2_state); -int codec2_rebuild_spare_bit(struct CODEC2 *codec2_state, int unpacked_bits[]); +void codec2_encode(struct CODEC2 *codec2_state, unsigned char bytes[], + short speech_in[]); +void codec2_decode(struct CODEC2 *codec2_state, short speech_out[], + const unsigned char bytes[]); +void codec2_decode_ber(struct CODEC2 *codec2_state, short speech_out[], + const unsigned char *bytes, float ber_est); +int codec2_samples_per_frame(struct CODEC2 *codec2_state); +int codec2_bits_per_frame(struct CODEC2 *codec2_state); +int codec2_bytes_per_frame(struct CODEC2 *codec2_state); + +void codec2_set_lpc_post_filter(struct CODEC2 *codec2_state, int enable, + int bass_boost, float beta, float gamma); +int codec2_get_spare_bit_index(struct CODEC2 *codec2_state); +int codec2_rebuild_spare_bit(struct CODEC2 *codec2_state, char unpacked_bits[]); void codec2_set_natural_or_gray(struct CODEC2 *codec2_state, int gray); void codec2_set_softdec(struct CODEC2 *c2, float *softdec); float codec2_get_energy(struct CODEC2 *codec2_state, const unsigned char *bits); - + // support for ML and VQ experiments -void codec2_open_mlfeat(struct CODEC2 *codec2_state, char *filename); +void codec2_open_mlfeat(struct CODEC2 *codec2_state, char *feat_filename, + char *model_filename); void codec2_load_codebook(struct CODEC2 *codec2_state, int num, char *filename); float codec2_get_var(struct CODEC2 *codec2_state); float *codec2_enable_user_ratek(struct CODEC2 *codec2_state, int *K); // 700C post filter and equaliser -void codec2_700c_post_filter(struct CODEC2 *codec2_state, int en); -void codec2_700c_eq(struct CODEC2 *codec2_state, int en); - -#endif +void codec2_700c_post_filter(struct CODEC2 *codec2_state, bool en); +void codec2_700c_eq(struct CODEC2 *codec2_state, bool en); #ifdef __cplusplus } #endif +#endif diff --git a/codec2_fft.c b/codec2_fft.c index 14b8670..7a75062 100644 --- a/codec2_fft.c +++ b/codec2_fft.c @@ -61,66 +61,63 @@ static const arm_cfft_instance_f32* arm_fft_cache_get(const arm_cfft_instance_f3 #endif #endif -void codec2_fft_free(codec2_fft_cfg cfg) -{ +void codec2_fft_free(codec2_fft_cfg cfg) { #ifdef USE_KISS_FFT - KISS_FFT_FREE(cfg); + KISS_FFT_FREE(cfg); #else - FREE(cfg); + FREE(cfg); #endif } -codec2_fft_cfg codec2_fft_alloc(int nfft, int inverse_fft, void* mem, size_t* lenmem) -{ - codec2_fft_cfg retval; +codec2_fft_cfg codec2_fft_alloc(int nfft, int inverse_fft, void* mem, + size_t* lenmem) { + codec2_fft_cfg retval; #ifdef USE_KISS_FFT - retval = kiss_fft_alloc(nfft, inverse_fft, mem, lenmem); + retval = kiss_fft_alloc(nfft, inverse_fft, mem, lenmem); #else - retval = MALLOC(sizeof(codec2_fft_struct)); - retval->inverse = inverse_fft; - switch(nfft) - { + retval = MALLOC(sizeof(codec2_fft_struct)); + retval->inverse = inverse_fft; + switch (nfft) { case 128: - retval->instance = &arm_cfft_sR_f32_len128; - break; + retval->instance = &arm_cfft_sR_f32_len128; + break; case 256: - retval->instance = &arm_cfft_sR_f32_len256; - break; + retval->instance = &arm_cfft_sR_f32_len256; + break; case 512: - retval->instance = &arm_cfft_sR_f32_len512; - break; -// case 1024: -// retval->instance = &arm_cfft_sR_f32_len1024; -// break; + retval->instance = &arm_cfft_sR_f32_len512; + break; + // case 1024: + // retval->instance = &arm_cfft_sR_f32_len1024; + // break; default: - abort(); - } + abort(); + } // retval->instance = arm_fft_cache_get(retval->instance); #endif - return retval; + return retval; } -codec2_fftr_cfg codec2_fftr_alloc(int nfft, int inverse_fft, void* mem, size_t* lenmem) -{ - codec2_fftr_cfg retval; +codec2_fftr_cfg codec2_fftr_alloc(int nfft, int inverse_fft, void* mem, + size_t* lenmem) { + codec2_fftr_cfg retval; #ifdef USE_KISS_FFT - retval = kiss_fftr_alloc(nfft, inverse_fft, mem, lenmem); + retval = kiss_fftr_alloc(nfft, inverse_fft, mem, lenmem); #else - retval = MALLOC(sizeof(codec2_fftr_struct)); - retval->inverse = inverse_fft; - retval->instance = MALLOC(sizeof(arm_rfft_fast_instance_f32)); - arm_rfft_fast_init_f32(retval->instance,nfft); - // memcpy(&retval->instance->Sint,arm_fft_cache_get(&retval->instance->Sint),sizeof(arm_cfft_instance_f32)); + retval = MALLOC(sizeof(codec2_fftr_struct)); + retval->inverse = inverse_fft; + retval->instance = MALLOC(sizeof(arm_rfft_fast_instance_f32)); + arm_rfft_fast_init_f32(retval->instance, nfft); + // memcpy(&retval->instance->Sint,arm_fft_cache_get(&retval->instance->Sint),sizeof(arm_cfft_instance_f32)); #endif - return retval; + return retval; } -void codec2_fftr_free(codec2_fftr_cfg cfg) -{ +void codec2_fftr_free(codec2_fftr_cfg cfg) { #ifdef USE_KISS_FFT - KISS_FFT_FREE(cfg); + KISS_FFT_FREE(cfg); #else - FREE(cfg->instance); - FREE(cfg); + FREE(cfg->instance); + FREE(cfg); #endif } @@ -129,30 +126,25 @@ void codec2_fftr_free(codec2_fftr_cfg cfg) // not noticeable // the reduced usage of RAM and increased performance on STM32 platforms // should be worth it. -void codec2_fft_inplace(codec2_fft_cfg cfg, codec2_fft_cpx* inout) -{ - +void codec2_fft_inplace(codec2_fft_cfg cfg, codec2_fft_cpx* inout) { #ifdef USE_KISS_FFT + // decide whether to use the local stack based buffer for in + // or to allow kiss_fft to allocate RAM + // second part is just to play safe since first method + // is much faster and uses less RAM + if (cfg->nfft <= 512) { kiss_fft_cpx in[512]; - // decide whether to use the local stack based buffer for in - // or to allow kiss_fft to allocate RAM - // second part is just to play safe since first method - // is much faster and uses less RAM - if (cfg->nfft <= 512) - { - memcpy(in,inout,cfg->nfft*sizeof(kiss_fft_cpx)); - kiss_fft(cfg, in, (kiss_fft_cpx*)inout); - } - else - { - kiss_fft(cfg, (kiss_fft_cpx*)inout, (kiss_fft_cpx*)inout); - } + memcpy(in, inout, cfg->nfft * sizeof(kiss_fft_cpx)); + kiss_fft(cfg, in, (kiss_fft_cpx*)inout); + } else { + kiss_fft(cfg, (kiss_fft_cpx*)inout, (kiss_fft_cpx*)inout); + } #else - arm_cfft_f32(cfg->instance,(float*)inout,cfg->inverse,1); - if (cfg->inverse) - { - arm_scale_f32((float*)inout,cfg->instance->fftLen,(float*)inout,cfg->instance->fftLen*2); - } + arm_cfft_f32(cfg->instance, (float*)inout, cfg->inverse, 1); + if (cfg->inverse) { + arm_scale_f32((float*)inout, cfg->instance->fftLen, (float*)inout, + cfg->instance->fftLen * 2); + } #endif } diff --git a/codec2_fft.h b/codec2_fft.h index c741202..1952864 100644 --- a/codec2_fft.h +++ b/codec2_fft.h @@ -9,96 +9,91 @@ #define DRIVERS_FREEDV_CODEC2_FFT_H_ #include -#include +#include #include +#include #include -#include -#ifdef FDV_ARM_MATH - #include "fdv_arm_math.h" +#ifndef FDV_ARM_MATH +#define USE_KISS_FFT #else - #define USE_KISS_FFT +#include "arm_const_structs.h" +#include "arm_math.h" #endif -#include "defines.h" #include "comp.h" +#include "defines.h" - -typedef COMP codec2_fft_cpx; +typedef COMP codec2_fft_cpx; #include "kiss_fftr.h" #ifdef USE_KISS_FFT - #include "kiss_fft.h" - typedef kiss_fftr_cfg codec2_fftr_cfg; - typedef kiss_fft_cfg codec2_fft_cfg; - typedef kiss_fft_scalar codec2_fft_scalar; +#include "kiss_fft.h" +typedef kiss_fftr_cfg codec2_fftr_cfg; +typedef kiss_fft_cfg codec2_fft_cfg; +typedef kiss_fft_scalar codec2_fft_scalar; #else - typedef float32_t codec2_fft_scalar; - typedef struct { - arm_rfft_fast_instance_f32* instance; - int inverse; - } codec2_fftr_struct; - - typedef codec2_fftr_struct* codec2_fftr_cfg; - - typedef struct { - const arm_cfft_instance_f32* instance; - int inverse; - } codec2_fft_struct; - typedef codec2_fft_struct* codec2_fft_cfg; +typedef float32_t codec2_fft_scalar; +typedef struct { + arm_rfft_fast_instance_f32* instance; + int inverse; +} codec2_fftr_struct; + +typedef codec2_fftr_struct* codec2_fftr_cfg; + +typedef struct { + const arm_cfft_instance_f32* instance; + int inverse; +} codec2_fft_struct; +typedef codec2_fft_struct* codec2_fft_cfg; #endif - - -static inline void codec2_fftr(codec2_fftr_cfg cfg, codec2_fft_scalar* in, codec2_fft_cpx* out) -{ - +static inline void codec2_fftr(codec2_fftr_cfg cfg, codec2_fft_scalar* in, + codec2_fft_cpx* out) { #ifdef USE_KISS_FFT - kiss_fftr(cfg, in, (kiss_fft_cpx*)out); + kiss_fftr(cfg, in, (kiss_fft_cpx*)out); #else - arm_rfft_fast_f32(cfg->instance,in,(float*)out,cfg->inverse); - out->imag = 0; // remove out[FFT_ENC/2]->real stored in out[0].imag + arm_rfft_fast_f32(cfg->instance, in, (float*)out, cfg->inverse); + out->imag = 0; // remove out[FFT_ENC/2]->real stored in out[0].imag #endif } -static inline void codec2_fftri(codec2_fftr_cfg cfg, codec2_fft_cpx* in, codec2_fft_scalar* out) -{ +static inline void codec2_fftri(codec2_fftr_cfg cfg, codec2_fft_cpx* in, + codec2_fft_scalar* out) { #ifdef USE_KISS_FFT - kiss_fftri(cfg, (kiss_fft_cpx*)in, out); + kiss_fftri(cfg, (kiss_fft_cpx*)in, out); #else - arm_rfft_fast_f32(cfg->instance,(float*)in,out,cfg->inverse); - // arm_scale_f32(out,cfg->instance->fftLenRFFT,out,cfg->instance->fftLenRFFT); + arm_rfft_fast_f32(cfg->instance, (float*)in, out, cfg->inverse); + // arm_scale_f32(out,cfg->instance->fftLenRFFT,out,cfg->instance->fftLenRFFT); #endif - } -codec2_fft_cfg codec2_fft_alloc(int nfft, int inverse_fft, void* mem, size_t* lenmem); -codec2_fftr_cfg codec2_fftr_alloc(int nfft, int inverse_fft, void* mem, size_t* lenmem); +codec2_fft_cfg codec2_fft_alloc(int nfft, int inverse_fft, void* mem, + size_t* lenmem); +codec2_fftr_cfg codec2_fftr_alloc(int nfft, int inverse_fft, void* mem, + size_t* lenmem); void codec2_fft_free(codec2_fft_cfg cfg); void codec2_fftr_free(codec2_fftr_cfg cfg); - -static inline void codec2_fft(codec2_fft_cfg cfg, codec2_fft_cpx* in, codec2_fft_cpx* out) -{ - +static inline void codec2_fft(codec2_fft_cfg cfg, codec2_fft_cpx* in, + codec2_fft_cpx* out) { #ifdef USE_KISS_FFT - kiss_fft(cfg, (kiss_fft_cpx*)in, (kiss_fft_cpx*)out); + kiss_fft(cfg, (kiss_fft_cpx*)in, (kiss_fft_cpx*)out); #else - memcpy(out,in,cfg->instance->fftLen*2*sizeof(float)); - arm_cfft_f32(cfg->instance,(float*)out,cfg->inverse, 1); - // TODO: this is not nice, but for now required to keep changes minimal - // however, since main goal is to reduce the memory usage - // we should convert to an in place interface - // on PC like platforms the overhead of using the "inplace" kiss_fft calls - // is neglectable compared to the gain in memory usage on STM32 platforms - if (cfg->inverse) - { - arm_scale_f32((float*)out,cfg->instance->fftLen,(float*)out,cfg->instance->fftLen*2); - } + memcpy(out, in, cfg->instance->fftLen * 2 * sizeof(float)); + arm_cfft_f32(cfg->instance, (float*)out, cfg->inverse, 1); + // TODO: this is not nice, but for now required to keep changes minimal + // however, since main goal is to reduce the memory usage + // we should convert to an in place interface + // on PC like platforms the overhead of using the "inplace" kiss_fft calls + // is neglectable compared to the gain in memory usage on STM32 platforms + if (cfg->inverse) { + arm_scale_f32((float*)out, cfg->instance->fftLen, (float*)out, + cfg->instance->fftLen * 2); + } #endif } void codec2_fft_inplace(codec2_fft_cfg cfg, codec2_fft_cpx* inout); - #endif diff --git a/codec2_internal.h b/codec2_internal.h index b46e358..32cd7eb 100644 --- a/codec2_internal.h +++ b/codec2_internal.h @@ -28,81 +28,76 @@ #ifndef __CODEC2_INTERNAL__ #define __CODEC2_INTERNAL__ +#include #include "codec2_fft.h" #include "newamp1.h" -#include "newamp2.h" struct CODEC2 { - int mode; - C2CONST c2const; - int Fs; - int n_samp; - int m_pitch; - codec2_fft_cfg fft_fwd_cfg; /* forward FFT config */ - codec2_fftr_cfg fftr_fwd_cfg; /* forward real FFT config */ - float *w; /* [m_pitch] time domain hamming window */ - float W[FFT_ENC]; /* DFT of w[] */ - float *Pn; /* [2*n_samp] trapezoidal synthesis window */ - float *bpf_buf; /* buffer for band pass filter */ - float *Sn; /* [m_pitch] input speech */ - float hpf_states[2]; /* high pass filter states */ - void *nlp; /* pitch predictor states */ - int gray; /* non-zero for gray encoding */ - - codec2_fftr_cfg fftr_inv_cfg; /* inverse FFT config */ - float *Sn_; /* [2*n_samp] synthesised output speech */ - float ex_phase; /* excitation model phase track */ - float bg_est; /* background noise estimate for post filter */ - float prev_f0_enc; /* previous frame's f0 estimate */ - MODEL prev_model_dec; /* previous frame's model parameters */ - float prev_lsps_dec[LPC_ORD]; /* previous frame's LSPs */ - float prev_e_dec; /* previous frame's LPC energy */ - - int lpc_pf; /* LPC post filter on */ - int bass_boost; /* LPC post filter bass boost */ - float beta; /* LPC post filter parameters */ - float gamma; - - float xq_enc[2]; /* joint pitch and energy VQ states */ - float xq_dec[2]; - - int smoothing; /* enable smoothing for channels with errors */ - float *softdec; /* optional soft decn bits from demod */ - - /* newamp1 states */ - - float rate_K_sample_freqs_kHz[NEWAMP1_K]; - float prev_rate_K_vec_[NEWAMP1_K]; - float Wo_left; - int voicing_left; - codec2_fft_cfg phase_fft_fwd_cfg; - codec2_fft_cfg phase_fft_inv_cfg; - float se; /* running sum of squared error */ - unsigned int nse; /* number of terms in sum */ - float *user_rate_K_vec_no_mean_; /* optional, user supplied vector for quantisation experiments */ - int post_filter_en; - float eq[NEWAMP1_K]; /* optional equaliser */ - int eq_en; - - /*newamp2 states (also uses newamp1 states )*/ - float energy_prev; - float n2_rate_K_sample_freqs_kHz[NEWAMP2_K]; - float n2_prev_rate_K_vec_[NEWAMP2_K]; - float n2_pwb_rate_K_sample_freqs_kHz[NEWAMP2_16K_K]; - float n2_pwb_prev_rate_K_vec_[NEWAMP2_16K_K]; - - /* used to dump features for deep learning experiments */ - FILE *fmlfeat; - - /* encode/decode function pointers for the selected mode */ - void (*encode)(struct CODEC2 *c2, unsigned char * bits, short speech[]); - void (*decode)(struct CODEC2 *c2, short speech[], const unsigned char * bits); - void (*decode_ber)(struct CODEC2 *c2, short speech[], const unsigned char * bits, float ber_est); + int mode; + C2CONST c2const; + int Fs; + int n_samp; + int m_pitch; + codec2_fft_cfg fft_fwd_cfg; /* forward FFT config */ + codec2_fftr_cfg fftr_fwd_cfg; /* forward real FFT config */ + float *w; /* [m_pitch] time domain hamming window */ + float W[FFT_ENC]; /* DFT of w[] */ + float *Pn; /* [2*n_samp] trapezoidal synthesis window */ + float *bpf_buf; /* buffer for band pass filter */ + float *Sn; /* [m_pitch] input speech */ + float hpf_states[2]; /* high pass filter states */ + void *nlp; /* pitch predictor states */ + int gray; /* non-zero for gray encoding */ + + codec2_fftr_cfg fftr_inv_cfg; /* inverse FFT config */ + float *Sn_; /* [2*n_samp] synthesised output speech */ + float ex_phase; /* excitation model phase track */ + float bg_est; /* background noise estimate for post filter */ + float prev_f0_enc; /* previous frame's f0 estimate */ + MODEL prev_model_dec; /* previous frame's model parameters */ + float prev_lsps_dec[LPC_ORD]; /* previous frame's LSPs */ + float prev_e_dec; /* previous frame's LPC energy */ + + int lpc_pf; /* LPC post filter on */ + int bass_boost; /* LPC post filter bass boost */ + float beta; /* LPC post filter parameters */ + float gamma; + + float xq_enc[2]; /* joint pitch and energy VQ states */ + float xq_dec[2]; + + int smoothing; /* enable smoothing for channels with errors */ + float *softdec; /* optional soft decn bits from demod */ + + /* newamp1 states */ + + float rate_K_sample_freqs_kHz[NEWAMP1_K]; + float prev_rate_K_vec_[NEWAMP1_K]; + float Wo_left; + int voicing_left; + codec2_fft_cfg phase_fft_fwd_cfg; + codec2_fft_cfg phase_fft_inv_cfg; + float se; /* running sum of squared error */ + unsigned int nse; /* number of terms in sum */ + float *user_rate_K_vec_no_mean_; /* optional, user supplied vector for + quantisation experiments */ + bool post_filter_en; + float eq[NEWAMP1_K]; /* optional equaliser */ + bool eq_en; + + /* used to dump features for deep learning experiments */ + FILE *fmlfeat, *fmlmodel; + + /* encode/decode function pointers for the selected mode */ + void (*encode)(struct CODEC2 *c2, unsigned char *bits, short speech[]); + void (*decode)(struct CODEC2 *c2, short speech[], const unsigned char *bits); + void (*decode_ber)(struct CODEC2 *c2, short speech[], + const unsigned char *bits, float ber_est); }; // test and debug void analyse_one_frame(struct CODEC2 *c2, MODEL *model, short speech[]); void synthesise_one_frame(struct CODEC2 *c2, short speech[], MODEL *model, - COMP Aw[], float gain); + COMP Aw[], float gain); #endif diff --git a/comp_prim.h b/comp_prim.h index d0f070a..e0166d3 100644 --- a/comp_prim.h +++ b/comp_prim.h @@ -28,114 +28,111 @@ #ifndef __COMP_PRIM__ #define __COMP_PRIM__ +#include + /*---------------------------------------------------------------------------*\ FUNCTIONS \*---------------------------------------------------------------------------*/ -inline static COMP cneg(COMP a) -{ - COMP res; +inline static COMP cneg(COMP a) { + COMP res; - res.real = -a.real; - res.imag = -a.imag; + res.real = -a.real; + res.imag = -a.imag; - return res; + return res; } -inline static COMP cconj(COMP a) -{ - COMP res; +inline static COMP cconj(COMP a) { + COMP res; - res.real = a.real; - res.imag = -a.imag; + res.real = a.real; + res.imag = -a.imag; - return res; + return res; } -inline static COMP cmult(COMP a, COMP b) -{ - COMP res; +inline static COMP cmult(COMP a, COMP b) { + COMP res; - res.real = a.real*b.real - a.imag*b.imag; - res.imag = a.real*b.imag + a.imag*b.real; + res.real = a.real * b.real - a.imag * b.imag; + res.imag = a.real * b.imag + a.imag * b.real; - return res; + return res; } -inline static COMP fcmult(float a, COMP b) -{ - COMP res; +inline static COMP fcmult(float a, COMP b) { + COMP res; - res.real = a*b.real; - res.imag = a*b.imag; + res.real = a * b.real; + res.imag = a * b.imag; - return res; + return res; } -inline static COMP cadd(COMP a, COMP b) -{ - COMP res; +inline static COMP cadd(COMP a, COMP b) { + COMP res; - res.real = a.real + b.real; - res.imag = a.imag + b.imag; + res.real = a.real + b.real; + res.imag = a.imag + b.imag; - return res; + return res; } -inline static float cabsolute(COMP a) -{ - return sqrtf((a.real * a.real) + (a.imag * a.imag) ); +inline static float cabsolute(COMP a) { + return sqrtf((a.real * a.real) + (a.imag * a.imag)); } /* * Euler's formula in a new convenient function */ -inline static COMP comp_exp_j(float phi){ - COMP res; - res.real = cosf(phi); - res.imag = sinf(phi); - return res; +inline static COMP comp_exp_j(float phi) { + COMP res; + res.real = cosf(phi); + res.imag = sinf(phi); + return res; } /* * Quick and easy complex 0 */ -inline static COMP comp0(){ - COMP res; - res.real = 0; - res.imag = 0; - return res; +inline static COMP comp0() { + COMP res; + res.real = 0; + res.imag = 0; + return res; } /* * Quick and easy complex subtract */ -inline static COMP csub(COMP a, COMP b){ - COMP res; - res.real = a.real-b.real; - res.imag = a.imag-b.imag; - return res; +inline static COMP csub(COMP a, COMP b) { + COMP res; + res.real = a.real - b.real; + res.imag = a.imag - b.imag; + return res; } /* * Compare the magnitude of a and b. if |a|>|b|, return true, otw false. * This needs no square roots */ -inline static int comp_mag_gt(COMP a,COMP b){ - return ((a.real*a.real)+(a.imag*a.imag)) > ((b.real*b.real)+(b.imag*b.imag)); +inline static int comp_mag_gt(COMP a, COMP b) { + return ((a.real * a.real) + (a.imag * a.imag)) > + ((b.real * b.real) + (b.imag * b.imag)); } /* * Normalize a complex number's magnitude to 1 */ -inline static COMP comp_normalize(COMP a){ - COMP b; - float av = cabsolute(a); - b.real = a.real/av; - b.imag = a.imag/av; - return b; +inline static COMP comp_normalize(COMP a) { + COMP b; + float av = cabsolute(a); + b.real = a.real / av; + b.imag = a.imag / av; + return b; } #endif diff --git a/defines.h b/defines.h index dcd1841..a2fd9ec 100644 --- a/defines.h +++ b/defines.h @@ -30,96 +30,93 @@ /*---------------------------------------------------------------------------*\ - DEFINES + DEFINES \*---------------------------------------------------------------------------*/ /* General defines */ -#define N_S 0.01 /* internal proc frame length in secs */ -#define TW_S 0.005 /* trapezoidal synth window overlap */ -#define MAX_AMP 160 /* maximum number of harmonics */ +#define N_S 0.01 /* internal proc frame length in secs */ +#define TW_S 0.005 /* trapezoidal synth window overlap */ +#define MAX_AMP 160 /* maximum number of harmonics */ #ifndef PI -#define PI 3.141592654 /* mathematical constant */ +#define PI 3.141592654 /* mathematical constant */ #endif -#define TWO_PI 6.283185307 /* mathematical constant */ -#define MAX_STR 2048 /* maximum string size */ +#ifndef M_PI +#define M_PI 3.14159265358979323846f +#endif +#define TWO_PI 6.283185307 /* mathematical constant */ +#define MAX_STR 2048 /* maximum string size */ -#define FFT_ENC 512 /* size of FFT used for encoder */ -#define FFT_DEC 512 /* size of FFT used in decoder */ -#define V_THRESH 6.0 /* voicing threshold in dB */ -#define LPC_ORD 10 /* LPC order */ -#define LPC_ORD_LOW 6 /* LPC order for lower rates */ +#define FFT_ENC 512 /* size of FFT used for encoder */ +#define FFT_DEC 512 /* size of FFT used in decoder */ +#define V_THRESH 6.0 /* voicing threshold in dB */ +#define LPC_ORD 10 /* LPC order */ +#define LPC_ORD_LOW 6 /* LPC order for lower rates */ /* Pitch estimation defines */ -#define M_PITCH_S 0.0400 /* pitch analysis window in s */ -#define P_MIN_S 0.0025 /* minimum pitch period in s */ -#define P_MAX_S 0.0200 /* maximum pitch period in s */ +#define M_PITCH_S 0.0400 /* pitch analysis window in s */ +#define P_MIN_S 0.0025 /* minimum pitch period in s */ +#define P_MAX_S 0.0200 /* maximum pitch period in s */ /*---------------------------------------------------------------------------*\ - TYPEDEFS + TYPEDEFS \*---------------------------------------------------------------------------*/ /* Structure to hold constants calculated at run time based on sample rate */ typedef struct { - int Fs; /* sample rate of this instance */ - int n_samp; /* number of samples per 10ms frame at Fs */ - int max_amp; /* maximum number of harmonics */ - int m_pitch; /* pitch estimation window size in samples */ - int p_min; /* minimum pitch period in samples */ - int p_max; /* maximum pitch period in samples */ - float Wo_min; - float Wo_max; - int nw; /* analysis window size in samples */ - int tw; /* trapezoidal synthesis window overlap */ + int Fs; /* sample rate of this instance */ + int n_samp; /* number of samples per 10ms frame at Fs */ + int max_amp; /* maximum number of harmonics */ + int m_pitch; /* pitch estimation window size in samples */ + int p_min; /* minimum pitch period in samples */ + int p_max; /* maximum pitch period in samples */ + float Wo_min; + float Wo_max; + int nw; /* analysis window size in samples */ + int tw; /* trapezoidal synthesis window overlap */ } C2CONST; /* Structure to hold model parameters for one frame */ typedef struct { - float Wo; /* fundamental frequency estimate in radians */ - int L; /* number of harmonics */ - float A[MAX_AMP+1]; /* amplitiude of each harmonic */ - float phi[MAX_AMP+1]; /* phase of each harmonic */ - int voiced; /* non-zero if this frame is voiced */ + float Wo; /* fundamental frequency estimate in radians */ + int L; /* number of harmonics */ + float A[MAX_AMP + 1]; /* amplitiude of each harmonic */ + float phi[MAX_AMP + 1]; /* phase of each harmonic */ + int voiced; /* non-zero if this frame is voiced */ } MODEL; /* describes each codebook */ struct lsp_codebook { - int k; /* dimension of vector */ - int log2m; /* number of bits in m */ - int m; /* elements in codebook */ -#ifdef __EMBEDDED /* make sure stored in flash */ - const float *cb; /* The elements */ + int k; /* dimension of vector */ + int log2m; /* number of bits in m */ + int m; /* elements in codebook */ +#ifdef __EMBEDDED__ /* make sure stored in flash */ + const float *cb; /* The elements */ #else - float *cb; /* The elements */ + float *cb; /* The elements */ #endif }; extern const struct lsp_codebook lsp_cb[]; extern const struct lsp_codebook lsp_cbd[]; -extern const struct lsp_codebook lsp_cbvq[]; -extern const struct lsp_codebook lsp_cbjnd[]; -extern const struct lsp_codebook lsp_cbdt[]; -extern const struct lsp_codebook lsp_cbjvm[]; -extern const struct lsp_codebook lsp_cbvqanssi[]; -extern const struct lsp_codebook mel_cb[]; +extern const struct lsp_codebook lsp_cbjmv[]; extern const struct lsp_codebook ge_cb[]; -extern const struct lsp_codebook lspmelvq_cb[]; extern const struct lsp_codebook newamp1vq_cb[]; extern const struct lsp_codebook newamp1_energy_cb[]; extern const struct lsp_codebook newamp2vq_cb[]; extern const struct lsp_codebook newamp2_energy_cb[]; #ifdef _GNU_SOURCE - #define POW10F(x) exp10f((x)) +#define POW10F(x) exp10f((x)) #else - #define POW10F(x) expf(2.302585092994046f*(x)) +#define POW10F(x) expf(2.302585092994046f * (x)) #endif #endif diff --git a/interp.c b/interp.c index 2109acb..08a9518 100644 --- a/interp.c +++ b/interp.c @@ -25,13 +25,14 @@ along with this program; if not, see . */ +#include "interp.h" + #include #include -#include #include +#include #include "defines.h" -#include "interp.h" #include "lsp.h" #include "quantise.h" @@ -44,7 +45,7 @@ float sample_log_amp(MODEL *model, float w); AUTHOR......: David Rowe DATE CREATED: 22/8/10 - Given two frames decribed by model parameters 20ms apart, determines + Given two frames described by model parameters 20ms apart, determines the model parameters of the 10ms frame between them. Assumes voicing is available for middle (interpolated) frame. Outputs are amplitudes and Wo for the interpolated frame. @@ -107,29 +108,27 @@ void interpolate( \*---------------------------------------------------------------------------*/ -float sample_log_amp(MODEL *model, float w) -{ - int m; - float f, log_amp; +float sample_log_amp(MODEL *model, float w) { + int m; + float f, log_amp; - assert(w > 0.0); assert (w <= PI); + assert(w > 0.0); + assert(w <= PI); - m = floorf(w/model->Wo + 0.5); - f = (w - m*model->Wo)/w; - assert(f <= 1.0); + m = floorf(w / model->Wo + 0.5); + f = (w - m * model->Wo) / w; + assert(f <= 1.0); - if (m < 1) { - log_amp = f*log10f(model->A[1] + 1E-6); - } - else if ((m+1) > model->L) { - log_amp = (1.0-f)*log10f(model->A[model->L] + 1E-6); - } - else { - log_amp = (1.0-f)*log10f(model->A[m] + 1E-6) + - f*log10f(model->A[m+1] + 1E-6); - } + if (m < 1) { + log_amp = f * log10f(model->A[1] + 1E-6); + } else if ((m + 1) > model->L) { + log_amp = (1.0 - f) * log10f(model->A[model->L] + 1E-6); + } else { + log_amp = (1.0 - f) * log10f(model->A[m] + 1E-6) + + f * log10f(model->A[m + 1] + 1E-6); + } - return log_amp; + return log_amp; } #ifdef NOT_NEEDED @@ -140,7 +139,7 @@ float sample_log_amp(MODEL *model, float w) AUTHOR......: David Rowe DATE CREATED: 10 Nov 2010 - Given two frames decribed by model parameters 20ms apart, determines + Given two frames described by model parameters 20ms apart, determines the model parameters of the 10ms frame between them. Assumes voicing is available for middle (interpolated) frame. Outputs are amplitudes and Wo for the interpolated frame. @@ -150,65 +149,59 @@ float sample_log_amp(MODEL *model, float w) \*---------------------------------------------------------------------------*/ -void interpolate_lsp( - codec2_fft_cfg fft_fwd_cfg, - MODEL *interp, /* interpolated model params */ - MODEL *prev, /* previous frames model params */ - MODEL *next, /* next frames model params */ - float *prev_lsps, /* previous frames LSPs */ - float prev_e, /* previous frames LPC energy */ - float *next_lsps, /* next frames LSPs */ - float next_e, /* next frames LPC energy */ - float *ak_interp, /* interpolated aks for this frame */ - float *lsps_interp, /* interpolated lsps for this frame */ - float Wo_min -) -{ - int i; - float e; - float snr; - - /* trap corner case where V est is probably wrong */ - - if (interp->voiced && !prev->voiced && !next->voiced) { - interp->voiced = 0; - } - - /* Wo depends on voicing of this and adjacent frames */ - - if (interp->voiced) { - if (prev->voiced && next->voiced) - interp->Wo = (prev->Wo + next->Wo)/2.0; - if (!prev->voiced && next->voiced) - interp->Wo = next->Wo; - if (prev->voiced && !next->voiced) - interp->Wo = prev->Wo; - } - else { - interp->Wo = Wo_min; - } - interp->L = PI/interp->Wo; - - //printf(" interp: prev_v: %d next_v: %d prev_Wo: %f next_Wo: %f\n", - // prev->voiced, next->voiced, prev->Wo, next->Wo); - //printf(" interp: Wo: %1.5f L: %d\n", interp->Wo, interp->L); - - /* interpolate LSPs */ - - for(i=0; iA[1]); +void interpolate_lsp(codec2_fft_cfg fft_fwd_cfg, + MODEL *interp, /* interpolated model params */ + MODEL *prev, /* previous frames model params */ + MODEL *next, /* next frames model params */ + float *prev_lsps, /* previous frames LSPs */ + float prev_e, /* previous frames LPC energy */ + float *next_lsps, /* next frames LSPs */ + float next_e, /* next frames LPC energy */ + float *ak_interp, /* interpolated aks for this frame */ + float *lsps_interp, /* interpolated lsps for this frame */ + float Wo_min) { + int i; + float e; + float snr; + + /* trap corner case where V est is probably wrong */ + + if (interp->voiced && !prev->voiced && !next->voiced) { + interp->voiced = 0; + } + + /* Wo depends on voicing of this and adjacent frames */ + + if (interp->voiced) { + if (prev->voiced && next->voiced) interp->Wo = (prev->Wo + next->Wo) / 2.0; + if (!prev->voiced && next->voiced) interp->Wo = next->Wo; + if (prev->voiced && !next->voiced) interp->Wo = prev->Wo; + } else { + interp->Wo = Wo_min; + } + interp->L = PI / interp->Wo; + + // printf(" interp: prev_v: %d next_v: %d prev_Wo: %f next_Wo: %f\n", + // prev->voiced, next->voiced, prev->Wo, next->Wo); + // printf(" interp: Wo: %1.5f L: %d\n", interp->Wo, interp->L); + + /* interpolate LSPs */ + + for (i = 0; i < LPC_ORD; i++) { + lsps_interp[i] = (prev_lsps[i] + next_lsps[i]) / 2.0; + } + + /* Interpolate LPC energy in log domain */ + + e = powf(10.0, (log10f(prev_e) + log10f(next_e)) / 2.0); + // printf(" interp: e: %f\n", e); + + /* convert back to amplitudes */ + + lsp_to_lpc(lsps_interp, ak_interp, LPC_ORD); + aks_to_M2(fft_fwd_cfg, ak_interp, LPC_ORD, interp, e, &snr, 0, 0, 1, 1, + LPCPF_BETA, LPCPF_GAMMA); + // printf(" interp: ak[1]: %f A[1] %f\n", ak_interp[1], interp->A[1]); } #endif @@ -224,14 +217,11 @@ void interpolate_lsp( \*---------------------------------------------------------------------------*/ -void interp_Wo( - MODEL *interp, /* interpolated model params */ - MODEL *prev, /* previous frames model params */ - MODEL *next, /* next frames model params */ - float Wo_min - ) -{ - interp_Wo2(interp, prev, next, 0.5, Wo_min); +void interp_Wo(MODEL *interp, /* interpolated model params */ + MODEL *prev, /* previous frames model params */ + MODEL *next, /* next frames model params */ + float Wo_min) { + interp_Wo2(interp, prev, next, 0.5, Wo_min); } /*---------------------------------------------------------------------------*\ @@ -244,37 +234,29 @@ void interp_Wo( \*---------------------------------------------------------------------------*/ -void interp_Wo2( - MODEL *interp, /* interpolated model params */ - MODEL *prev, /* previous frames model params */ - MODEL *next, /* next frames model params */ - float weight, - float Wo_min -) -{ - /* trap corner case where voicing est is probably wrong */ - - if (interp->voiced && !prev->voiced && !next->voiced) { - interp->voiced = 0; - } - - /* Wo depends on voicing of this and adjacent frames */ - - if (interp->voiced) { - if (prev->voiced && next->voiced) - interp->Wo = (1.0 - weight)*prev->Wo + weight*next->Wo; - if (!prev->voiced && next->voiced) - interp->Wo = next->Wo; - if (prev->voiced && !next->voiced) - interp->Wo = prev->Wo; - } - else { - interp->Wo = Wo_min; - } - interp->L = PI/interp->Wo; +void interp_Wo2(MODEL *interp, /* interpolated model params */ + MODEL *prev, /* previous frames model params */ + MODEL *next, /* next frames model params */ + float weight, float Wo_min) { + /* trap corner case where voicing est is probably wrong */ + + if (interp->voiced && !prev->voiced && !next->voiced) { + interp->voiced = 0; + } + + /* Wo depends on voicing of this and adjacent frames */ + + if (interp->voiced) { + if (prev->voiced && next->voiced) + interp->Wo = (1.0 - weight) * prev->Wo + weight * next->Wo; + if (!prev->voiced && next->voiced) interp->Wo = next->Wo; + if (prev->voiced && !next->voiced) interp->Wo = prev->Wo; + } else { + interp->Wo = Wo_min; + } + interp->L = PI / interp->Wo; } - /*---------------------------------------------------------------------------*\ FUNCTION....: interp_energy() @@ -286,13 +268,12 @@ void interp_Wo2( \*---------------------------------------------------------------------------*/ -float interp_energy(float prev_e, float next_e) -{ - //return powf(10.0, (log10f(prev_e) + log10f(next_e))/2.0); - return sqrtf(prev_e * next_e); //looks better is math. identical and faster math +float interp_energy(float prev_e, float next_e) { + // return powf(10.0, (log10f(prev_e) + log10f(next_e))/2.0); + return sqrtf(prev_e * + next_e); // looks better is math. identical and faster math } - /*---------------------------------------------------------------------------*\ FUNCTION....: interp_energy2() @@ -304,13 +285,10 @@ float interp_energy(float prev_e, float next_e) \*---------------------------------------------------------------------------*/ -float interp_energy2(float prev_e, float next_e, float weight) -{ - return POW10F((1.0 - weight)*log10f(prev_e) + weight*log10f(next_e)); - +float interp_energy2(float prev_e, float next_e, float weight) { + return POW10F((1.0 - weight) * log10f(prev_e) + weight * log10f(next_e)); } - /*---------------------------------------------------------------------------*\ FUNCTION....: interpolate_lsp_ver2() @@ -321,11 +299,10 @@ float interp_energy2(float prev_e, float next_e, float weight) \*---------------------------------------------------------------------------*/ -void interpolate_lsp_ver2(float interp[], float prev[], float next[], float weight, int order) -{ - int i; +void interpolate_lsp_ver2(float interp[], float prev[], float next[], + float weight, int order) { + int i; - for(i=0; itwiddles; - kiss_fft_cpx t; - Fout2 = Fout + m; - do{ - C_FIXDIV(*Fout,2); C_FIXDIV(*Fout2,2); - - C_MUL (t, *Fout2 , *tw1); - tw1 += fstride; - C_SUB( *Fout2 , *Fout , t ); - C_ADDTO( *Fout , t ); - ++Fout2; - ++Fout; - }while (--m); +static void kf_bfly2(kiss_fft_cpx *Fout, const size_t fstride, + const kiss_fft_cfg st, int m) { + kiss_fft_cpx *Fout2; + kiss_fft_cpx *tw1 = st->twiddles; + kiss_fft_cpx t; + Fout2 = Fout + m; + do { + C_FIXDIV(*Fout, 2); + C_FIXDIV(*Fout2, 2); + + C_MUL(t, *Fout2, *tw1); + tw1 += fstride; + C_SUB(*Fout2, *Fout, t); + C_ADDTO(*Fout, t); + ++Fout2; + ++Fout; + } while (--m); } -static void kf_bfly4( - kiss_fft_cpx * Fout, - const size_t fstride, - const kiss_fft_cfg st, - const size_t m - ) -{ - kiss_fft_cpx *tw1,*tw2,*tw3; - kiss_fft_cpx scratch[6]; - size_t k=m; - const size_t m2=2*m; - const size_t m3=3*m; - - - tw3 = tw2 = tw1 = st->twiddles; - - do { - C_FIXDIV(*Fout,4); C_FIXDIV(Fout[m],4); C_FIXDIV(Fout[m2],4); C_FIXDIV(Fout[m3],4); - - C_MUL(scratch[0],Fout[m] , *tw1 ); - C_MUL(scratch[1],Fout[m2] , *tw2 ); - C_MUL(scratch[2],Fout[m3] , *tw3 ); - - C_SUB( scratch[5] , *Fout, scratch[1] ); - C_ADDTO(*Fout, scratch[1]); - C_ADD( scratch[3] , scratch[0] , scratch[2] ); - C_SUB( scratch[4] , scratch[0] , scratch[2] ); - C_SUB( Fout[m2], *Fout, scratch[3] ); - tw1 += fstride; - tw2 += fstride*2; - tw3 += fstride*3; - C_ADDTO( *Fout , scratch[3] ); - - if(st->inverse) { - Fout[m].r = scratch[5].r - scratch[4].i; - Fout[m].i = scratch[5].i + scratch[4].r; - Fout[m3].r = scratch[5].r + scratch[4].i; - Fout[m3].i = scratch[5].i - scratch[4].r; - }else{ - Fout[m].r = scratch[5].r + scratch[4].i; - Fout[m].i = scratch[5].i - scratch[4].r; - Fout[m3].r = scratch[5].r - scratch[4].i; - Fout[m3].i = scratch[5].i + scratch[4].r; - } - ++Fout; - }while(--k); +static void kf_bfly4(kiss_fft_cpx *Fout, const size_t fstride, + const kiss_fft_cfg st, const size_t m) { + kiss_fft_cpx *tw1, *tw2, *tw3; + kiss_fft_cpx scratch[6]; + size_t k = m; + const size_t m2 = 2 * m; + const size_t m3 = 3 * m; + + tw3 = tw2 = tw1 = st->twiddles; + + do { + C_FIXDIV(*Fout, 4); + C_FIXDIV(Fout[m], 4); + C_FIXDIV(Fout[m2], 4); + C_FIXDIV(Fout[m3], 4); + + C_MUL(scratch[0], Fout[m], *tw1); + C_MUL(scratch[1], Fout[m2], *tw2); + C_MUL(scratch[2], Fout[m3], *tw3); + + C_SUB(scratch[5], *Fout, scratch[1]); + C_ADDTO(*Fout, scratch[1]); + C_ADD(scratch[3], scratch[0], scratch[2]); + C_SUB(scratch[4], scratch[0], scratch[2]); + C_SUB(Fout[m2], *Fout, scratch[3]); + tw1 += fstride; + tw2 += fstride * 2; + tw3 += fstride * 3; + C_ADDTO(*Fout, scratch[3]); + + if (st->inverse) { + Fout[m].r = scratch[5].r - scratch[4].i; + Fout[m].i = scratch[5].i + scratch[4].r; + Fout[m3].r = scratch[5].r + scratch[4].i; + Fout[m3].i = scratch[5].i - scratch[4].r; + } else { + Fout[m].r = scratch[5].r + scratch[4].i; + Fout[m].i = scratch[5].i - scratch[4].r; + Fout[m3].r = scratch[5].r - scratch[4].i; + Fout[m3].i = scratch[5].i + scratch[4].r; + } + ++Fout; + } while (--k); } -static void kf_bfly3( - kiss_fft_cpx * Fout, - const size_t fstride, - const kiss_fft_cfg st, - size_t m - ) -{ - size_t k=m; - const size_t m2 = 2*m; - kiss_fft_cpx *tw1,*tw2; - kiss_fft_cpx scratch[5]; - kiss_fft_cpx epi3; - epi3 = st->twiddles[fstride*m]; +static void kf_bfly3(kiss_fft_cpx *Fout, const size_t fstride, + const kiss_fft_cfg st, size_t m) { + size_t k = m; + const size_t m2 = 2 * m; + kiss_fft_cpx *tw1, *tw2; + kiss_fft_cpx scratch[5]; + kiss_fft_cpx epi3; + epi3 = st->twiddles[fstride * m]; - tw1=tw2=st->twiddles; + tw1 = tw2 = st->twiddles; - do{ - C_FIXDIV(*Fout,3); C_FIXDIV(Fout[m],3); C_FIXDIV(Fout[m2],3); + do { + C_FIXDIV(*Fout, 3); + C_FIXDIV(Fout[m], 3); + C_FIXDIV(Fout[m2], 3); - C_MUL(scratch[1],Fout[m] , *tw1); - C_MUL(scratch[2],Fout[m2] , *tw2); + C_MUL(scratch[1], Fout[m], *tw1); + C_MUL(scratch[2], Fout[m2], *tw2); - C_ADD(scratch[3],scratch[1],scratch[2]); - C_SUB(scratch[0],scratch[1],scratch[2]); - tw1 += fstride; - tw2 += fstride*2; + C_ADD(scratch[3], scratch[1], scratch[2]); + C_SUB(scratch[0], scratch[1], scratch[2]); + tw1 += fstride; + tw2 += fstride * 2; - Fout[m].r = Fout->r - HALF_OF(scratch[3].r); - Fout[m].i = Fout->i - HALF_OF(scratch[3].i); + Fout[m].r = Fout->r - HALF_OF(scratch[3].r); + Fout[m].i = Fout->i - HALF_OF(scratch[3].i); - C_MULBYSCALAR( scratch[0] , epi3.i ); + C_MULBYSCALAR(scratch[0], epi3.i); - C_ADDTO(*Fout,scratch[3]); + C_ADDTO(*Fout, scratch[3]); - Fout[m2].r = Fout[m].r + scratch[0].i; - Fout[m2].i = Fout[m].i - scratch[0].r; + Fout[m2].r = Fout[m].r + scratch[0].i; + Fout[m2].i = Fout[m].i - scratch[0].r; - Fout[m].r -= scratch[0].i; - Fout[m].i += scratch[0].r; + Fout[m].r -= scratch[0].i; + Fout[m].i += scratch[0].r; - ++Fout; - }while(--k); + ++Fout; + } while (--k); } -static void kf_bfly5( - kiss_fft_cpx * Fout, - const size_t fstride, - const kiss_fft_cfg st, - int m - ) -{ - kiss_fft_cpx *Fout0,*Fout1,*Fout2,*Fout3,*Fout4; - int u; - kiss_fft_cpx scratch[13]; - kiss_fft_cpx * twiddles = st->twiddles; - kiss_fft_cpx *tw; - kiss_fft_cpx ya,yb; - ya = twiddles[fstride*m]; - yb = twiddles[fstride*2*m]; - - Fout0=Fout; - Fout1=Fout0+m; - Fout2=Fout0+2*m; - Fout3=Fout0+3*m; - Fout4=Fout0+4*m; - - tw=st->twiddles; - for ( u=0; ur += scratch[7].r + scratch[8].r; - Fout0->i += scratch[7].i + scratch[8].i; - - scratch[5].r = scratch[0].r + S_MUL(scratch[7].r,ya.r) + S_MUL(scratch[8].r,yb.r); - scratch[5].i = scratch[0].i + S_MUL(scratch[7].i,ya.r) + S_MUL(scratch[8].i,yb.r); - - scratch[6].r = S_MUL(scratch[10].i,ya.i) + S_MUL(scratch[9].i,yb.i); - scratch[6].i = -S_MUL(scratch[10].r,ya.i) - S_MUL(scratch[9].r,yb.i); - - C_SUB(*Fout1,scratch[5],scratch[6]); - C_ADD(*Fout4,scratch[5],scratch[6]); - - scratch[11].r = scratch[0].r + S_MUL(scratch[7].r,yb.r) + S_MUL(scratch[8].r,ya.r); - scratch[11].i = scratch[0].i + S_MUL(scratch[7].i,yb.r) + S_MUL(scratch[8].i,ya.r); - scratch[12].r = - S_MUL(scratch[10].i,yb.i) + S_MUL(scratch[9].i,ya.i); - scratch[12].i = S_MUL(scratch[10].r,yb.i) - S_MUL(scratch[9].r,ya.i); - - C_ADD(*Fout2,scratch[11],scratch[12]); - C_SUB(*Fout3,scratch[11],scratch[12]); - - ++Fout0;++Fout1;++Fout2;++Fout3;++Fout4; - } +static void kf_bfly5(kiss_fft_cpx *Fout, const size_t fstride, + const kiss_fft_cfg st, int m) { + kiss_fft_cpx *Fout0, *Fout1, *Fout2, *Fout3, *Fout4; + int u; + kiss_fft_cpx scratch[13]; + kiss_fft_cpx *twiddles = st->twiddles; + kiss_fft_cpx *tw; + kiss_fft_cpx ya, yb; + ya = twiddles[fstride * m]; + yb = twiddles[fstride * 2 * m]; + + Fout0 = Fout; + Fout1 = Fout0 + m; + Fout2 = Fout0 + 2 * m; + Fout3 = Fout0 + 3 * m; + Fout4 = Fout0 + 4 * m; + + tw = st->twiddles; + for (u = 0; u < m; ++u) { + C_FIXDIV(*Fout0, 5); + C_FIXDIV(*Fout1, 5); + C_FIXDIV(*Fout2, 5); + C_FIXDIV(*Fout3, 5); + C_FIXDIV(*Fout4, 5); + scratch[0] = *Fout0; + + C_MUL(scratch[1], *Fout1, tw[u * fstride]); + C_MUL(scratch[2], *Fout2, tw[2 * u * fstride]); + C_MUL(scratch[3], *Fout3, tw[3 * u * fstride]); + C_MUL(scratch[4], *Fout4, tw[4 * u * fstride]); + + C_ADD(scratch[7], scratch[1], scratch[4]); + C_SUB(scratch[10], scratch[1], scratch[4]); + C_ADD(scratch[8], scratch[2], scratch[3]); + C_SUB(scratch[9], scratch[2], scratch[3]); + + Fout0->r += scratch[7].r + scratch[8].r; + Fout0->i += scratch[7].i + scratch[8].i; + + scratch[5].r = + scratch[0].r + S_MUL(scratch[7].r, ya.r) + S_MUL(scratch[8].r, yb.r); + scratch[5].i = + scratch[0].i + S_MUL(scratch[7].i, ya.r) + S_MUL(scratch[8].i, yb.r); + + scratch[6].r = S_MUL(scratch[10].i, ya.i) + S_MUL(scratch[9].i, yb.i); + scratch[6].i = -S_MUL(scratch[10].r, ya.i) - S_MUL(scratch[9].r, yb.i); + + C_SUB(*Fout1, scratch[5], scratch[6]); + C_ADD(*Fout4, scratch[5], scratch[6]); + + scratch[11].r = + scratch[0].r + S_MUL(scratch[7].r, yb.r) + S_MUL(scratch[8].r, ya.r); + scratch[11].i = + scratch[0].i + S_MUL(scratch[7].i, yb.r) + S_MUL(scratch[8].i, ya.r); + scratch[12].r = -S_MUL(scratch[10].i, yb.i) + S_MUL(scratch[9].i, ya.i); + scratch[12].i = S_MUL(scratch[10].r, yb.i) - S_MUL(scratch[9].r, ya.i); + + C_ADD(*Fout2, scratch[11], scratch[12]); + C_SUB(*Fout3, scratch[11], scratch[12]); + + ++Fout0; + ++Fout1; + ++Fout2; + ++Fout3; + ++Fout4; + } } /* perform the butterfly for one stage of a mixed radix FFT */ -static void kf_bfly_generic( - kiss_fft_cpx * Fout, - const size_t fstride, - const kiss_fft_cfg st, - int m, - int p - ) -{ - int u,k,q1,q; - kiss_fft_cpx * twiddles = st->twiddles; - kiss_fft_cpx t; - int Norig = st->nfft; - - kiss_fft_cpx * scratch = (kiss_fft_cpx*)KISS_FFT_TMP_ALLOC(sizeof(kiss_fft_cpx)*p); - - for ( u=0; u=Norig) twidx-=Norig; - C_MUL(t,scratch[q] , twiddles[twidx] ); - C_ADDTO( Fout[ k ] ,t); - } - k += m; - } +static void kf_bfly_generic(kiss_fft_cpx *Fout, const size_t fstride, + const kiss_fft_cfg st, int m, int p) { + int u, k, q1, q; + kiss_fft_cpx *twiddles = st->twiddles; + kiss_fft_cpx t; + int Norig = st->nfft; + + kiss_fft_cpx *scratch = + (kiss_fft_cpx *)KISS_FFT_TMP_ALLOC(sizeof(kiss_fft_cpx) * p); + + for (u = 0; u < m; ++u) { + k = u; + for (q1 = 0; q1 < p; ++q1) { + scratch[q1] = Fout[k]; + C_FIXDIV(scratch[q1], p); + k += m; } - KISS_FFT_TMP_FREE(scratch); -} - -static -void kf_work( - kiss_fft_cpx * Fout, - const kiss_fft_cpx * f, - const size_t fstride, - int in_stride, - int * factors, - const kiss_fft_cfg st - ) -{ - kiss_fft_cpx * Fout_beg=Fout; - const int p=*factors++; /* the radix */ - const int m=*factors++; /* stage's fft length/p */ - const kiss_fft_cpx * Fout_end = Fout + p*m; -#ifdef _OPENMP - // use openmp extensions at the - // top-level (not recursive) - if (fstride==1 && p<=5) - { - int k; - - // execute the p different work units in different threads -# pragma omp parallel for - for (k=0;k= Norig) twidx -= Norig; + C_MUL(t, scratch[q], twiddles[twidx]); + C_ADDTO(Fout[k], t); + } + k += m; } -#endif + } + KISS_FFT_TMP_FREE(scratch); +} - if (m==1) { - do{ - *Fout = *f; - f += fstride*in_stride; - }while(++Fout != Fout_end ); - }else{ - do{ - // recursive call: - // DFT of size m*p performed by doing - // p instances of smaller DFTs of size m, - // each one takes a decimated version of the input - kf_work( Fout , f, fstride*p, in_stride, factors,st); - f += fstride*in_stride; - }while( (Fout += m) != Fout_end ); - } +static void kf_work(kiss_fft_cpx *Fout, const kiss_fft_cpx *f, + const size_t fstride, int in_stride, int *factors, + const kiss_fft_cfg st) { + kiss_fft_cpx *Fout_beg = Fout; + const int p = *factors++; /* the radix */ + const int m = *factors++; /* stage's fft length/p */ + const kiss_fft_cpx *Fout_end = Fout + p * m; - Fout=Fout_beg; +#ifdef _OPENMP + // use openmp extensions at the + // top-level (not recursive) + if (fstride == 1 && p <= 5) { + int k; + + // execute the p different work units in different threads +#pragma omp parallel for + for (k = 0; k < p; ++k) + kf_work(Fout + k * m, f + fstride * in_stride * k, fstride * p, in_stride, + factors, st); + // all threads have joined by this point - // recombine the p smaller DFTs switch (p) { - case 2: kf_bfly2(Fout,fstride,st,m); break; - case 3: kf_bfly3(Fout,fstride,st,m); break; - case 4: kf_bfly4(Fout,fstride,st,m); break; - case 5: kf_bfly5(Fout,fstride,st,m); break; - default: kf_bfly_generic(Fout,fstride,st,m,p); break; + case 2: + kf_bfly2(Fout, fstride, st, m); + break; + case 3: + kf_bfly3(Fout, fstride, st, m); + break; + case 4: + kf_bfly4(Fout, fstride, st, m); + break; + case 5: + kf_bfly5(Fout, fstride, st, m); + break; + default: + kf_bfly_generic(Fout, fstride, st, m, p); + break; } + return; + } +#endif + + if (m == 1) { + do { + *Fout = *f; + f += fstride * in_stride; + } while (++Fout != Fout_end); + } else { + do { + // recursive call: + // DFT of size m*p performed by doing + // p instances of smaller DFTs of size m, + // each one takes a decimated version of the input + kf_work(Fout, f, fstride * p, in_stride, factors, st); + f += fstride * in_stride; + } while ((Fout += m) != Fout_end); + } + + Fout = Fout_beg; + + // recombine the p smaller DFTs + switch (p) { + case 2: + kf_bfly2(Fout, fstride, st, m); + break; + case 3: + kf_bfly3(Fout, fstride, st, m); + break; + case 4: + kf_bfly4(Fout, fstride, st, m); + break; + case 5: + kf_bfly5(Fout, fstride, st, m); + break; + default: + kf_bfly_generic(Fout, fstride, st, m, p); + break; + } } /* facbuf is populated by p1,m1,p2,m2, ... where p[i] * m[i] = m[i-1] m0 = n */ -static -void kf_factor(int n,int * facbuf) -{ - int p=4; - double floor_sqrt; - floor_sqrt = floorf( sqrtf((double)n) ); - - /*factor out powers of 4, powers of 2, then any remaining primes */ - do { - while (n % p) { - switch (p) { - case 4: p = 2; break; - case 2: p = 3; break; - default: p += 2; break; - } - if (p > floor_sqrt) - p = n; /* no more factors, skip to end */ - } - n /= p; - *facbuf++ = p; - *facbuf++ = n; - } while (n > 1); +static void kf_factor(int n, int *facbuf) { + int p = 4; + double floor_sqrt; + floor_sqrt = floorf(sqrtf((double)n)); + + /*factor out powers of 4, powers of 2, then any remaining primes */ + do { + while (n % p) { + switch (p) { + case 4: + p = 2; + break; + case 2: + p = 3; + break; + default: + p += 2; + break; + } + if (p > floor_sqrt) p = n; /* no more factors, skip to end */ + } + n /= p; + *facbuf++ = p; + *facbuf++ = n; + } while (n > 1); } /* * * User-callable function to allocate all necessary storage space for the fft. * - * The return value is a contiguous block of memory, allocated with malloc. As such, - * It can be freed with free(), rather than a kiss_fft-specific function. + * The return value is a contiguous block of memory, allocated with malloc. As + * such, It can be freed with free(), rather than a kiss_fft-specific function. * */ -kiss_fft_cfg kiss_fft_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem ) -{ - kiss_fft_cfg st=NULL; - size_t memneeded = sizeof(struct kiss_fft_state) - + sizeof(kiss_fft_cpx)*(nfft-1); /* twiddle factors*/ - - if ( lenmem==NULL ) { - st = ( kiss_fft_cfg)KISS_FFT_MALLOC( memneeded ); - }else{ - if (mem != NULL && *lenmem >= memneeded) - st = (kiss_fft_cfg)mem; - *lenmem = memneeded; - } - if (st) { - int i; - st->nfft=nfft; - st->inverse = inverse_fft; - - for (i=0;iinverse) - phase *= -1; - kf_cexp(st->twiddles+i, phase ); - } - - kf_factor(nfft,st->factors); +kiss_fft_cfg kiss_fft_alloc(int nfft, int inverse_fft, void *mem, + size_t *lenmem) { + kiss_fft_cfg st = NULL; + size_t memneeded = sizeof(struct kiss_fft_state) + + sizeof(kiss_fft_cpx) * (nfft - 1); /* twiddle factors*/ + + if (lenmem == NULL) { + st = (kiss_fft_cfg)KISS_FFT_MALLOC(memneeded); + } else { + if (mem != NULL && *lenmem >= memneeded) st = (kiss_fft_cfg)mem; + *lenmem = memneeded; + } + if (st) { + int i; + st->nfft = nfft; + st->inverse = inverse_fft; + + for (i = 0; i < nfft; ++i) { + const double pi = + 3.141592653589793238462643383279502884197169399375105820974944; + double phase = -2 * pi * i / nfft; + if (st->inverse) phase *= -1; + kf_cexp(st->twiddles + i, phase); } - return st; -} - -void kiss_fft_stride(kiss_fft_cfg st,const kiss_fft_cpx *fin,kiss_fft_cpx *fout,int in_stride) -{ - if (fin == fout) { - //NOTE: this is not really an in-place FFT algorithm. - //It just performs an out-of-place FFT into a temp buffer - kiss_fft_cpx * tmpbuf = (kiss_fft_cpx*)KISS_FFT_TMP_ALLOC( sizeof(kiss_fft_cpx)*st->nfft); - kf_work(tmpbuf,fin,1,in_stride, st->factors,st); - memcpy(fout,tmpbuf,sizeof(kiss_fft_cpx)*st->nfft); - KISS_FFT_TMP_FREE(tmpbuf); - }else{ - kf_work( fout, fin, 1,in_stride, st->factors,st ); - } + kf_factor(nfft, st->factors); + } + return st; } -void kiss_fft(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout) -{ - kiss_fft_stride(cfg,fin,fout,1); +void kiss_fft_stride(kiss_fft_cfg st, const kiss_fft_cpx *fin, + kiss_fft_cpx *fout, int in_stride) { + if (fin == fout) { + // NOTE: this is not really an in-place FFT algorithm. + // It just performs an out-of-place FFT into a temp buffer + kiss_fft_cpx *tmpbuf = + (kiss_fft_cpx *)KISS_FFT_TMP_ALLOC(sizeof(kiss_fft_cpx) * st->nfft); + kf_work(tmpbuf, fin, 1, in_stride, st->factors, st); + memcpy(fout, tmpbuf, sizeof(kiss_fft_cpx) * st->nfft); + KISS_FFT_TMP_FREE(tmpbuf); + } else { + kf_work(fout, fin, 1, in_stride, st->factors, st); + } } +void kiss_fft(kiss_fft_cfg cfg, const kiss_fft_cpx *fin, kiss_fft_cpx *fout) { + kiss_fft_stride(cfg, fin, fout, 1); +} -void kiss_fft_cleanup(void) -{ - // nothing needed any more +void kiss_fft_cleanup(void) { + // nothing needed any more } -int kiss_fft_next_fast_size(int n) -{ - while(1) { - int m=n; - while ( (m%2) == 0 ) m/=2; - while ( (m%3) == 0 ) m/=3; - while ( (m%5) == 0 ) m/=5; - if (m<=1) - break; /* n is completely factorable by twos, threes, and fives */ - n++; - } - return n; +int kiss_fft_next_fast_size(int n) { + while (1) { + int m = n; + while ((m % 2) == 0) m /= 2; + while ((m % 3) == 0) m /= 3; + while ((m % 5) == 0) m /= 5; + if (m <= 1) + break; /* n is completely factorable by twos, threes, and fives */ + n++; + } + return n; } diff --git a/kiss_fft.h b/kiss_fft.h index c01722c..ea1349e 100644 --- a/kiss_fft.h +++ b/kiss_fft.h @@ -1,9 +1,9 @@ #ifndef KISS_FFT_H #define KISS_FFT_H -#include -#include #include +#include +#include #include #ifdef __cplusplus @@ -24,36 +24,35 @@ extern "C" { */ #ifdef USE_SIMD -# include -# define kiss_fft_scalar __m128 -#define KISS_FFT_MALLOC(nbytes) _mm_malloc(nbytes,16) +#include +#define kiss_fft_scalar __m128 +#define KISS_FFT_MALLOC(nbytes) _mm_malloc(nbytes, 16) #define KISS_FFT_FREE _mm_free #else #define KISS_FFT_MALLOC malloc #define KISS_FFT_FREE free #endif - #ifdef FIXED_POINT #include -# if (FIXED_POINT == 32) -# define kiss_fft_scalar int32_t -# else -# define kiss_fft_scalar int16_t -# endif +#if (FIXED_POINT == 32) +#define kiss_fft_scalar int32_t #else -# ifndef kiss_fft_scalar +#define kiss_fft_scalar int16_t +#endif +#else +#ifndef kiss_fft_scalar /* default is float */ -# define kiss_fft_scalar float -# endif +#define kiss_fft_scalar float +#endif #endif typedef struct { - kiss_fft_scalar r; - kiss_fft_scalar i; -}kiss_fft_cpx; + kiss_fft_scalar r; + kiss_fft_scalar i; +} kiss_fft_cpx; -typedef struct kiss_fft_state* kiss_fft_cfg; +typedef struct kiss_fft_state *kiss_fft_cfg; /* * kiss_fft_alloc @@ -65,8 +64,8 @@ typedef struct kiss_fft_state* kiss_fft_cfg; * The return value from fft_alloc is a cfg buffer used internally * by the fft routine or NULL. * - * If lenmem is NULL, then kiss_fft_alloc will allocate a cfg buffer using malloc. - * The returned value should be free()d when done to avoid memory leaks. + * If lenmem is NULL, then kiss_fft_alloc will allocate a cfg buffer using + * malloc. The returned value should be free()d when done to avoid memory leaks. * * The state can be placed in a user supplied buffer 'mem': * If lenmem is not NULL and mem is not NULL and *lenmem is large enough, @@ -78,7 +77,8 @@ typedef struct kiss_fft_state* kiss_fft_cfg; * buffer size in *lenmem. * */ -kiss_fft_cfg kiss_fft_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem); +kiss_fft_cfg kiss_fft_alloc(int nfft, int inverse_fft, void *mem, + size_t *lenmem); /* * kiss_fft(cfg,in_out_buf) @@ -90,32 +90,34 @@ kiss_fft_cfg kiss_fft_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem) * Note that each element is complex and can be accessed like f[k].r and f[k].i * */ -void kiss_fft(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout); +void kiss_fft(kiss_fft_cfg cfg, const kiss_fft_cpx *fin, kiss_fft_cpx *fout); /* - A more generic version of the above function. It reads its input from every Nth sample. + A more generic version of the above function. It reads its input from every Nth + sample. * */ -void kiss_fft_stride(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout,int fin_stride); +void kiss_fft_stride(kiss_fft_cfg cfg, const kiss_fft_cpx *fin, + kiss_fft_cpx *fout, int fin_stride); /* If kiss_fft_alloc allocated a buffer, it is one contiguous buffer and can be simply free()d when no longer needed*/ #define kiss_fft_free free /* - Cleans up some memory that gets managed internally. Not necessary to call, but it might clean up - your compiler output to call this before you exit. + Cleans up some memory that gets managed internally. Not necessary to call, but + it might clean up your compiler output to call this before you exit. */ void kiss_fft_cleanup(void); - /* - * Returns the smallest integer k, such that k>=n and k has only "fast" factors (2,3,5) + * Returns the smallest integer k, such that k>=n and k has only "fast" factors + * (2,3,5) */ int kiss_fft_next_fast_size(int n); /* for real ffts, we need an even size */ #define kiss_fftr_next_fast_size_real(n) \ - (kiss_fft_next_fast_size( ((n)+1)>>1)<<1) + (kiss_fft_next_fast_size(((n) + 1) >> 1) << 1) #ifdef __cplusplus } diff --git a/kiss_fftr.c b/kiss_fftr.c index 7cc0286..e3aee37 100644 --- a/kiss_fftr.c +++ b/kiss_fftr.c @@ -3,152 +3,166 @@ Copyright (c) 2003-2004, Mark Borgerding All rights reserved. -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation and/or +other materials provided with the distribution. + * Neither the author nor the names of any contributors may be used to +endorse or promote products derived from this software without specific prior +written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "kiss_fftr.h" + #include "_kiss_fft_guts.h" #include "assert.h" -struct kiss_fftr_state{ - kiss_fft_cfg substate; - kiss_fft_cpx * tmpbuf; - kiss_fft_cpx * super_twiddles; +struct kiss_fftr_state { + kiss_fft_cfg substate; + kiss_fft_cpx *tmpbuf; + kiss_fft_cpx *super_twiddles; #ifdef USE_SIMD - void * pad; + void *pad; #endif }; -kiss_fftr_cfg kiss_fftr_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem) -{ - int i; - kiss_fftr_cfg st = NULL; - size_t subsize, memneeded; - - if (nfft & 1) { - fprintf(stderr,"Real FFT optimization must be even.\n"); - return NULL; - } - nfft >>= 1; - - kiss_fft_alloc (nfft, inverse_fft, NULL, &subsize); - memneeded = sizeof(struct kiss_fftr_state) + subsize + sizeof(kiss_fft_cpx) * ( nfft * 3 / 2); - - if (lenmem == NULL) { - st = (kiss_fftr_cfg) KISS_FFT_MALLOC (memneeded); - } else { - if (*lenmem >= memneeded) - st = (kiss_fftr_cfg) mem; - *lenmem = memneeded; - } - if (!st) - return NULL; - - st->substate = (kiss_fft_cfg) (st + 1); /*just beyond kiss_fftr_state struct */ - st->tmpbuf = (kiss_fft_cpx *) (((char *) st->substate) + subsize); - st->super_twiddles = st->tmpbuf + nfft; - kiss_fft_alloc(nfft, inverse_fft, st->substate, &subsize); - - for (i = 0; i < nfft/2; ++i) { - float phase = - -3.14159265358979323846264338327 * ((float) (i+1) / nfft + .5); - if (inverse_fft) - phase *= -1; - kf_cexp (st->super_twiddles+i,phase); - } - return st; +kiss_fftr_cfg kiss_fftr_alloc(int nfft, int inverse_fft, void *mem, + size_t *lenmem) { + int i; + kiss_fftr_cfg st = NULL; + size_t subsize, memneeded; + + if (nfft & 1) { + fprintf(stderr, "Real FFT optimization must be even.\n"); + return NULL; + } + nfft >>= 1; + + kiss_fft_alloc(nfft, inverse_fft, NULL, &subsize); + memneeded = sizeof(struct kiss_fftr_state) + subsize + + sizeof(kiss_fft_cpx) * (nfft * 3 / 2); + + if (lenmem == NULL) { + st = (kiss_fftr_cfg)KISS_FFT_MALLOC(memneeded); + } else { + if (*lenmem >= memneeded) st = (kiss_fftr_cfg)mem; + *lenmem = memneeded; + } + if (!st) return NULL; + + st->substate = (kiss_fft_cfg)(st + 1); /*just beyond kiss_fftr_state struct */ + st->tmpbuf = (kiss_fft_cpx *)(((char *)st->substate) + subsize); + st->super_twiddles = st->tmpbuf + nfft; + kiss_fft_alloc(nfft, inverse_fft, st->substate, &subsize); + + for (i = 0; i < nfft / 2; ++i) { + float phase = + -3.14159265358979323846264338327 * ((float)(i + 1) / nfft + .5); + if (inverse_fft) phase *= -1; + kf_cexp(st->super_twiddles + i, phase); + } + return st; } -void kiss_fftr(kiss_fftr_cfg st,const kiss_fft_scalar *timedata,kiss_fft_cpx *freqdata) -{ - /* input buffer timedata is stored row-wise */ - int k,ncfft; - kiss_fft_cpx fpnk,fpk,f1k,f2k,tw,tdc; - - assert(st->substate->inverse==0); - - ncfft = st->substate->nfft; - - /*perform the parallel fft of two real signals packed in real,imag*/ - kiss_fft( st->substate , (const kiss_fft_cpx*)timedata, st->tmpbuf ); - /* The real part of the DC element of the frequency spectrum in st->tmpbuf - * contains the sum of the even-numbered elements of the input time sequence - * The imag part is the sum of the odd-numbered elements - * - * The sum of tdc.r and tdc.i is the sum of the input time sequence. - * yielding DC of input time sequence - * The difference of tdc.r - tdc.i is the sum of the input (dot product) [1,-1,1,-1... - * yielding Nyquist bin of input time sequence - */ - - tdc.r = st->tmpbuf[0].r; - tdc.i = st->tmpbuf[0].i; - C_FIXDIV(tdc,2); - CHECK_OVERFLOW_OP(tdc.r ,+, tdc.i); - CHECK_OVERFLOW_OP(tdc.r ,-, tdc.i); - freqdata[0].r = tdc.r + tdc.i; - freqdata[ncfft].r = tdc.r - tdc.i; -#ifdef USE_SIMD - freqdata[ncfft].i = freqdata[0].i = _mm_set1_ps(0); +void kiss_fftr(kiss_fftr_cfg st, const kiss_fft_scalar *timedata, + kiss_fft_cpx *freqdata) { + /* input buffer timedata is stored row-wise */ + int k, ncfft; + kiss_fft_cpx fpnk, fpk, f1k, f2k, tw, tdc; + + assert(st->substate->inverse == 0); + + ncfft = st->substate->nfft; + + /*perform the parallel fft of two real signals packed in real,imag*/ + kiss_fft(st->substate, (const kiss_fft_cpx *)timedata, st->tmpbuf); + /* The real part of the DC element of the frequency spectrum in st->tmpbuf + * contains the sum of the even-numbered elements of the input time sequence + * The imag part is the sum of the odd-numbered elements + * + * The sum of tdc.r and tdc.i is the sum of the input time sequence. + * yielding DC of input time sequence + * The difference of tdc.r - tdc.i is the sum of the input (dot product) + * [1,-1,1,-1... yielding Nyquist bin of input time sequence + */ + + tdc.r = st->tmpbuf[0].r; + tdc.i = st->tmpbuf[0].i; + C_FIXDIV(tdc, 2); + CHECK_OVERFLOW_OP(tdc.r, +, tdc.i); + CHECK_OVERFLOW_OP(tdc.r, -, tdc.i); + freqdata[0].r = tdc.r + tdc.i; + freqdata[ncfft].r = tdc.r - tdc.i; +#ifdef USE_SIMD + freqdata[ncfft].i = freqdata[0].i = _mm_set1_ps(0); #else - freqdata[ncfft].i = freqdata[0].i = 0; + freqdata[ncfft].i = freqdata[0].i = 0; #endif - for ( k=1;k <= ncfft/2 ; ++k ) { - fpk = st->tmpbuf[k]; - fpnk.r = st->tmpbuf[ncfft-k].r; - fpnk.i = - st->tmpbuf[ncfft-k].i; - C_FIXDIV(fpk,2); - C_FIXDIV(fpnk,2); - - C_ADD( f1k, fpk , fpnk ); - C_SUB( f2k, fpk , fpnk ); - C_MUL( tw , f2k , st->super_twiddles[k-1]); - - freqdata[k].r = HALF_OF(f1k.r + tw.r); - freqdata[k].i = HALF_OF(f1k.i + tw.i); - freqdata[ncfft-k].r = HALF_OF(f1k.r - tw.r); - freqdata[ncfft-k].i = HALF_OF(tw.i - f1k.i); - } + for (k = 1; k <= ncfft / 2; ++k) { + fpk = st->tmpbuf[k]; + fpnk.r = st->tmpbuf[ncfft - k].r; + fpnk.i = -st->tmpbuf[ncfft - k].i; + C_FIXDIV(fpk, 2); + C_FIXDIV(fpnk, 2); + + C_ADD(f1k, fpk, fpnk); + C_SUB(f2k, fpk, fpnk); + C_MUL(tw, f2k, st->super_twiddles[k - 1]); + + freqdata[k].r = HALF_OF(f1k.r + tw.r); + freqdata[k].i = HALF_OF(f1k.i + tw.i); + freqdata[ncfft - k].r = HALF_OF(f1k.r - tw.r); + freqdata[ncfft - k].i = HALF_OF(tw.i - f1k.i); + } } -void kiss_fftri(kiss_fftr_cfg st,const kiss_fft_cpx *freqdata,kiss_fft_scalar *timedata) -{ - /* input buffer timedata is stored row-wise */ - int k, ncfft; - - assert(st->substate->inverse == 1); - - ncfft = st->substate->nfft; - - st->tmpbuf[0].r = freqdata[0].r + freqdata[ncfft].r; - st->tmpbuf[0].i = freqdata[0].r - freqdata[ncfft].r; - C_FIXDIV(st->tmpbuf[0],2); - - for (k = 1; k <= ncfft / 2; ++k) { - kiss_fft_cpx fk, fnkc, fek, fok, tmp; - fk = freqdata[k]; - fnkc.r = freqdata[ncfft - k].r; - fnkc.i = -freqdata[ncfft - k].i; - C_FIXDIV( fk , 2 ); - C_FIXDIV( fnkc , 2 ); - - C_ADD (fek, fk, fnkc); - C_SUB (tmp, fk, fnkc); - C_MUL (fok, tmp, st->super_twiddles[k-1]); - C_ADD (st->tmpbuf[k], fek, fok); - C_SUB (st->tmpbuf[ncfft - k], fek, fok); -#ifdef USE_SIMD - st->tmpbuf[ncfft - k].i *= _mm_set1_ps(-1.0); +void kiss_fftri(kiss_fftr_cfg st, const kiss_fft_cpx *freqdata, + kiss_fft_scalar *timedata) { + /* input buffer timedata is stored row-wise */ + int k, ncfft; + + assert(st->substate->inverse == 1); + + ncfft = st->substate->nfft; + + st->tmpbuf[0].r = freqdata[0].r + freqdata[ncfft].r; + st->tmpbuf[0].i = freqdata[0].r - freqdata[ncfft].r; + C_FIXDIV(st->tmpbuf[0], 2); + + for (k = 1; k <= ncfft / 2; ++k) { + kiss_fft_cpx fk, fnkc, fek, fok, tmp; + fk = freqdata[k]; + fnkc.r = freqdata[ncfft - k].r; + fnkc.i = -freqdata[ncfft - k].i; + C_FIXDIV(fk, 2); + C_FIXDIV(fnkc, 2); + + C_ADD(fek, fk, fnkc); + C_SUB(tmp, fk, fnkc); + C_MUL(fok, tmp, st->super_twiddles[k - 1]); + C_ADD(st->tmpbuf[k], fek, fok); + C_SUB(st->tmpbuf[ncfft - k], fek, fok); +#ifdef USE_SIMD + st->tmpbuf[ncfft - k].i *= _mm_set1_ps(-1.0); #else - st->tmpbuf[ncfft - k].i *= -1; + st->tmpbuf[ncfft - k].i *= -1; #endif - } - kiss_fft (st->substate, st->tmpbuf, (kiss_fft_cpx *) timedata); + } + kiss_fft(st->substate, st->tmpbuf, (kiss_fft_cpx *)timedata); } diff --git a/kiss_fftr.h b/kiss_fftr.h index 72e5a57..4ab52db 100644 --- a/kiss_fftr.h +++ b/kiss_fftr.h @@ -6,33 +6,34 @@ extern "C" { #endif - -/* - - Real optimized version can save about 45% cpu time vs. complex fft of a real seq. +/* + + Real optimized version can save about 45% cpu time vs. complex fft of a real + seq. + + - - */ typedef struct kiss_fftr_state *kiss_fftr_cfg; - -kiss_fftr_cfg kiss_fftr_alloc(int nfft,int inverse_fft,void * mem, size_t * lenmem); +kiss_fftr_cfg kiss_fftr_alloc(int nfft, int inverse_fft, void *mem, + size_t *lenmem); /* nfft must be even - If you don't care to allocate space, use mem = lenmem = NULL + If you don't care to allocate space, use mem = lenmem = NULL */ - -void kiss_fftr(kiss_fftr_cfg cfg,const kiss_fft_scalar *timedata,kiss_fft_cpx *freqdata); +void kiss_fftr(kiss_fftr_cfg cfg, const kiss_fft_scalar *timedata, + kiss_fft_cpx *freqdata); /* input timedata has nfft scalar points output freqdata has nfft/2+1 complex points */ -void kiss_fftri(kiss_fftr_cfg cfg,const kiss_fft_cpx *freqdata,kiss_fft_scalar *timedata); +void kiss_fftri(kiss_fftr_cfg cfg, const kiss_fft_cpx *freqdata, + kiss_fft_scalar *timedata); /* input freqdata has nfft/2+1 complex points output timedata has nfft scalar points diff --git a/lpc.c b/lpc.c index 31442cd..3117a1a 100644 --- a/lpc.c +++ b/lpc.c @@ -25,16 +25,18 @@ along with this program; if not, see . */ -#define LPC_MAX_N 512 /* maximum no. of samples in frame */ -#define PI 3.141592654 /* mathematical constant */ +#define LPC_MAX_N 512 /* maximum no. of samples in frame */ +#define PI 3.141592654 /* mathematical constant */ #define ALPHA 1.0 -#define BETA 0.94 +#define BETA 0.94 + +#include "lpc.h" #include #include + #include "defines.h" -#include "lpc.h" /*---------------------------------------------------------------------------*\ @@ -42,29 +44,25 @@ Pre-emphasise (high pass filter with zero close to 0 Hz) a frame of speech samples. Helps reduce dynamic range of LPC spectrum, giving - greater weight and hense a better match to low energy formants. + greater weight and hence a better match to low energy formants. Should be balanced by de-emphasis of the output speech. \*---------------------------------------------------------------------------*/ -void pre_emp( - float Sn_pre[], /* output frame of speech samples */ - float Sn[], /* input frame of speech samples */ - float *mem, /* Sn[-1]single sample memory */ - int Nsam /* number of speech samples to use */ -) -{ - int i; - - for(i=0; i 1.0) - k = 0.0; + for (j = 1; j <= i - 1; j++) sum += a[i - 1][j] * R[i - j]; + k = -1.0 * (R[i] + sum) / e; /* Equation 38b, Makhoul */ + if (fabsf(k) > 1.0) k = 0.0; a[i][i] = k; - for(j=1; j<=i-1; j++) - a[i][j] = a[i-1][j] + k*a[i-1][i-j]; /* Equation 38c, Makhoul */ + for (j = 1; j <= i - 1; j++) + a[i][j] = a[i - 1][j] + k * a[i - 1][i - j]; /* Equation 38c, Makhoul */ - e *= (1-k*k); /* Equation 38d, Makhoul */ + e *= (1 - k * k); /* Equation 38d, Makhoul */ } - for(i=1; i<=order; i++) - lpcs[i] = a[order][i]; + for (i = 1; i <= order; i++) lpcs[i] = a[order][i]; lpcs[0] = 1.0; } @@ -194,20 +178,17 @@ void levinson_durbin( \*---------------------------------------------------------------------------*/ -void inverse_filter( - float Sn[], /* Nsam input samples */ - float a[], /* LPCs for this frame of samples */ - int Nsam, /* number of samples */ - float res[], /* Nsam residual samples */ - int order /* order of LPC */ -) -{ - int i,j; /* loop variables */ - - for(i=0; i. */ -#include "defines.h" #include "lsp.h" + #include #include #include +#include "defines.h" + /*---------------------------------------------------------------------------*\ Introduction to Line Spectrum Pairs (LSPs) @@ -77,49 +79,45 @@ AUTHOR......: David Rowe DATE CREATED: 24/2/93 - This function evalutes a series of chebyshev polynomials + This function evaluates a series of chebyshev polynomials FIXME: performing memory allocation at run time is very inefficient, replace with stack variables of MAX_P size. \*---------------------------------------------------------------------------*/ - -static float -cheb_poly_eva(float *coef,float x,int order) +static float cheb_poly_eva(float *coef, float x, int order) /* float coef[] coefficients of the polynomial to be evaluated */ /* float x the point where polynomial is to be evaluated */ /* int order order of the polynomial */ { - int i; - float *t,*u,*v,sum; - float T[(order / 2) + 1]; + int i; + float *t, *u, *v, sum; + float T[(order / 2) + 1]; - /* Initialise pointers */ + /* Initialise pointers */ - t = T; /* T[i-2] */ - *t++ = 1.0; - u = t--; /* T[i-1] */ - *u++ = x; - v = u--; /* T[i] */ + t = T; /* T[i-2] */ + *t++ = 1.0; + u = t--; /* T[i-1] */ + *u++ = x; + v = u--; /* T[i] */ - /* Evaluate chebyshev series formulation using iterative approach */ + /* Evaluate chebyshev series formulation using iterative approach */ - for(i=2;i<=order/2;i++) - *v++ = (2*x)*(*u++) - *t++; /* T[i] = 2*x*T[i-1] - T[i-2] */ + for (i = 2; i <= order / 2; i++) + *v++ = (2 * x) * (*u++) - *t++; /* T[i] = 2*x*T[i-1] - T[i-2] */ - sum=0.0; /* initialise sum to zero */ - t = T; /* reset pointer */ + sum = 0.0; /* initialise sum to zero */ + t = T; /* reset pointer */ - /* Evaluate polynomial and return value also free memory space */ + /* Evaluate polynomial and return value also free memory space */ - for(i=0;i<=order/2;i++) - sum+=coef[(order/2)-i]**t++; + for (i = 0; i <= order / 2; i++) sum += coef[(order / 2) - i] * *t++; - return sum; + return sum; } - /*---------------------------------------------------------------------------*\ FUNCTION....: lpc_to_lsp() @@ -130,121 +128,118 @@ cheb_poly_eva(float *coef,float x,int order) \*---------------------------------------------------------------------------*/ -int lpc_to_lsp (float *a, int order, float *freq, int nb, float delta) +int lpc_to_lsp(float *a, int order, float *freq, int nb, float delta) /* float *a lpc coefficients */ /* int order order of LPC coefficients (10) */ /* float *freq LSP frequencies in radians */ /* int nb number of sub-intervals (4) */ /* float delta grid spacing interval (0.02) */ { - float psuml,psumr,psumm,temp_xr,xl,xr,xm = 0; - float temp_psumr; - int i,j,m,flag,k; - float *px; /* ptrs of respective P'(z) & Q'(z) */ - float *qx; - float *p; - float *q; - float *pt; /* ptr used for cheb_poly_eval() - whether P' or Q' */ - int roots=0; /* number of roots found */ - float Q[order + 1]; - float P[order + 1]; - + float psuml, psumr, psumm, temp_xr, xl, xr, xm = 0; + float temp_psumr; + int i, j, m, flag, k; + float *px; /* ptrs of respective P'(z) & Q'(z) */ + float *qx; + float *p; + float *q; + float *pt; /* ptr used for cheb_poly_eval() + whether P' or Q' */ + int roots = 0; /* number of roots found */ + float Q[order + 1]; + float P[order + 1]; + + flag = 1; + m = order / 2; /* order of P'(z) & Q'(z) polynimials */ + + /* Allocate memory space for polynomials */ + + /* determine P'(z)'s and Q'(z)'s coefficients where + P'(z) = P(z)/(1 + z^(-1)) and Q'(z) = Q(z)/(1-z^(-1)) */ + + px = P; /* initilaise ptrs */ + qx = Q; + p = px; + q = qx; + *px++ = 1.0; + *qx++ = 1.0; + for (i = 1; i <= m; i++) { + *px++ = a[i] + a[order + 1 - i] - *p++; + *qx++ = a[i] - a[order + 1 - i] + *q++; + } + px = P; + qx = Q; + for (i = 0; i < m; i++) { + *px = 2 * *px; + *qx = 2 * *qx; + px++; + qx++; + } + px = P; /* re-initialise ptrs */ + qx = Q; + + /* Search for a zero in P'(z) polynomial first and then alternate to Q'(z). + Keep alternating between the two polynomials as each zero is found */ + + xr = 0; /* initialise xr to zero */ + xl = 1.0; /* start at point xl = 1 */ + + for (j = 0; j < order; j++) { + if (j % 2) /* determines whether P' or Q' is eval. */ + pt = qx; + else + pt = px; + + psuml = cheb_poly_eva(pt, xl, order); /* evals poly. at xl */ flag = 1; - m = order/2; /* order of P'(z) & Q'(z) polynimials */ - - /* Allocate memory space for polynomials */ - - /* determine P'(z)'s and Q'(z)'s coefficients where - P'(z) = P(z)/(1 + z^(-1)) and Q'(z) = Q(z)/(1-z^(-1)) */ - - px = P; /* initilaise ptrs */ - qx = Q; - p = px; - q = qx; - *px++ = 1.0; - *qx++ = 1.0; - for(i=1;i<=m;i++){ - *px++ = a[i]+a[order+1-i]-*p++; - *qx++ = a[i]-a[order+1-i]+*q++; - } - px = P; - qx = Q; - for(i=0;i= -1.0)){ - xr = xl - delta ; /* interval spacing */ - psumr = cheb_poly_eva(pt,xr,order);/* poly(xl-delta_x) */ - temp_psumr = psumr; - temp_xr = xr; - - /* if no sign change increment xr and re-evaluate - poly(xr). Repeat til sign change. if a sign change has - occurred the interval is bisected and then checked again - for a sign change which determines in which interval the - zero lies in. If there is no sign change between poly(xm) - and poly(xl) set interval between xm and xr else set - interval between xl and xr and repeat till root is located - within the specified limits */ - - if(((psumr*psuml)<0.0) || (psumr == 0.0)){ - roots++; - - psumm=psuml; - for(k=0;k<=nb;k++){ - xm = (xl+xr)/2; /* bisect the interval */ - psumm=cheb_poly_eva(pt,xm,order); - if(psumm*psuml>0.){ - psuml=psumm; - xl=xm; - } - else{ - psumr=psumm; - xr=xm; - } - } - - /* once zero is found, reset initial interval to xr */ - freq[j] = (xm); - xl = xm; - flag = 0; /* reset flag for next search */ - } - else{ - psuml=temp_psumr; - xl=temp_xr; - } - } + while (flag && (xr >= -1.0)) { + xr = xl - delta; /* interval spacing */ + psumr = cheb_poly_eva(pt, xr, order); /* poly(xl-delta_x) */ + temp_psumr = psumr; + temp_xr = xr; + + /* if no sign change increment xr and re-evaluate + poly(xr). Repeat til sign change. if a sign change has + occurred the interval is bisected and then checked again + for a sign change which determines in which interval the + zero lies in. If there is no sign change between poly(xm) + and poly(xl) set interval between xm and xr else set + interval between xl and xr and repeat till root is located + within the specified limits */ + + if (((psumr * psuml) < 0.0) || (psumr == 0.0)) { + roots++; + + psumm = psuml; + for (k = 0; k <= nb; k++) { + xm = (xl + xr) / 2; /* bisect the interval */ + psumm = cheb_poly_eva(pt, xm, order); + if (psumm * psuml > 0.) { + psuml = psumm; + xl = xm; + } else { + psumr = psumm; + xr = xm; + } + } + + /* once zero is found, reset initial interval to xr */ + freq[j] = (xm); + xl = xm; + flag = 0; /* reset flag for next search */ + } else { + psuml = temp_psumr; + xl = temp_xr; + } } + } - /* convert from x domain to radians */ + /* convert from x domain to radians */ - for(i=0; i #include #include #include #include -#include "mbest.h" - struct MBEST *mbest_create(int entries) { - int i,j; - struct MBEST *mbest; + int i, j; + struct MBEST *mbest; - assert(entries > 0); - mbest = (struct MBEST *)malloc(sizeof(struct MBEST)); - assert(mbest != NULL); + assert(entries > 0); + mbest = (struct MBEST *)malloc(sizeof(struct MBEST)); + assert(mbest != NULL); - mbest->entries = entries; - mbest->list = (struct MBEST_LIST *)malloc(entries*sizeof(struct MBEST_LIST)); - assert(mbest->list != NULL); + mbest->entries = entries; + mbest->list = + (struct MBEST_LIST *)malloc(entries * sizeof(struct MBEST_LIST)); + assert(mbest->list != NULL); - for(i=0; ientries; i++) { - for(j=0; jlist[i].index[j] = 0; - mbest->list[i].error = 1E32; - } + for (i = 0; i < mbest->entries; i++) { + for (j = 0; j < MBEST_STAGES; j++) mbest->list[i].index[j] = 0; + mbest->list[i].error = 1E32; + } - return mbest; + return mbest; } - void mbest_destroy(struct MBEST *mbest) { - assert(mbest != NULL); - free(mbest->list); - free(mbest); + assert(mbest != NULL); + free(mbest->list); + free(mbest); } +/* apply weighting to VQ for efficient VQ search */ + +void mbest_precompute_weight(float cb[], float w[], int k, int m) { + for (int j = 0; j < m; j++) { + for (int i = 0; i < k; i++) cb[k * j + i] *= w[i]; + } +} /*---------------------------------------------------------------------------*\ @@ -75,36 +81,31 @@ void mbest_destroy(struct MBEST *mbest) { \*---------------------------------------------------------------------------*/ void mbest_insert(struct MBEST *mbest, int index[], float error) { - int i, j, found; - struct MBEST_LIST *list = mbest->list; - int entries = mbest->entries; - - found = 0; - for(i=0; ii; j--) - list[j] = list[j-1]; - for(j=0; jlist; + int entries = mbest->entries; + + found = 0; + for (i = 0; i < entries && !found; i++) + if (error < list[i].error) { + found = 1; + memmove(&list[i + 1], &list[i], + sizeof(struct MBEST_LIST) * (entries - i - 1)); + memcpy(&list[i].index[0], &index[0], sizeof(int) * MBEST_STAGES); + list[i].error = error; + } } +void mbest_print(char title[], struct MBEST *mbest) { + int i, j; -#ifdef MBEST_PRINT_OUT -static void mbest_print(char title[], struct MBEST *mbest) { - int i,j; - - fprintf(stderr, "%s\n", title); - for(i=0; ientries; i++) { - for(j=0; jlist[i].index[j]); - fprintf(stderr, " %f\n", mbest->list[i].error); - } + fprintf(stderr, "%s\n", title); + for (i = 0; i < mbest->entries; i++) { + for (j = 0; j < MBEST_STAGES; j++) + fprintf(stderr, " %4d ", mbest->list[i].index[j]); + fprintf(stderr, " %f\n", (double)mbest->list[i].error); + } } -#endif - /*---------------------------------------------------------------------------*\ @@ -115,31 +116,48 @@ static void mbest_print(char title[], struct MBEST *mbest) { \*---------------------------------------------------------------------------*/ -void mbest_search( - const float *cb, /* VQ codebook to search */ - float vec[], /* target vector */ - float w[], /* weighting vector */ - int k, /* dimension of vector */ - int m, /* number on entries in codebook */ - struct MBEST *mbest, /* list of closest matches */ - int index[] /* indexes that lead us here */ -) -{ - float e; - int i,j; - float diff; - - for(j=0; jlist[mbest->entries - 1].error) + mbest_insert(mbest, index, e); + } +} /*---------------------------------------------------------------------------*\ @@ -148,26 +166,26 @@ void mbest_search( Searches vec[] to a codebbook of vectors, and maintains a list of the mbest closest matches. Only searches the first NewAmp2_K Vectors - \*---------------------------------------------------------------------------*/ +\*---------------------------------------------------------------------------*/ -void mbest_search450(const float *cb, float vec[], float w[], int k,int shorterK, int m, struct MBEST *mbest, int index[]) +void mbest_search450(const float *cb, float vec[], float w[], int k, + int shorterK, int m, struct MBEST *mbest, int index[]) { - float e; - int i,j; - float diff; - - for(j=0; j +#include #include #include #include -#include #include "defines.h" +#include "mbest.h" #include "phase.h" #include "quantise.h" -#include "mbest.h" -#include "newamp1.h" - -#define NEWAMP1_VQ_MBEST_DEPTH 5 /* how many candidates we keep for each stage of mbest search */ /*---------------------------------------------------------------------------*\ @@ -48,39 +47,44 @@ AUTHOR......: David Rowe DATE CREATED: Jan 2017 - General 2nd order parabolic interpolator. Used splines orginally, + General 2nd order parabolic interpolator. Used splines originally, but this is much simpler and we don't need much accuracy. Given two vectors of points xp and yp, find interpolated values y at points x. \*---------------------------------------------------------------------------*/ -void interp_para(float y[], float xp[], float yp[], int np, float x[], int n) -{ - assert(np >= 3); +void interp_para(float y[], float xp[], float yp[], int np, float x[], int n) { + assert(np >= 3); - int k,i; - float xi, x1, y1, x2, y2, x3, y3, a, b; + int k, i; + float xi, x1, y1, x2, y2, x3, y3, a, b; - k = 0; - for (i=0; iL; m++) { - AmdB[m] = 20.0*log10f(model->A[m]+1E-16); - if (AmdB[m] > AmdB_peak) { - AmdB_peak = AmdB[m]; - } - rate_L_sample_freqs_kHz[m] = m*model->Wo*(c2const->Fs/2000.0)/M_PI; - //printf("m: %d AmdB: %f AmdB_peak: %f sf: %f\n", m, AmdB[m], AmdB_peak, rate_L_sample_freqs_kHz[m]); +void resample_const_rate_f(C2CONST *c2const, MODEL *model, float rate_K_vec[], + float rate_K_sample_freqs_kHz[], int K) { + int m; + float AmdB[MAX_AMP + 1], rate_L_sample_freqs_kHz[MAX_AMP + 1], AmdB_peak; + + /* convert rate L=pi/Wo amplitude samples to fixed rate K */ + + AmdB_peak = -100.0; + for (m = 1; m <= model->L; m++) { + AmdB[m] = 20.0 * log10f(model->A[m] + 1E-16); + if (AmdB[m] > AmdB_peak) { + AmdB_peak = AmdB[m]; } - - /* clip between peak and peak -50dB, to reduce dynamic range */ + rate_L_sample_freqs_kHz[m] = m * model->Wo * (c2const->Fs / 2000.0) / M_PI; + // printf("m: %d AmdB: %f AmdB_peak: %f sf: %f\n", m, AmdB[m], AmdB_peak, + // rate_L_sample_freqs_kHz[m]); + } + + /* clip between peak and peak -50dB, to reduce dynamic range */ - for(m=1; m<=model->L; m++) { - if (AmdB[m] < (AmdB_peak-50.0)) { - AmdB[m] = AmdB_peak-50.0; - } + for (m = 1; m <= model->L; m++) { + if (AmdB[m] < (AmdB_peak - 50.0)) { + AmdB[m] = AmdB_peak - 50.0; } + } - interp_para(rate_K_vec, &rate_L_sample_freqs_kHz[1], &AmdB[1], model->L, rate_K_sample_freqs_kHz, K); + interp_para(rate_K_vec, &rate_L_sample_freqs_kHz[1], &AmdB[1], model->L, + rate_K_sample_freqs_kHz, K); } - /*---------------------------------------------------------------------------*\ FUNCTION....: rate_K_mbest_encode @@ -161,64 +165,55 @@ void resample_const_rate_f(C2CONST *c2const, MODEL *model, float rate_K_vec[], f \*---------------------------------------------------------------------------*/ -float rate_K_mbest_encode(int *indexes, float *x, float *xq, int ndim, int mbest_entries) -{ +float rate_K_mbest_encode(int *indexes, float *x, float *xq, int ndim, + int mbest_entries) { int i, j, n1, n2; const float *codebook1 = newamp1vq_cb[0].cb; const float *codebook2 = newamp1vq_cb[1].cb; struct MBEST *mbest_stage1, *mbest_stage2; float target[ndim]; - float w[ndim]; - int index[MBEST_STAGES]; + int index[MBEST_STAGES]; float mse, tmp; /* codebook is compiled for a fixed K */ assert(ndim == newamp1vq_cb[0].k); - /* equal weights, could be argued mel freq axis gives freq dep weighting */ - - for(i=0; ilist[j].index[0]; - for(i=0; ilist[j].index[0]; + for (i = 0; i < ndim; i++) target[i] = x[i] - codebook1[ndim * n1 + i]; + mbest_search(codebook2, target, ndim, newamp1vq_cb[1].m, mbest_stage2, + index); } - MBEST_PRINT("Stage 2:", mbest_stage2); n1 = mbest_stage2->list[0].index[1]; n2 = mbest_stage2->list[0].index[0]; mse = 0.0; - for (i=0;iL; m++) { - rate_L_sample_freqs_kHz[m] = m*model->Wo*(c2const->Fs/2000.0)/M_PI; - } - - interp_para(&AmdB[1], rate_K_sample_freqs_kHz_term, rate_K_vec_term, K+2, &rate_L_sample_freqs_kHz[1], model->L); - for(m=1; m<=model->L; m++) { - model->A[m] = POW10F(AmdB[m]/20.0); - // printf("m: %d f: %f AdB: %f A: %f\n", m, rate_L_sample_freqs_kHz[m], AmdB[m], model->A[m]); - } -} +void resample_rate_L(C2CONST *c2const, MODEL *model, float rate_K_vec[], + float rate_K_sample_freqs_kHz[], int K) { + float rate_K_vec_term[K + 2], rate_K_sample_freqs_kHz_term[K + 2]; + float AmdB[MAX_AMP + 1], rate_L_sample_freqs_kHz[MAX_AMP + 1]; + int m, k; + /* terminate either end of the rate K vecs with 0dB points */ + + rate_K_vec_term[0] = rate_K_vec_term[K + 1] = 0.0; + rate_K_sample_freqs_kHz_term[0] = 0.0; + rate_K_sample_freqs_kHz_term[K + 1] = 4.0; + + for (k = 0; k < K; k++) { + rate_K_vec_term[k + 1] = rate_K_vec[k]; + rate_K_sample_freqs_kHz_term[k + 1] = rate_K_sample_freqs_kHz[k]; + // printf("k: %d f: %f rate_K: %f\n", k, rate_K_sample_freqs_kHz[k], + // rate_K_vec[k]); + } + + for (m = 1; m <= model->L; m++) { + rate_L_sample_freqs_kHz[m] = m * model->Wo * (c2const->Fs / 2000.0) / M_PI; + } + + interp_para(&AmdB[1], rate_K_sample_freqs_kHz_term, rate_K_vec_term, K + 2, + &rate_L_sample_freqs_kHz[1], model->L); + for (m = 1; m <= model->L; m++) { + model->A[m] = POW10F(AmdB[m] / 20.0); + // printf("m: %d f: %f AdB: %f A: %f\n", m, rate_L_sample_freqs_kHz[m], + // AmdB[m], model->A[m]); + } +} /*---------------------------------------------------------------------------*\ @@ -368,34 +360,100 @@ void resample_rate_L(C2CONST *c2const, MODEL *model, float rate_K_vec[], float r \*---------------------------------------------------------------------------*/ -void determine_phase(C2CONST *c2const, COMP H[], MODEL *model, int Nfft, codec2_fft_cfg fwd_cfg, codec2_fft_cfg inv_cfg) -{ - int i,m,b; - int Ns = Nfft/2+1; - float Gdbfk[Ns], sample_freqs_kHz[Ns], phase[Ns]; - float AmdB[MAX_AMP+1], rate_L_sample_freqs_kHz[MAX_AMP+1]; - - for(m=1; m<=model->L; m++) { - assert(model->A[m] != 0.0); - AmdB[m] = 20.0*log10f(model->A[m]); - rate_L_sample_freqs_kHz[m] = (float)m*model->Wo*(c2const->Fs/2000.0)/M_PI; - } - - for(i=0; iFs/1000.0)*(float)i/Nfft; - } +void determine_phase(C2CONST *c2const, COMP H[], MODEL *model, int Nfft, + codec2_fft_cfg fwd_cfg, codec2_fft_cfg inv_cfg) { + int i, m, b; + int Ns = Nfft / 2 + 1; + float Gdbfk[Ns], sample_freqs_kHz[Ns], phase[Ns]; + float AmdB[MAX_AMP + 1], rate_L_sample_freqs_kHz[MAX_AMP + 1]; + + for (m = 1; m <= model->L; m++) { + assert(model->A[m] != 0.0); + AmdB[m] = 20.0 * log10f(model->A[m]); + rate_L_sample_freqs_kHz[m] = + (float)m * model->Wo * (c2const->Fs / 2000.0) / M_PI; + } - interp_para(Gdbfk, &rate_L_sample_freqs_kHz[1], &AmdB[1], model->L, sample_freqs_kHz, Ns); - mag_to_phase(phase, Gdbfk, Nfft, fwd_cfg, inv_cfg); + for (i = 0; i < Ns; i++) { + sample_freqs_kHz[i] = (c2const->Fs / 1000.0) * (float)i / Nfft; + } - for(m=1; m<=model->L; m++) { - b = floorf(0.5+m*model->Wo*Nfft/(2.0*M_PI)); - H[m].real = cosf(phase[b]); H[m].imag = sinf(phase[b]); - } + interp_para(Gdbfk, &rate_L_sample_freqs_kHz[1], &AmdB[1], model->L, + sample_freqs_kHz, Ns); + mag_to_phase(phase, Gdbfk, Nfft, fwd_cfg, inv_cfg); + + for (m = 1; m <= model->L; m++) { + b = floorf(0.5 + m * model->Wo * Nfft / (2.0 * M_PI)); + H[m].real = cosf(phase[b]); + H[m].imag = sinf(phase[b]); + } } +/*---------------------------------------------------------------------------* \ -/*---------------------------------------------------------------------------*\ + FUNCTION....: determine_autoc + AUTHOR......: David Rowe + DATE CREATED: April 2020 + + Determine autocorrelation coefficients from model params, for machine + learning experiments. + +\*---------------------------------------------------------------------------*/ + +void determine_autoc(C2CONST *c2const, float Rk[], int order, MODEL *model, + int Nfft, codec2_fft_cfg fwd_cfg, codec2_fft_cfg inv_cfg) { + int i, m; + int Ns = Nfft / 2 + 1; + float Gdbfk[Ns], sample_freqs_kHz[Ns]; + float AmdB[MAX_AMP + 1], rate_L_sample_freqs_kHz[MAX_AMP + 1]; + + /* interpolate in the log domain */ + for (m = 1; m <= model->L; m++) { + assert(model->A[m] != 0.0); + AmdB[m] = 20.0 * log10f(model->A[m]); + rate_L_sample_freqs_kHz[m] = + (float)m * model->Wo * (c2const->Fs / 2000.0) / M_PI; + } + + for (i = 0; i < Ns; i++) { + sample_freqs_kHz[i] = (c2const->Fs / 1000.0) * (float)i / Nfft; + } + + interp_para(Gdbfk, &rate_L_sample_freqs_kHz[1], &AmdB[1], model->L, + sample_freqs_kHz, Ns); + + COMP S[Nfft], R[Nfft]; + + /* install negative frequency components, convert to mag squared of spectrum + */ + S[0].real = pow(10.0, Gdbfk[0] / 10.0); + S[0].imag = 0.0; + for (i = 1; i < Ns; i++) { + S[i].real = S[Nfft - i].real = pow(10.0, Gdbfk[i] / 10.0); + S[i].imag = S[Nfft - i].imag = 0.0; + } + + /* IDFT of mag squared is autocorrelation function */ + codec2_fft(inv_cfg, S, R); + for (int k = 0; k < order + 1; k++) Rk[k] = R[k].real; +} + +/* update and optionally run "front eq" equaliser on before VQ */ +void newamp1_eq(float rate_K_vec_no_mean[], float eq[], int K, int eq_en) { + static float ideal[] = {8, 10, 12, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, -20}; + float gain = 0.02; + float update; + + for (int k = 0; k < K; k++) { + update = rate_K_vec_no_mean[k] - ideal[k]; + eq[k] = (1.0 - gain) * eq[k] + gain * update; + if (eq[k] < 0.0) eq[k] = 0.0; + if (eq_en) rate_K_vec_no_mean[k] -= eq[k]; + } +} + +/*---------------------------------------------------------------------------* \ FUNCTION....: newamp1_model_to_indexes AUTHOR......: David Rowe @@ -406,78 +464,53 @@ void determine_phase(C2CONST *c2const, COMP H[], MODEL *model, int Nfft, codec2_ \*---------------------------------------------------------------------------*/ -void newamp1_model_to_indexes(C2CONST *c2const, - int indexes[], - MODEL *model, - float rate_K_vec[], - float rate_K_sample_freqs_kHz[], - int K, - float *mean, - float rate_K_vec_no_mean[], - float rate_K_vec_no_mean_[], - float *se, - float *eq, - int eq_en - ) -{ - int k; - - /* convert variable rate L to fixed rate K */ - resample_const_rate_f(c2const, model, rate_K_vec, rate_K_sample_freqs_kHz, K); - - /* remove mean */ - float sum = 0.0; - for(k=0; kvoiced) { - int index = encode_log_Wo(c2const, model->Wo, 6); - if (index == 0) { - index = 1; - } - indexes[3] = index; - } - else { - indexes[3] = 0; +void newamp1_model_to_indexes(C2CONST *c2const, int indexes[], MODEL *model, + float rate_K_vec[], + float rate_K_sample_freqs_kHz[], int K, + float *mean, float rate_K_vec_no_mean[], + float rate_K_vec_no_mean_[], float *se, float *eq, + int eq_en) { + int k; + + /* convert variable rate L to fixed rate K */ + resample_const_rate_f(c2const, model, rate_K_vec, rate_K_sample_freqs_kHz, K); + + /* remove mean */ + float sum = 0.0; + for (k = 0; k < K; k++) sum += rate_K_vec[k]; + *mean = sum / K; + for (k = 0; k < K; k++) rate_K_vec_no_mean[k] = rate_K_vec[k] - *mean; + + /* update and optionally run "front eq" equaliser on before VQ */ + newamp1_eq(rate_K_vec_no_mean, eq, K, eq_en); + + /* two stage VQ */ + rate_K_mbest_encode(indexes, rate_K_vec_no_mean, rate_K_vec_no_mean_, K, + NEWAMP1_VQ_MBEST_DEPTH); + + /* running sum of squared error for variance calculation */ + for (k = 0; k < K; k++) + *se += (float)pow(rate_K_vec_no_mean[k] - rate_K_vec_no_mean_[k], 2.0); + + /* scalar quantise mean (effectively the frame energy) */ + float w[1] = {1.0}; + float se_mean; + indexes[2] = + quantise(newamp1_energy_cb[0].cb, mean, w, newamp1_energy_cb[0].k, + newamp1_energy_cb[0].m, &se_mean); + + /* scalar quantise Wo. We steal the smallest Wo index to signal + an unvoiced frame */ + if (model->voiced) { + int index = encode_log_Wo(c2const, model->Wo, 6); + if (index == 0) { + index = 1; } - - } - + indexes[3] = index; + } else { + indexes[3] = 0; + } +} /*---------------------------------------------------------------------------*\ @@ -487,22 +520,22 @@ void newamp1_model_to_indexes(C2CONST *c2const, \*---------------------------------------------------------------------------*/ -void newamp1_interpolate(float interpolated_surface_[], float left_vec[], float right_vec[], int K) -{ - int i, k; - int M = 4; - float c; +void newamp1_interpolate(float interpolated_surface_[], float left_vec[], + float right_vec[], int K) { + int i, k; + int M = 4; + float c; - /* (linearly) interpolate 25Hz amplitude vectors back to 100Hz */ + /* (linearly) interpolate 25Hz amplitude vectors back to 100Hz */ - for(i=0,c=1.0; i. - -*/ - -#include -#include -#include -#include -#include - -#include "defines.h" -#include "phase.h" -#include "quantise.h" -#include "mbest.h" -#include "newamp1.h" -#include "newamp2.h" - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: n2_mel_sample_freqs_kHz() - AUTHOR......: Thomas Kurin and Stefan Erhardt - INSTITUTE...: Institute for Electronics Engineering, University of Erlangen-Nuremberg - DATE CREATED: July 2018 - - Outputs fixed frequencies for the K-Vectors to be able to work with both 8k and 16k mode. - -\*---------------------------------------------------------------------------*/ - -void n2_mel_sample_freqs_kHz(float rate_K_sample_freqs_kHz[], int K) -{ - float freq[] = {0.199816, 0.252849, 0.309008, 0.368476, 0.431449, 0.498134, 0.568749, 0.643526, 0.722710, 0.806561, 0.895354, 0.989380, - 1.088948, 1.194384, 1.306034, 1.424264, 1.549463, 1.682041, 1.822432, 1.971098, 2.128525, 2.295232, 2.471763, 2.658699, - 2.856652, 3.066272, 3.288246, 3.523303, 3.772214, 4.035795, 4.314912, 4.610478, 4.923465, 5.254899, 5.605865, 5.977518, - 6.371075, 6.787827, 7.229141, 7.696465}; - int k; - //printf("\n\n"); - for (k=0; kL; m++) { - AmdB[m] = 20.0*log10(model->A[m]+1E-16); - if (AmdB[m] > AmdB_peak) { - AmdB_peak = AmdB[m]; - } - rate_L_sample_freqs_kHz[m] = m*model->Wo*(c2const->Fs/2000.0)/M_PI; - //printf("m: %d AmdB: %f AmdB_peak: %f sf: %f\n", m, AmdB[m], AmdB_peak, rate_L_sample_freqs_kHz[m]); - } - - /* clip between peak and peak -50dB, to reduce dynamic range */ - - for(m=1; m<=model->L; m++) { - if (AmdB[m] < (AmdB_peak-50.0)) { - AmdB[m] = AmdB_peak-50.0; - } - } - - interp_para(rate_K_vec, &rate_L_sample_freqs_kHz[1], &AmdB[1], model->L, rate_K_sample_freqs_kHz, K); -} - - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: n2_rate_K_mbest_encode - AUTHOR......: Thomas Kurin and Stefan Erhardt - INSTITUTE...: Institute for Electronics Engineering, University of Erlangen-Nuremberg - DATE CREATED: July 2018 - - One stage rate K newamp2 VQ quantiser using mbest search. - -\*---------------------------------------------------------------------------*/ - -void n2_rate_K_mbest_encode(int *indexes, float *x, float *xq, int ndim) -{ - int i, n1; - const float *codebook1 = newamp2vq_cb[0].cb; - struct MBEST *mbest_stage1; - float w[ndim]; - int index[1]; - - /* codebook is compiled for a fixed K */ - - //assert(ndim == newamp2vq_cb[0].k); - - /* equal weights, could be argued mel freq axis gives freq dep weighting */ - - for(i=0; ilist[0].index[0]; - - mbest_destroy(mbest_stage1); - - //indexes[1]: legacy from newamp1 - indexes[0] = n1; indexes[1] = n1; - -} - - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: n2_resample_rate_L - AUTHOR......: Thomas Kurin and Stefan Erhardt - INSTITUTE...: Institute for Electronics Engineering, University of Erlangen-Nuremberg - DATE CREATED: July 2018 - - Decoder side conversion of rate K vector back to rate L. - Plosives are set to zero for the first 2 of 4 frames. - -\*---------------------------------------------------------------------------*/ - -void n2_resample_rate_L(C2CONST *c2const, MODEL *model, float rate_K_vec[], float rate_K_sample_freqs_kHz[], int K,int plosive_flag) -{ - float rate_K_vec_term[K+2], rate_K_sample_freqs_kHz_term[K+2]; - float AmdB[MAX_AMP+1], rate_L_sample_freqs_kHz[MAX_AMP+1]; - int m,k; - - /* terminate either end of the rate K vecs with 0dB points */ - - rate_K_vec_term[0] = rate_K_vec_term[K+1] = 0.0; - rate_K_sample_freqs_kHz_term[0] = 0.0; - rate_K_sample_freqs_kHz_term[K+1] = 4.0; - - for(k=0; kL; m++) { - rate_L_sample_freqs_kHz[m] = m*model->Wo*(c2const->Fs/2000.0)/M_PI; - } - - interp_para(&AmdB[1], rate_K_sample_freqs_kHz_term, rate_K_vec_term, K+2, &rate_L_sample_freqs_kHz[1], model->L); - for(m=1; m<=model->L; m++) { - if(plosive_flag==0){ - model->A[m] = pow(10.0, AmdB[m]/20.0); - }else{ - model->A[m] = 0.1; - } - // printf("m: %d f: %f AdB: %f A: %f\n", m, rate_L_sample_freqs_kHz[m], AmdB[m], model->A[m]); - } -} - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: n2_post_filter_newamp2 - AUTHOR......: Thomas Kurin and Stefan Erhardt - INSTITUTE...: Institute for Electronics Engineering, University of Erlangen-Nuremberg - DATE CREATED: July 2018 - - Postfilter for the pseudo wideband mode. Still has to be adapted! - -\*---------------------------------------------------------------------------*/ - -void n2_post_filter_newamp2(float vec[], float sample_freq_kHz[], int K, float pf_gain) -{ - int k; - - /* - vec is rate K vector describing spectrum of current frame lets - pre-emp before applying PF. 20dB/dec over 300Hz. Postfilter - affects energy of frame so we measure energy before and after - and normalise. Plenty of room for experiment here as well. - */ - - float pre[K]; - float e_before = 0.0; - float e_after = 0.0; - for(k=0; kvoiced) { - int index = encode_log_Wo(c2const, model->Wo, 6); - if (index == 0) { - index = 1; - } - if (index == 63) { - index = 62; - } - indexes[3] = index; - } - else { - indexes[3] = 0; - } - if(plosive != 0){ - indexes[3] = 63; - } - } - - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: newamp2_indexes_to_rate_K_vec - AUTHOR......: Thomas Kurin and Stefan Erhardt - INSTITUTE...: Institute for Electronics Engineering, University of Erlangen-Nuremberg - DATE CREATED: July 2018 - - newamp2 decoder for amplitudes {Am}. Given the rate K VQ and energy - indexes, outputs rate K vector. Equal to newamp1 but using only one stage VQ. - -\*---------------------------------------------------------------------------*/ - -void newamp2_indexes_to_rate_K_vec(float rate_K_vec_[], - float rate_K_vec_no_mean_[], - float rate_K_sample_freqs_kHz[], - int K, - float *mean_, - int indexes[], - float pf_gain) -{ - int k; - const float *codebook1 = newamp2vq_cb[0].cb; - int n1 = indexes[0]; - - for(k=0; kmean2) - -\*---------------------------------------------------------------------------*/ - -void newamp2_16k_indexes_to_rate_K_vec(float rate_K_vec_[], - float rate_K_vec_no_mean_[], - float rate_K_sample_freqs_kHz[], - int K, - float *mean_, - int indexes[], - float pf_gain) -{ - int k; - const float *codebook1 = newamp2vq_cb[0].cb; - float mean2 = 0; - int n1 = indexes[0]; - - for(k=0; k50){ - mean2 = 50; - } - - for(k=0; k0 && indexes[3]<63) { - Wo_right = decode_log_Wo(c2const, indexes[3], 6); - voicing_right = 1; - } - //Unvoiced - else if(indexes[3] == 0){ - Wo_right = 2.0*M_PI/100.0; - voicing_right = 0; - } - //indexes[3]=63 (= Plosive) and unvoiced - else { - Wo_right = 2.0*M_PI/100.0; - voicing_right = 0; - plosive_flag = 1; - } - - /* interpolate 25Hz rate K vec back to 100Hz */ - - float *left_vec = prev_rate_K_vec_; - float *right_vec = rate_K_vec_; - newamp2_interpolate(interpolated_surface_, left_vec, right_vec, K,plosive_flag); - - /* interpolate 25Hz v and Wo back to 100Hz */ - - float aWo_[M]; - int avoicing_[M], aL_[M], i; - - interp_Wo_v(aWo_, aL_, avoicing_, *Wo_left, Wo_right, *voicing_left, voicing_right); - - /* back to rate L amplitudes, synthesis phase for each frame */ - - for(i=0; i0){ - //First two frames are set to zero - if (i<2){ - n2_resample_rate_L(c2const, &model_[i], &interpolated_surface_[K*i], rate_K_sample_freqs_kHz, K,1); - } - else{ - n2_resample_rate_L(c2const, &model_[i], &interpolated_surface_[K*i], rate_K_sample_freqs_kHz, K,0); - } - } - //No Plosive, standard resample - else{ - n2_resample_rate_L(c2const, &model_[i], &interpolated_surface_[K*i], rate_K_sample_freqs_kHz, K,0); - } - determine_phase(c2const, &H[(MAX_AMP+1)*i], &model_[i], NEWAMP2_PHASE_NFFT, fwd_cfg, inv_cfg); - } - - /* update memories for next time */ - - for(k=0; k. -*/ - -#ifndef __NEWAMP2__ -#define __NEWAMP2__ - -#define NEWAMP2_N_INDEXES 4 /* Number of indexes to pack: vq1, vq2, energy, Wo */ -#define NEWAMP2_PHASE_NFFT 128 /* size of FFT used for phase synthesis */ -#define NEWAMP2_K 29 /* rate K vector length */ -#define NEWAMP2_16K_K 40 /* rate K vector length for 16k Mode */ - -#include "codec2_fft.h" -#include "comp.h" - -void n2_mel_sample_freqs_kHz(float rate_K_sample_freqs_kHz[], int K); -void n2_resample_const_rate_f(C2CONST *c2const, MODEL *model, float rate_K_vec[], float rate_K_sample_freqs_kHz[], int K); -void n2_rate_K_mbest_encode(int *indexes, float *x, float *xq, int ndim); -void n2_resample_rate_L(C2CONST *c2const, MODEL *model, float rate_K_vec[], float rate_K_sample_freqs_kHz[], int K,int plosive_flag); -void n2_post_filter_newamp2(float vec[], float sample_freq_kHz[], int K, float pf_gain); -void newamp2_interpolate(float interpolated_surface_[], float left_vec[], float right_vec[], int K,int plosive_flag); -void newamp2_model_to_indexes(C2CONST *c2const, - int indexes[], - MODEL *model, - float rate_K_vec[], - float rate_K_sample_freqs_kHz[], - int K, - float *mean, - float rate_K_vec_no_mean[], - float rate_K_vec_no_mean_[], - int plosiv - ); -void newamp2_indexes_to_rate_K_vec(float rate_K_vec_[], - float rate_K_vec_no_mean_[], - float rate_K_sample_freqs_kHz[], - int K, - float *mean_, - int indexes[], - float pf_gain); -void newamp2_16k_indexes_to_rate_K_vec(float rate_K_vec_[], - float rate_K_vec_no_mean_[], - float rate_K_sample_freqs_kHz[], - int K, - float *mean_, - int indexes[], - float pf_gain); -void newamp2_indexes_to_model(C2CONST *c2const, - MODEL model_[], - COMP H[], - float interpolated_surface_[], - float prev_rate_K_vec_[], - float *Wo_left, - int *voicing_left, - float rate_K_sample_freqs_kHz[], - int K, - codec2_fft_cfg fwd_cfg, - codec2_fft_cfg inv_cfg, - int indexes[], - float pf_gain, - int flag16k); - -#endif diff --git a/nlp.c b/nlp.c index 036f6be..53cf040 100644 --- a/nlp.c +++ b/nlp.c @@ -25,115 +25,79 @@ along with this program; if not, see . */ -#include "defines.h" #include "nlp.h" -#include "dump.h" + #include "codec2_fft.h" +#include "defines.h" +#include "dump.h" #undef PROFILE -#include "machdep.h" -#include "os.h" - #include #include #include +#include "machdep.h" +#include "os.h" + /*---------------------------------------------------------------------------*\ - DEFINES + DEFINES \*---------------------------------------------------------------------------*/ -#define PMAX_M 320 /* maximum NLP analysis window size */ -#define COEFF 0.95 /* notch filter parameter */ -#define PE_FFT_SIZE 512 /* DFT size for pitch estimation */ -#define DEC 5 /* decimation factor */ +#define PMAX_M 320 /* maximum NLP analysis window size */ +#define COEFF 0.95 /* notch filter parameter */ +#define PE_FFT_SIZE 512 /* DFT size for pitch estimation */ +#define DEC 5 /* decimation factor */ #define SAMPLE_RATE 8000 -#define PI 3.141592654 /* mathematical constant */ -#define T 0.1 /* threshold for local minima candidate */ -#define F0_MAX 500 -#define CNLP 0.3 /* post processor constant */ -#define NLP_NTAP 48 /* Decimation LPF order */ +#define PI 3.141592654 /* mathematical constant */ +#define T 0.1 /* threshold for local minima candidate */ +#define F0_MAX 500 +#define CNLP 0.3 /* post processor constant */ +#define NLP_NTAP 48 /* Decimation LPF order */ /* 8 to 16 kHz sample rate conversion */ -#define FDMDV_OS 2 /* oversampling rate */ -#define FDMDV_OS_TAPS_16K 48 /* number of OS filter taps at 16kHz */ -#define FDMDV_OS_TAPS_8K (FDMDV_OS_TAPS_16K/FDMDV_OS) /* number of OS filter taps at 8kHz */ +#define FDMDV_OS 2 /* oversampling rate */ +#define FDMDV_OS_TAPS_16K 48 /* number of OS filter taps at 16kHz */ +#define FDMDV_OS_TAPS_8K \ + (FDMDV_OS_TAPS_16K / FDMDV_OS) /* number of OS filter taps at 8kHz */ /*---------------------------------------------------------------------------*\ - GLOBALS + GLOBALS \*---------------------------------------------------------------------------*/ /* 48 tap 600Hz low pass FIR filter coefficients */ const float nlp_fir[] = { - -1.0818124e-03, - -1.1008344e-03, - -9.2768838e-04, - -4.2289438e-04, - 5.5034190e-04, - 2.0029849e-03, - 3.7058509e-03, - 5.1449415e-03, - 5.5924666e-03, - 4.3036754e-03, - 8.0284511e-04, - -4.8204610e-03, - -1.1705810e-02, - -1.8199275e-02, - -2.2065282e-02, - -2.0920610e-02, - -1.2808831e-02, - 3.2204775e-03, - 2.6683811e-02, - 5.5520624e-02, - 8.6305944e-02, - 1.1480192e-01, - 1.3674206e-01, - 1.4867556e-01, - 1.4867556e-01, - 1.3674206e-01, - 1.1480192e-01, - 8.6305944e-02, - 5.5520624e-02, - 2.6683811e-02, - 3.2204775e-03, - -1.2808831e-02, - -2.0920610e-02, - -2.2065282e-02, - -1.8199275e-02, - -1.1705810e-02, - -4.8204610e-03, - 8.0284511e-04, - 4.3036754e-03, - 5.5924666e-03, - 5.1449415e-03, - 3.7058509e-03, - 2.0029849e-03, - 5.5034190e-04, - -4.2289438e-04, - -9.2768838e-04, - -1.1008344e-03, - -1.0818124e-03 -}; + -1.0818124e-03, -1.1008344e-03, -9.2768838e-04, -4.2289438e-04, + 5.5034190e-04, 2.0029849e-03, 3.7058509e-03, 5.1449415e-03, + 5.5924666e-03, 4.3036754e-03, 8.0284511e-04, -4.8204610e-03, + -1.1705810e-02, -1.8199275e-02, -2.2065282e-02, -2.0920610e-02, + -1.2808831e-02, 3.2204775e-03, 2.6683811e-02, 5.5520624e-02, + 8.6305944e-02, 1.1480192e-01, 1.3674206e-01, 1.4867556e-01, + 1.4867556e-01, 1.3674206e-01, 1.1480192e-01, 8.6305944e-02, + 5.5520624e-02, 2.6683811e-02, 3.2204775e-03, -1.2808831e-02, + -2.0920610e-02, -2.2065282e-02, -1.8199275e-02, -1.1705810e-02, + -4.8204610e-03, 8.0284511e-04, 4.3036754e-03, 5.5924666e-03, + 5.1449415e-03, 3.7058509e-03, 2.0029849e-03, 5.5034190e-04, + -4.2289438e-04, -9.2768838e-04, -1.1008344e-03, -1.0818124e-03}; typedef struct { - int Fs; /* sample rate in Hz */ - int m; - float w[PMAX_M/DEC]; /* DFT window */ - float sq[PMAX_M]; /* squared speech samples */ - float mem_x,mem_y; /* memory for notch filter */ - float mem_fir[NLP_NTAP]; /* decimation FIR filter memory */ - codec2_fft_cfg fft_cfg; /* kiss FFT config */ - float *Sn16k; /* Fs=16kHz input speech vector */ - FILE *f; + int Fs; /* sample rate in Hz */ + int m; + float w[PMAX_M / DEC]; /* DFT window */ + float sq[PMAX_M]; /* squared speech samples */ + float mem_x, mem_y; /* memory for notch filter */ + float mem_fir[NLP_NTAP]; /* decimation FIR filter memory */ + codec2_fft_cfg fft_cfg; /* kiss FFT config */ + float *Sn16k; /* Fs=16kHz input speech vector */ + FILE *f; } NLP; -float post_process_sub_multiples(COMP Fw[], - int pmin, int pmax, float gmax, int gmax_bin, - float *prev_f0); +float post_process_sub_multiples(COMP Fw[], int pmin, int pmax, float gmax, + int gmax_bin, float *prev_f0); static void fdmdv_16_to_8(float out8k[], float in16k[], int n); /*---------------------------------------------------------------------------*\ @@ -144,56 +108,53 @@ static void fdmdv_16_to_8(float out8k[], float in16k[], int n); \*---------------------------------------------------------------------------*/ -void *nlp_create(C2CONST *c2const) -{ - NLP *nlp; - int i; - int m = c2const->m_pitch; - int Fs = c2const->Fs; +void *nlp_create(C2CONST *c2const) { + NLP *nlp; + int i; + int m = c2const->m_pitch; + int Fs = c2const->Fs; + + nlp = (NLP *)malloc(sizeof(NLP)); + if (nlp == NULL) return NULL; - nlp = (NLP*)malloc(sizeof(NLP)); - if (nlp == NULL) - return NULL; + assert((Fs == 8000) || (Fs == 16000)); + nlp->Fs = Fs; - assert((Fs == 8000) || (Fs == 16000)); - nlp->Fs = Fs; + nlp->m = m; - nlp->m = m; + /* if running at 16kHz allocate storage for decimating filter memory */ - /* if running at 16kHz allocate storage for decimating filter memory */ + if (Fs == 16000) { + nlp->Sn16k = + (float *)malloc(sizeof(float) * (FDMDV_OS_TAPS_16K + c2const->n_samp)); + for (i = 0; i < FDMDV_OS_TAPS_16K; i++) { + nlp->Sn16k[i] = 0.0; + } + if (nlp->Sn16k == NULL) { + free(nlp); + return NULL; + } - if (Fs == 16000) { - nlp->Sn16k = (float*)malloc(sizeof(float)*(FDMDV_OS_TAPS_16K + c2const->n_samp)); - for(i=0; iSn16k[i] = 0.0; - } - if (nlp->Sn16k == NULL) { - free(nlp); - return NULL; - } + /* most processing occurs at 8 kHz sample rate so halve m */ - /* most processing occurs at 8 kHz sample rate so halve m */ + m /= 2; + } - m /= 2; - } + assert(m <= PMAX_M); - assert(m <= PMAX_M); - - for(i=0; iw[i] = 0.5 - 0.5*cosf(2*PI*i/(m/DEC-1)); - } + for (i = 0; i < m / DEC; i++) { + nlp->w[i] = 0.5 - 0.5 * cosf(2 * PI * i / (m / DEC - 1)); + } - for(i=0; isq[i] = 0.0; - nlp->mem_x = 0.0; - nlp->mem_y = 0.0; - for(i=0; imem_fir[i] = 0.0; + for (i = 0; i < PMAX_M; i++) nlp->sq[i] = 0.0; + nlp->mem_x = 0.0; + nlp->mem_y = 0.0; + for (i = 0; i < NLP_NTAP; i++) nlp->mem_fir[i] = 0.0; - nlp->fft_cfg = codec2_fft_alloc (PE_FFT_SIZE, 0, NULL, NULL); - assert(nlp->fft_cfg != NULL); + nlp->fft_cfg = codec2_fft_alloc(PE_FFT_SIZE, 0, NULL, NULL); + assert(nlp->fft_cfg != NULL); - return (void*)nlp; + return (void *)nlp; } /*---------------------------------------------------------------------------*\ @@ -204,17 +165,16 @@ void *nlp_create(C2CONST *c2const) \*---------------------------------------------------------------------------*/ -void nlp_destroy(void *nlp_state) -{ - NLP *nlp; - assert(nlp_state != NULL); - nlp = (NLP*)nlp_state; +void nlp_destroy(void *nlp_state) { + NLP *nlp; + assert(nlp_state != NULL); + nlp = (NLP *)nlp_state; - codec2_fft_free(nlp->fft_cfg); - if (nlp->Fs == 16000) { - free(nlp->Sn16k); - } - free(nlp_state); + codec2_fft_free(nlp->fft_cfg); + if (nlp->Fs == 16000) { + free(nlp->Sn16k); + } + free(nlp_state); } /*---------------------------------------------------------------------------*\ @@ -248,162 +208,157 @@ void nlp_destroy(void *nlp_state) \*---------------------------------------------------------------------------*/ float nlp( - void *nlp_state, - float Sn[], /* input speech vector */ - int n, /* frames shift (no. new samples in Sn[]) */ - float *pitch, /* estimated pitch period in samples at current Fs */ - COMP Sw[], /* Freq domain version of Sn[] */ - float W[], /* Freq domain window */ - float *prev_f0 /* previous pitch f0 in Hz, memory for pitch tracking */ -) -{ - NLP *nlp; - float notch; /* current notch filter output */ - COMP Fw[PE_FFT_SIZE]; /* DFT of squared signal (input/output) */ - float gmax; - int gmax_bin; - int m, i, j; - float best_f0; - PROFILE_VAR(start, tnotch, filter, peakpick, window, fft, magsq, shiftmem); - - assert(nlp_state != NULL); - nlp = (NLP*)nlp_state; - m = nlp->m; - - /* Square, notch filter at DC, and LP filter vector */ - - /* If running at 16 kHz decimate to 8 kHz, as NLP ws designed for - Fs = 8kHz. The decimating filter introduces about 3ms of delay, - that shouldn't be a problem as pitch changes slowly. */ - - if (nlp->Fs == 8000) { - /* Square latest input samples */ - - for(i=m-n; isq[i] = Sn[i]*Sn[i]; - } + void *nlp_state, float Sn[], /* input speech vector */ + int n, /* frames shift (no. new samples in Sn[]) */ + float *pitch, /* estimated pitch period in samples at current Fs */ + COMP Sw[], /* Freq domain version of Sn[] */ + float W[], /* Freq domain window */ + float *prev_f0 /* previous pitch f0 in Hz, memory for pitch tracking */ +) { + NLP *nlp; + float notch; /* current notch filter output */ + COMP Fw[PE_FFT_SIZE]; /* DFT of squared signal (input/output) */ + float gmax; + int gmax_bin; + int m, i, j; + float best_f0; + PROFILE_VAR(start, tnotch, filter, peakpick, window, fft, magsq, shiftmem); + + assert(nlp_state != NULL); + nlp = (NLP *)nlp_state; + m = nlp->m; + + /* Square, notch filter at DC, and LP filter vector */ + + /* If running at 16 kHz decimate to 8 kHz, as NLP ws designed for + Fs = 8kHz. The decimating filter introduces about 3ms of delay, + that shouldn't be a problem as pitch changes slowly. */ + + if (nlp->Fs == 8000) { + /* Square latest input samples */ + + for (i = m - n; i < m; i++) { + nlp->sq[i] = Sn[i] * Sn[i]; } - else { - assert(nlp->Fs == 16000); - - /* re-sample at 8 KHz */ - - for(i=0; iSn16k[FDMDV_OS_TAPS_16K+i] = Sn[m-n+i]; - } - - m /= 2; n /= 2; + } else { + assert(nlp->Fs == 16000); - float Sn8k[n]; - fdmdv_16_to_8(Sn8k, &nlp->Sn16k[FDMDV_OS_TAPS_16K], n); + /* re-sample at 8 KHz */ - /* Square latest input samples */ - - for(i=m-n, j=0; isq[i] = Sn8k[j]*Sn8k[j]; - } - assert(j <= n); - } - //fprintf(stderr, "n: %d m: %d\n", n, m); - - PROFILE_SAMPLE(start); - - for(i=m-n; isq[i] - nlp->mem_x; - notch += COEFF*nlp->mem_y; - nlp->mem_x = nlp->sq[i]; - nlp->mem_y = notch; - nlp->sq[i] = notch + 1.0; /* With 0 input vectors to codec, - kiss_fft() would take a long - time to execute when running in - real time. Problem was traced - to kiss_fft function call in - this function. Adding this small - constant fixed problem. Not - exactly sure why. */ + for (i = 0; i < n; i++) { + nlp->Sn16k[FDMDV_OS_TAPS_16K + i] = Sn[m - n + i]; } - PROFILE_SAMPLE_AND_LOG(tnotch, start, " square and notch"); + m /= 2; + n /= 2; - for(i=m-n; iSn16k[FDMDV_OS_TAPS_16K], n); - for(j=0; jmem_fir[j] = nlp->mem_fir[j+1]; - nlp->mem_fir[NLP_NTAP-1] = nlp->sq[i]; + /* Square latest input samples */ - nlp->sq[i] = 0.0; - for(j=0; jsq[i] += nlp->mem_fir[j]*nlp_fir[j]; + for (i = m - n, j = 0; i < m; i++, j++) { + nlp->sq[i] = Sn8k[j] * Sn8k[j]; } - - PROFILE_SAMPLE_AND_LOG(filter, tnotch, " filter"); - - /* Decimate and DFT */ - - for(i=0; isq[i*DEC]*nlp->w[i]; - } - PROFILE_SAMPLE_AND_LOG(window, filter, " window"); - #ifdef DUMP - dump_dec(Fw); - #endif - - // FIXME: check if this can be converted to a real fft - // since all imag inputs are 0 - codec2_fft_inplace(nlp->fft_cfg, Fw); - PROFILE_SAMPLE_AND_LOG(fft, window, " fft"); - - for(i=0; isq); - dump_Fw(Fw); - #endif - - /* todo: express everything in f0, as pitch in samples is dep on Fs */ - - int pmin = floor(SAMPLE_RATE*P_MIN_S); - int pmax = floor(SAMPLE_RATE*P_MAX_S); - - /* find global peak */ - - gmax = 0.0; - gmax_bin = PE_FFT_SIZE*DEC/pmax; - for(i=PE_FFT_SIZE*DEC/pmax; i<=PE_FFT_SIZE*DEC/pmin; i++) { - if (Fw[i].real > gmax) { - gmax = Fw[i].real; - gmax_bin = i; - } + assert(j <= n); + } + // fprintf(stderr, "n: %d m: %d\n", n, m); + + PROFILE_SAMPLE(start); + + for (i = m - n; i < m; i++) { /* notch filter at DC */ + notch = nlp->sq[i] - nlp->mem_x; + notch += COEFF * nlp->mem_y; + nlp->mem_x = nlp->sq[i]; + nlp->mem_y = notch; + nlp->sq[i] = notch + 1.0; /* With 0 input vectors to codec, + kiss_fft() would take a long + time to execute when running in + real time. Problem was traced + to kiss_fft function call in + this function. Adding this small + constant fixed problem. Not + exactly sure why. */ + } + + PROFILE_SAMPLE_AND_LOG(tnotch, start, " square and notch"); + + for (i = m - n; i < m; i++) { /* FIR filter vector */ + + for (j = 0; j < NLP_NTAP - 1; j++) nlp->mem_fir[j] = nlp->mem_fir[j + 1]; + nlp->mem_fir[NLP_NTAP - 1] = nlp->sq[i]; + + nlp->sq[i] = 0.0; + for (j = 0; j < NLP_NTAP; j++) nlp->sq[i] += nlp->mem_fir[j] * nlp_fir[j]; + } + + PROFILE_SAMPLE_AND_LOG(filter, tnotch, " filter"); + + /* Decimate and DFT */ + + for (i = 0; i < PE_FFT_SIZE; i++) { + Fw[i].real = 0.0; + Fw[i].imag = 0.0; + } + for (i = 0; i < m / DEC; i++) { + Fw[i].real = nlp->sq[i * DEC] * nlp->w[i]; + } + PROFILE_SAMPLE_AND_LOG(window, filter, " window"); +#ifdef DUMP + dump_dec(Fw); +#endif + + // FIXME: check if this can be converted to a real fft + // since all imag inputs are 0 + codec2_fft_inplace(nlp->fft_cfg, Fw); + PROFILE_SAMPLE_AND_LOG(fft, window, " fft"); + + for (i = 0; i < PE_FFT_SIZE; i++) + Fw[i].real = Fw[i].real * Fw[i].real + Fw[i].imag * Fw[i].imag; + + PROFILE_SAMPLE_AND_LOG(magsq, fft, " mag sq"); +#ifdef DUMP + dump_sq(m, nlp->sq); + dump_Fw(Fw); +#endif + + /* todo: express everything in f0, as pitch in samples is dep on Fs */ + + int pmin = floor(SAMPLE_RATE * P_MIN_S); + int pmax = floor(SAMPLE_RATE * P_MAX_S); + + /* find global peak */ + + gmax = 0.0; + gmax_bin = PE_FFT_SIZE * DEC / pmax; + for (i = PE_FFT_SIZE * DEC / pmax; i <= PE_FFT_SIZE * DEC / pmin; i++) { + if (Fw[i].real > gmax) { + gmax = Fw[i].real; + gmax_bin = i; } + } - PROFILE_SAMPLE_AND_LOG(peakpick, magsq, " peak pick"); + PROFILE_SAMPLE_AND_LOG(peakpick, magsq, " peak pick"); - best_f0 = post_process_sub_multiples(Fw, pmin, pmax, gmax, gmax_bin, prev_f0); + best_f0 = post_process_sub_multiples(Fw, pmin, pmax, gmax, gmax_bin, prev_f0); - PROFILE_SAMPLE_AND_LOG(shiftmem, peakpick, " post process"); + PROFILE_SAMPLE_AND_LOG(shiftmem, peakpick, " post process"); - /* Shift samples in buffer to make room for new samples */ + /* Shift samples in buffer to make room for new samples */ - for(i=0; isq[i] = nlp->sq[i+n]; + for (i = 0; i < m - n; i++) nlp->sq[i] = nlp->sq[i + n]; - /* return pitch period in samples and F0 estimate */ + /* return pitch period in samples and F0 estimate */ - *pitch = (float)nlp->Fs/best_f0; + *pitch = (float)nlp->Fs / best_f0; - PROFILE_SAMPLE_AND_LOG2(shiftmem, " shift mem"); + PROFILE_SAMPLE_AND_LOG2(shiftmem, " shift mem"); - PROFILE_SAMPLE_AND_LOG2(start, " nlp int"); + PROFILE_SAMPLE_AND_LOG2(start, " nlp int"); - *prev_f0 = best_f0; + *prev_f0 = best_f0; - return(best_f0); + return (best_f0); } /*---------------------------------------------------------------------------*\ @@ -427,59 +382,55 @@ float nlp( \*---------------------------------------------------------------------------*/ -float post_process_sub_multiples(COMP Fw[], - int pmin, int pmax, float gmax, int gmax_bin, - float *prev_f0) -{ - int min_bin, cmax_bin; - int mult; - float thresh, best_f0; - int b, bmin, bmax, lmax_bin; - float lmax; - int prev_f0_bin; - - /* post process estimate by searching submultiples */ - - mult = 2; - min_bin = PE_FFT_SIZE*DEC/pmax; - cmax_bin = gmax_bin; - prev_f0_bin = *prev_f0*(PE_FFT_SIZE*DEC)/SAMPLE_RATE; - - while(gmax_bin/mult >= min_bin) { - - b = gmax_bin/mult; /* determine search interval */ - bmin = 0.8*b; - bmax = 1.2*b; - if (bmin < min_bin) - bmin = min_bin; - - /* lower threshold to favour previous frames pitch estimate, - this is a form of pitch tracking */ - - if ((prev_f0_bin > bmin) && (prev_f0_bin < bmax)) - thresh = CNLP*0.5*gmax; - else - thresh = CNLP*gmax; - - lmax = 0; - lmax_bin = bmin; - for (b=bmin; b<=bmax; b++) /* look for maximum in interval */ - if (Fw[b].real > lmax) { - lmax = Fw[b].real; - lmax_bin = b; - } - - if (lmax > thresh) - if ((lmax > Fw[lmax_bin-1].real) && (lmax > Fw[lmax_bin+1].real)) { - cmax_bin = lmax_bin; - } - - mult++; - } - - best_f0 = (float)cmax_bin*SAMPLE_RATE/(PE_FFT_SIZE*DEC); - - return best_f0; +float post_process_sub_multiples(COMP Fw[], int pmin, int pmax, float gmax, + int gmax_bin, float *prev_f0) { + int min_bin, cmax_bin; + int mult; + float thresh, best_f0; + int b, bmin, bmax, lmax_bin; + float lmax; + int prev_f0_bin; + + /* post process estimate by searching submultiples */ + + mult = 2; + min_bin = PE_FFT_SIZE * DEC / pmax; + cmax_bin = gmax_bin; + prev_f0_bin = *prev_f0 * (PE_FFT_SIZE * DEC) / SAMPLE_RATE; + + while (gmax_bin / mult >= min_bin) { + b = gmax_bin / mult; /* determine search interval */ + bmin = 0.8 * b; + bmax = 1.2 * b; + if (bmin < min_bin) bmin = min_bin; + + /* lower threshold to favour previous frames pitch estimate, + this is a form of pitch tracking */ + + if ((prev_f0_bin > bmin) && (prev_f0_bin < bmax)) + thresh = CNLP * 0.5 * gmax; + else + thresh = CNLP * gmax; + + lmax = 0; + lmax_bin = bmin; + for (b = bmin; b <= bmax; b++) /* look for maximum in interval */ + if (Fw[b].real > lmax) { + lmax = Fw[b].real; + lmax_bin = b; + } + + if (lmax > thresh) + if ((lmax > Fw[lmax_bin - 1].real) && (lmax > Fw[lmax_bin + 1].real)) { + cmax_bin = lmax_bin; + } + + mult++; + } + + best_f0 = (float)cmax_bin * SAMPLE_RATE / (PE_FFT_SIZE * DEC); + + return best_f0; } /*---------------------------------------------------------------------------*\ @@ -502,20 +453,18 @@ float post_process_sub_multiples(COMP Fw[], \*---------------------------------------------------------------------------*/ -static void fdmdv_16_to_8(float out8k[], float in16k[], int n) -{ - float acc; - int i,j,k; +static void fdmdv_16_to_8(float out8k[], float in16k[], int n) { + float acc; + int i, j, k; - for(i=0, k=0; k. */ +#include + #include "defines.h" #include "quantise.h" -#include /* Compile-time constants */ /* Size of unsigned char in bits. Assumes 8 bits-per-char. */ -static const unsigned int WordSize = 8; +static const unsigned int WordSize = 8; /* Mask to pick the bit component out of bitIndex. */ -static const unsigned int IndexMask = 0x7; +static const unsigned int IndexMask = 0x7; /* Used to pick the word component out of bitIndex. */ -static const unsigned int ShiftRight = 3; +static const unsigned int ShiftRight = 3; /** Pack a bit field into a bit string, encoding the field in Gray code. * @@ -44,86 +45,76 @@ static const unsigned int ShiftRight = 3; * compatibility with the rest of the code, indices are always expected to * be >= 0. */ -void -pack( - unsigned char * bitArray, /* The output bit string. */ - unsigned int * bitIndex, /* Index into the string in BITS, not bytes.*/ - int field, /* The bit field to be packed. */ - unsigned int fieldWidth/* Width of the field in BITS, not bytes. */ - ) -{ - pack_natural_or_gray(bitArray, bitIndex, field, fieldWidth, 1); +void pack(unsigned char* bitArray, /* The output bit string. */ + unsigned int* bitIndex, /* Index into the string in BITS, not bytes.*/ + int field, /* The bit field to be packed. */ + unsigned int fieldWidth /* Width of the field in BITS, not bytes. */ +) { + pack_natural_or_gray(bitArray, bitIndex, field, fieldWidth, 1); } -void -pack_natural_or_gray( - unsigned char * bitArray, /* The output bit string. */ - unsigned int * bitIndex, /* Index into the string in BITS, not bytes.*/ - int field, /* The bit field to be packed. */ - unsigned int fieldWidth,/* Width of the field in BITS, not bytes. */ - unsigned int gray /* non-zero for gray coding */ - ) -{ +void pack_natural_or_gray( + unsigned char* bitArray, /* The output bit string. */ + unsigned int* bitIndex, /* Index into the string in BITS, not bytes.*/ + int field, /* The bit field to be packed. */ + unsigned int fieldWidth, /* Width of the field in BITS, not bytes. */ + unsigned int gray /* non-zero for gray coding */ +) { if (gray) { /* Convert the field to Gray code */ field = (field >> 1) ^ field; } do { - unsigned int bI = *bitIndex; - unsigned int bitsLeft = WordSize - (bI & IndexMask); - unsigned int sliceWidth = - bitsLeft < fieldWidth ? bitsLeft : fieldWidth; - unsigned int wordIndex = bI >> ShiftRight; + unsigned int bI = *bitIndex; + unsigned int bitsLeft = WordSize - (bI & IndexMask); + unsigned int sliceWidth = bitsLeft < fieldWidth ? bitsLeft : fieldWidth; + unsigned int wordIndex = bI >> ShiftRight; - bitArray[wordIndex] |= - ((unsigned char)((field >> (fieldWidth - sliceWidth)) - << (bitsLeft - sliceWidth))); + bitArray[wordIndex] |= ((unsigned char)((field >> (fieldWidth - sliceWidth)) + << (bitsLeft - sliceWidth))); *bitIndex = bI + sliceWidth; fieldWidth -= sliceWidth; - } while ( fieldWidth != 0 ); + } while (fieldWidth != 0); } /** Unpack a field from a bit string, converting from Gray code to binary. * */ -int -unpack( - const unsigned char * bitArray, /* The input bit string. */ - unsigned int * bitIndex, /* Index into the string in BITS, not bytes.*/ - unsigned int fieldWidth/* Width of the field in BITS, not bytes. */ - ) -{ - return unpack_natural_or_gray(bitArray, bitIndex, fieldWidth, 1); +int unpack( + const unsigned char* bitArray, /* The input bit string. */ + unsigned int* bitIndex, /* Index into the string in BITS, not bytes.*/ + unsigned int fieldWidth /* Width of the field in BITS, not bytes. */ +) { + return unpack_natural_or_gray(bitArray, bitIndex, fieldWidth, 1); } /** Unpack a field from a bit string, to binary, optionally using * natural or Gray code. * */ -int -unpack_natural_or_gray( - const unsigned char * bitArray, /* The input bit string. */ - unsigned int * bitIndex, /* Index into the string in BITS, not bytes.*/ - unsigned int fieldWidth,/* Width of the field in BITS, not bytes. */ - unsigned int gray /* non-zero for Gray coding */ - ) -{ - unsigned int field = 0; - unsigned int t; +int unpack_natural_or_gray( + const unsigned char* bitArray, /* The input bit string. */ + unsigned int* bitIndex, /* Index into the string in BITS, not bytes.*/ + unsigned int fieldWidth, /* Width of the field in BITS, not bytes. */ + unsigned int gray /* non-zero for Gray coding */ +) { + unsigned int field = 0; + unsigned int t; do { - unsigned int bI = *bitIndex; - unsigned int bitsLeft = WordSize - (bI & IndexMask); - unsigned int sliceWidth = - bitsLeft < fieldWidth ? bitsLeft : fieldWidth; + unsigned int bI = *bitIndex; + unsigned int bitsLeft = WordSize - (bI & IndexMask); + unsigned int sliceWidth = bitsLeft < fieldWidth ? bitsLeft : fieldWidth; - field |= (((bitArray[bI >> ShiftRight] >> (bitsLeft - sliceWidth)) & ((1 << sliceWidth) - 1)) << (fieldWidth - sliceWidth)); + field |= (((bitArray[bI >> ShiftRight] >> (bitsLeft - sliceWidth)) & + ((1 << sliceWidth) - 1)) + << (fieldWidth - sliceWidth)); *bitIndex = bI + sliceWidth; fieldWidth -= sliceWidth; - } while ( fieldWidth != 0 ); + } while (fieldWidth != 0); if (gray) { /* Convert from Gray code to binary. Works for maximum 8-bit fields. */ @@ -131,8 +122,7 @@ unpack_natural_or_gray( t ^= (t >> 4); t ^= (t >> 2); t ^= (t >> 1); - } - else { + } else { t = field; } diff --git a/phase.c b/phase.c index e486613..dec8793 100644 --- a/phase.c +++ b/phase.c @@ -25,18 +25,19 @@ along with this program; if not,see . */ -#include "defines.h" #include "phase.h" -#include "kiss_fft.h" -#include "comp.h" -#include "comp_prim.h" -#include "sine.h" #include #include #include -#include #include +#include + +#include "comp.h" +#include "comp_prim.h" +#include "defines.h" +#include "kiss_fft.h" +#include "sine.h" /*---------------------------------------------------------------------------*\ @@ -47,25 +48,23 @@ \*---------------------------------------------------------------------------*/ -void sample_phase(MODEL *model, - COMP H[], - COMP A[] /* LPC analysis filter in freq domain */ - ) -{ - int m, b; - float r; +void sample_phase(MODEL *model, COMP H[], + COMP A[] /* LPC analysis filter in freq domain */ +) { + int m, b; + float r; - r = TWO_PI/(FFT_ENC); + r = TWO_PI / (FFT_ENC); - /* Sample phase at harmonics */ + /* Sample phase at harmonics */ - for(m=1; m<=model->L; m++) { - b = (int)(m*model->Wo/r + 0.5); - H[m] = cconj(A[b]); /* synth filter 1/A is opposite phase to analysis filter */ - } + for (m = 1; m <= model->L; m++) { + b = (int)(m * model->Wo / r + 0.5); + H[m] = + cconj(A[b]); /* synth filter 1/A is opposite phase to analysis filter */ + } } - /*---------------------------------------------------------------------------*\ phase_synth_zero_order() @@ -158,64 +157,56 @@ void sample_phase(MODEL *model, \*---------------------------------------------------------------------------*/ void phase_synth_zero_order( - int n_samp, - MODEL *model, - float *ex_phase, /* excitation phase of fundamental */ - COMP H[] /* L synthesis filter freq domain samples */ - -) -{ - int m; - float new_phi; - COMP Ex[MAX_AMP+1]; /* excitation samples */ - COMP A_[MAX_AMP+1]; /* synthesised harmonic samples */ - - /* - Update excitation fundamental phase track, this sets the position - of each pitch pulse during voiced speech. After much experiment - I found that using just this frame's Wo improved quality for UV - sounds compared to interpolating two frames Wo like this: - - ex_phase[0] += (*prev_Wo+model->Wo)*N_SAMP/2; - */ - - ex_phase[0] += (model->Wo)*n_samp; - ex_phase[0] -= TWO_PI*floorf(ex_phase[0]/TWO_PI + 0.5); - - for(m=1; m<=model->L; m++) { - - /* generate excitation */ - - if (model->voiced) { - - Ex[m].real = cosf(ex_phase[0]*m); - Ex[m].imag = sinf(ex_phase[0]*m); - } - else { - - /* When a few samples were tested I found that LPC filter - phase is not needed in the unvoiced case, but no harm in - keeping it. - */ - float phi = TWO_PI*(float)codec2_rand()/CODEC2_RAND_MAX; - Ex[m].real = cosf(phi); - Ex[m].imag = sinf(phi); - } - - /* filter using LPC filter */ + int n_samp, MODEL *model, + float *ex_phase, /* excitation phase of fundamental */ + COMP H[] /* L synthesis filter freq domain samples */ + +) { + int m; + float new_phi; + COMP Ex[MAX_AMP + 1]; /* excitation samples */ + COMP A_[MAX_AMP + 1]; /* synthesised harmonic samples */ + + /* + Update excitation fundamental phase track, this sets the position + of each pitch pulse during voiced speech. After much experiment + I found that using just this frame's Wo improved quality for UV + sounds compared to interpolating two frames Wo like this: + + ex_phase[0] += (*prev_Wo+model->Wo)*N_SAMP/2; + */ + + ex_phase[0] += (model->Wo) * n_samp; + ex_phase[0] -= TWO_PI * floorf(ex_phase[0] / TWO_PI + 0.5); + + for (m = 1; m <= model->L; m++) { + /* generate excitation */ + + if (model->voiced) { + Ex[m].real = cosf(ex_phase[0] * m); + Ex[m].imag = sinf(ex_phase[0] * m); + } else { + /* When a few samples were tested I found that LPC filter + phase is not needed in the unvoiced case, but no harm in + keeping it. + */ + float phi = TWO_PI * (float)codec2_rand() / CODEC2_RAND_MAX; + Ex[m].real = cosf(phi); + Ex[m].imag = sinf(phi); + } - A_[m].real = H[m].real*Ex[m].real - H[m].imag*Ex[m].imag; - A_[m].imag = H[m].imag*Ex[m].real + H[m].real*Ex[m].imag; + /* filter using LPC filter */ - /* modify sinusoidal phase */ + A_[m].real = H[m].real * Ex[m].real - H[m].imag * Ex[m].imag; + A_[m].imag = H[m].imag * Ex[m].real + H[m].real * Ex[m].imag; - new_phi = atan2f(A_[m].imag, A_[m].real+1E-12); - model->phi[m] = new_phi; - } + /* modify sinusoidal phase */ + new_phi = atan2f(A_[m].imag, A_[m].real + 1E-12); + model->phi[m] = new_phi; + } } - /*---------------------------------------------------------------------------*\ FUNCTION....: mag_to_phase @@ -230,60 +221,55 @@ void phase_synth_zero_order( \*---------------------------------------------------------------------------*/ -void mag_to_phase(float phase[], /* Nfft/2+1 output phase samples in radians */ - float Gdbfk[], /* Nfft/2+1 postive freq amplitudes samples in dB */ - int Nfft, - codec2_fft_cfg fft_fwd_cfg, - codec2_fft_cfg fft_inv_cfg - ) -{ - COMP Sdb[Nfft], c[Nfft], cf[Nfft], Cf[Nfft]; - int Ns = Nfft/2+1; - int i; - - /* install negative frequency components, 1/Nfft takes into - account kiss fft lack of scaling on ifft */ - - Sdb[0].real = Gdbfk[0]; - Sdb[0].imag = 0.0; - for(i=1; i. */ +#include "postfilter.h" + #include -#include -#include #include +#include +#include -#include "defines.h" #include "comp.h" +#include "defines.h" #include "dump.h" #include "sine.h" -#include "postfilter.h" /*---------------------------------------------------------------------------*\ @@ -44,13 +45,14 @@ \*---------------------------------------------------------------------------*/ -#define BG_THRESH 40.0 /* only consider low levels signals for bg_est */ -#define BG_BETA 0.1 /* averaging filter constant */ -#define BG_MARGIN 6.0 /* harmonics this far above BG noise are - randomised. Helped make bg noise less - spikey (impulsive) for mmt1, but speech was - perhaps a little rougher. - */ +#define BG_THRESH 40.0 /* only consider low levels signals for bg_est */ +#define BG_BETA 0.1 /* averaging filter constant */ +#define BG_MARGIN \ + 6.0 /* harmonics this far above BG noise are \ + randomised. Helped make bg noise less \ + spikey (impulsive) for mmt1, but speech was \ + perhaps a little rougher. \ + */ /*---------------------------------------------------------------------------*\ @@ -82,7 +84,7 @@ 1/ If someone says "aaaaaaaahhhhhhhhh" will background estimator track up to speech level? This would be a bad thing. - 2/ If background noise suddenly dissapears from the source speech does + 2/ If background noise suddenly disappears from the source speech does estimate drop quickly? What is noise suddenly re-appears? 3/ Background noise with a non-flat sepctrum. Current algorithm just @@ -98,45 +100,39 @@ \*---------------------------------------------------------------------------*/ -void postfilter( - MODEL *model, - float *bg_est -) -{ - int m, uv; +void postfilter(MODEL *model, float *bg_est) { + int m, uv; float e, thresh; /* determine average energy across spectrum */ e = 1E-12; - for(m=1; m<=model->L; m++) - e += model->A[m]*model->A[m]; + for (m = 1; m <= model->L; m++) e += model->A[m] * model->A[m]; assert(e > 0.0); - e = 10.0*log10f(e/model->L); + e = 10.0 * log10f(e / model->L); - /* If beneath threhold, update bg estimate. The idea + /* If beneath threshold, update bg estimate. The idea of the threshold is to prevent updating during high level speech. */ if ((e < BG_THRESH) && !model->voiced) - *bg_est = *bg_est*(1.0 - BG_BETA) + e*BG_BETA; + *bg_est = *bg_est * (1.0 - BG_BETA) + e * BG_BETA; /* now mess with phases during voiced frames to make any harmonics less then our background estimate unvoiced. */ uv = 0; - thresh = POW10F((*bg_est + BG_MARGIN)/20.0); + thresh = POW10F((*bg_est + BG_MARGIN) / 20.0); if (model->voiced) - for(m=1; m<=model->L; m++) - if (model->A[m] < thresh) { - model->phi[m] = (TWO_PI/CODEC2_RAND_MAX)*(float)codec2_rand(); - uv++; - } + for (m = 1; m <= model->L; m++) + if (model->A[m] < thresh) { + model->phi[m] = (TWO_PI / CODEC2_RAND_MAX) * (float)codec2_rand(); + uv++; + } #ifdef DUMP - dump_bg(e, *bg_est, 100.0*uv/model->L); + dump_bg(e, *bg_est, 100.0 * uv / model->L); #endif - } diff --git a/postfilter.h b/postfilter.h index 156714e..ecf7f39 100644 --- a/postfilter.h +++ b/postfilter.h @@ -28,6 +28,8 @@ #ifndef __POSTFILTER__ #define __POSTFILTER__ +#include "defines.h" + void postfilter(MODEL *model, float *bg_est); #endif diff --git a/quantise.c b/quantise.c index 37bf8be..da1d821 100644 --- a/quantise.c +++ b/quantise.c @@ -24,26 +24,27 @@ */ +#include "quantise.h" + #include #include +#include #include #include #include -#include +#include "codec2_fft.h" #include "defines.h" #include "dump.h" -#include "quantise.h" #include "lpc.h" #include "lsp.h" -#include "codec2_fft.h" -#include "phase.h" #include "mbest.h" +#include "phase.h" #undef PROFILE #include "machdep.h" -#define LSP_DELTA1 0.01 /* grid spacing for LSP root searches */ +#define LSP_DELTA1 0.01 /* grid spacing for LSP root searches */ /*---------------------------------------------------------------------------*\ @@ -52,7 +53,7 @@ \*---------------------------------------------------------------------------*/ float speech_to_uq_lsps(float lsp[], float ak[], float Sn[], float w[], - int m_pitch, int order); + int m_pitch, int order); /*---------------------------------------------------------------------------*\ @@ -60,46 +61,11 @@ float speech_to_uq_lsps(float lsp[], float ak[], float Sn[], float w[], \*---------------------------------------------------------------------------*/ -int lsp_bits(int i) { - return lsp_cb[i].log2m; -} +int lsp_bits(int i) { return lsp_cb[i].log2m; } -int lspd_bits(int i) { - return lsp_cbd[i].log2m; -} +int lspd_bits(int i) { return lsp_cbd[i].log2m; } -#ifndef CORTEX_M4 -int mel_bits(int i) { - return mel_cb[i].log2m; -} - -int lspmelvq_cb_bits(int i) { - return lspmelvq_cb[i].log2m; -} -#endif - -#ifdef __EXPERIMENTAL__ -int lspdt_bits(int i) { - return lsp_cbdt[i].log2m; -} -#endif - -int lsp_pred_vq_bits(int i) { - return lsp_cbjvm[i].log2m; -} - -/*---------------------------------------------------------------------------*\ - - quantise_init - - Loads the entire LSP quantiser comprised of several vector quantisers - (codebooks). - -\*---------------------------------------------------------------------------*/ - -void quantise_init() -{ -} +int lsp_pred_vq_bits(int i) { return lsp_cbjmv[i].log2m; } /*---------------------------------------------------------------------------*\ @@ -111,7 +77,7 @@ void quantise_init() \*---------------------------------------------------------------------------*/ -long quantise(const float * cb, float vec[], float w[], int k, int m, float *se) +long quantise(const float *cb, float vec[], float w[], int k, int m, float *se) /* float cb[][K]; current VQ codebook */ /* float vec[]; vector to quantise */ /* float w[]; weighting vector */ @@ -119,363 +85,123 @@ long quantise(const float * cb, float vec[], float w[], int k, int m, float *se) /* int m; size of codebook */ /* float *se; accumulated squared error */ { - float e; /* current error */ - long besti; /* best index so far */ - float beste; /* best error so far */ - long j; - int i; - float diff; - - besti = 0; - beste = 1E32; - for(j=0; jlist[j].index[0]; - for(i=0; ilist[j].index[1]; - index[1] = n2 = mbest_stage2->list[j].index[0]; - for(i=0; ilist[0].index[2]; - n2 = mbest_stage3->list[0].index[1]; - n3 = mbest_stage3->list[0].index[0]; - mse = 0.0; - for (i=0;i max_Rw) - max_Rw = Rw[i]; - if (Rw[i] < min_Rw) - min_Rw = Rw[i]; + for (i = 0; i < FFT_ENC / 2; i++) { + Ww[i].real = Ww[i].real * Ww[i].real + Ww[i].imag * Ww[i].imag; + } - } + PROFILE_SAMPLE_AND_LOG(tww, tfft2, " Ww"); - PROFILE_SAMPLE_AND_LOG(tr, tww, " R"); + /* Determined combined filter R = WA ---------------------------*/ - #ifdef DUMP - if (dump) - dump_Rw(Rw); - #endif + max_Rw = 0.0; + min_Rw = 1E32; + for (i = 0; i < FFT_ENC / 2; i++) { + Rw[i] = sqrtf(Ww[i].real * Pw[i]); + if (Rw[i] > max_Rw) max_Rw = Rw[i]; + if (Rw[i] < min_Rw) min_Rw = Rw[i]; + } - /* create post filter mag spectrum and apply ------------------*/ + PROFILE_SAMPLE_AND_LOG(tr, tww, " R"); - /* measure energy before post filtering */ +#ifdef DUMP + if (dump) dump_Rw(Rw); +#endif - e_before = 1E-4; - for(i=0; i 242 ms - // so please leave it as is or improve further - // since this code is called 4 times it results in almost 4ms gain (21ms -> 17ms per audio frame decode @ 1300 ) + // this difference may seem strange, but the gcc for STM32F4 generates almost + // 5 times faster code with the two loops: 1120 ms -> 242 ms so please leave + // it as is or improve further since this code is called 4 times it results in + // almost 4ms gain (21ms -> 17ms per audio frame decode @ 1300 ) - for(i=0; iL; m++) { - am = (int)((m - 0.5)*model->Wo/r + 0.5); - bm = (int)((m + 0.5)*model->Wo/r + 0.5); - - // FIXME: With arm_rfft_fast_f32 we have to use this - // otherwise sometimes a to high bm is calculated - // which causes trouble later in the calculation - // chain - // it seems for some reason model->Wo is calculated somewhat too high - if (bm>FFT_ENC/2) - { - bm = FFT_ENC/2; - } - Em = 0.0; - - for(i=am; iA[m]*model->A[m]; - noise += (model->A[m] - Am)*(model->A[m] - Am); - - /* This code significantly improves perf of LPC model, in - particular when combined with phase0. The LPC spectrum tends - to track just under the peaks of the spectral envelope, and - just above nulls. This algorithm does the reverse to - compensate - raising the amplitudes of spectral peaks, while - attenuating the null. This enhances the formants, and - supresses the energy between formants. */ - - if (sim_pf) { - if (Am > model->A[m]) - Am *= 0.7; - if (Am < model->A[m]) - Am *= 1.4; - } - model->A[m] = Am; + signal = 1E-30; + noise = 1E-32; + + for (m = 1; m <= model->L; m++) { + am = (int)((m - 0.5) * model->Wo / r + 0.5); + bm = (int)((m + 0.5) * model->Wo / r + 0.5); + + // FIXME: With arm_rfft_fast_f32 we have to use this + // otherwise sometimes a to high bm is calculated + // which causes trouble later in the calculation + // chain + // it seems for some reason model->Wo is calculated somewhat too high + if (bm > FFT_ENC / 2) { + bm = FFT_ENC / 2; + } + Em = 0.0; + + for (i = am; i < bm; i++) Em += Pw[i]; + Am = sqrtf(Em); + + signal += model->A[m] * model->A[m]; + noise += (model->A[m] - Am) * (model->A[m] - Am); + + /* This code significantly improves perf of LPC model, in + particular when combined with phase0. The LPC spectrum tends + to track just under the peaks of the spectral envelope, and + just above nulls. This algorithm does the reverse to + compensate - raising the amplitudes of spectral peaks, while + attenuating the null. This enhances the formants, and + suppresses the energy between formants. */ + + if (sim_pf) { + if (Am > model->A[m]) Am *= 0.7; + if (Am < model->A[m]) Am *= 1.4; + } + model->A[m] = Am; } - *snr = 10.0*log10f(signal/noise); + *snr = 10.0 * log10f(signal / noise); PROFILE_SAMPLE_AND_LOG2(tpf, " rec"); } @@ -983,19 +554,18 @@ void aks_to_M2( \*---------------------------------------------------------------------------*/ -int encode_Wo(C2CONST *c2const, float Wo, int bits) -{ - int index, Wo_levels = 1<Wo_min; - float Wo_max = c2const->Wo_max; - float norm; +int encode_Wo(C2CONST *c2const, float Wo, int bits) { + int index, Wo_levels = 1 << bits; + float Wo_min = c2const->Wo_min; + float Wo_max = c2const->Wo_max; + float norm; - norm = (Wo - Wo_min)/(Wo_max - Wo_min); - index = floorf(Wo_levels * norm + 0.5); - if (index < 0 ) index = 0; - if (index > (Wo_levels-1)) index = Wo_levels-1; + norm = (Wo - Wo_min) / (Wo_max - Wo_min); + index = floorf(Wo_levels * norm + 0.5); + if (index < 0) index = 0; + if (index > (Wo_levels - 1)) index = Wo_levels - 1; - return index; + return index; } /*---------------------------------------------------------------------------*\ @@ -1008,18 +578,17 @@ int encode_Wo(C2CONST *c2const, float Wo, int bits) \*---------------------------------------------------------------------------*/ -float decode_Wo(C2CONST *c2const, int index, int bits) -{ - float Wo_min = c2const->Wo_min; - float Wo_max = c2const->Wo_max; - float step; - float Wo; - int Wo_levels = 1<Wo_min; + float Wo_max = c2const->Wo_max; + float step; + float Wo; + int Wo_levels = 1 << bits; - step = (Wo_max - Wo_min)/Wo_levels; - Wo = Wo_min + step*(index); + step = (Wo_max - Wo_min) / Wo_levels; + Wo = Wo_min + step * (index); - return Wo; + return Wo; } /*---------------------------------------------------------------------------*\ @@ -1032,19 +601,18 @@ float decode_Wo(C2CONST *c2const, int index, int bits) \*---------------------------------------------------------------------------*/ -int encode_log_Wo(C2CONST *c2const, float Wo, int bits) -{ - int index, Wo_levels = 1<Wo_min; - float Wo_max = c2const->Wo_max; - float norm; +int encode_log_Wo(C2CONST *c2const, float Wo, int bits) { + int index, Wo_levels = 1 << bits; + float Wo_min = c2const->Wo_min; + float Wo_max = c2const->Wo_max; + float norm; - norm = (log10f(Wo) - log10f(Wo_min))/(log10f(Wo_max) - log10f(Wo_min)); - index = floorf(Wo_levels * norm + 0.5); - if (index < 0 ) index = 0; - if (index > (Wo_levels-1)) index = Wo_levels-1; + norm = (log10f(Wo) - log10f(Wo_min)) / (log10f(Wo_max) - log10f(Wo_min)); + index = floorf(Wo_levels * norm + 0.5); + if (index < 0) index = 0; + if (index > (Wo_levels - 1)) index = Wo_levels - 1; - return index; + return index; } /*---------------------------------------------------------------------------*\ @@ -1057,99 +625,18 @@ int encode_log_Wo(C2CONST *c2const, float Wo, int bits) \*---------------------------------------------------------------------------*/ -float decode_log_Wo(C2CONST *c2const, int index, int bits) -{ - float Wo_min = c2const->Wo_min; - float Wo_max = c2const->Wo_max; - float step; - float Wo; - int Wo_levels = 1<Wo_min; - float Wo_max = c2const->Wo_max; - float norm; - - norm = (Wo - prev_Wo)/(Wo_max - Wo_min); - index = floorf(WO_LEVELS * norm + 0.5); - //printf("ENC index: %d ", index); - - /* hard limit */ - - max_index = (1 << (WO_DT_BITS-1)) - 1; - min_index = - (max_index+1); - if (index > max_index) index = max_index; - if (index < min_index) index = min_index; - //printf("max_index: %d min_index: %d hard index: %d ", - // max_index, min_index, index); - - /* mask so that only LSB WO_DT_BITS remain, bit WO_DT_BITS is the sign bit */ - - mask = ((1 << WO_DT_BITS) - 1); - index &= mask; - //printf("mask: 0x%x index: 0x%x\n", mask, index); - - return index; -} - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: decode_Wo_dt() - AUTHOR......: David Rowe - DATE CREATED: 6 Nov 2011 - - Decodes Wo using WO_DT_BITS difference from last frame. - -\*---------------------------------------------------------------------------*/ - -float decode_Wo_dt(C2CONST *c2const, int index, float prev_Wo) -{ - float Wo_min = c2const->Wo_min; - float Wo_max = c2const->Wo_max; - float step; - float Wo; - int mask; - - /* sign extend index */ - - //printf("DEC index: %d "); - if (index & (1 << (WO_DT_BITS-1))) { - mask = ~((1 << WO_DT_BITS) - 1); - index |= mask; - } - //printf("DEC mask: 0x%x index: %d \n", mask, index); - - step = (Wo_max - Wo_min)/WO_LEVELS; - Wo = prev_Wo + step*(index); - - /* bit errors can make us go out of range leading to all sorts of - probs like seg faults */ +float decode_log_Wo(C2CONST *c2const, int index, int bits) { + float Wo_min = c2const->Wo_min; + float Wo_max = c2const->Wo_max; + float step; + float Wo; + int Wo_levels = 1 << bits; - if (Wo > Wo_max) Wo = Wo_max; - if (Wo < Wo_min) Wo = Wo_min; + step = (log10f(Wo_max) - log10f(Wo_min)) / Wo_levels; + Wo = log10f(Wo_min) + step * (index); - return Wo; + return POW10F(Wo); } -#endif /*---------------------------------------------------------------------------*\ @@ -1163,56 +650,46 @@ float decode_Wo_dt(C2CONST *c2const, int index, float prev_Wo) \*---------------------------------------------------------------------------*/ -float speech_to_uq_lsps(float lsp[], - float ak[], - float Sn[], - float w[], - int m_pitch, - int order -) -{ - int i, roots; - float Wn[m_pitch]; - float R[order+1]; - float e, E; - - e = 0.0; - for(i=0; iWo < (PI*150.0/4000)) { - model->A[1] *= 0.032; - } +void apply_lpc_correction(MODEL *model) { + if (model->Wo < (PI * 150.0 / 4000)) { + model->A[1] *= 0.032; + } } /*---------------------------------------------------------------------------*\ @@ -1774,124 +906,81 @@ void apply_lpc_correction(MODEL *model) \*---------------------------------------------------------------------------*/ -int encode_energy(float e, int bits) -{ - int index, e_levels = 1< (e_levels-1)) index = e_levels-1; - - return index; -} - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: decode_energy() - AUTHOR......: David Rowe - DATE CREATED: 22/8/2010 - - Decodes energy using a E_LEVELS quantiser. - -\*---------------------------------------------------------------------------*/ - -float decode_energy(int index, int bits) -{ - float e_min = E_MIN_DB; - float e_max = E_MAX_DB; - float step; - float e; - int e_levels = 1< (e_levels - 1)) index = e_levels - 1; - return e; + return index; } -#ifdef NOT_USED /*---------------------------------------------------------------------------*\ - FUNCTION....: decode_amplitudes() + FUNCTION....: decode_energy() AUTHOR......: David Rowe DATE CREATED: 22/8/2010 - Given the amplitude quantiser indexes recovers the harmonic - amplitudes. + Decodes energy using a E_LEVELS quantiser. \*---------------------------------------------------------------------------*/ -float decode_amplitudes(codec2_fft_cfg fft_fwd_cfg, - MODEL *model, - float ak[], - int lsp_indexes[], - int energy_index, - float lsps[], - float *e -) -{ - float snr; +float decode_energy(int index, int bits) { + float e_min = E_MIN_DB; + float e_max = E_MAX_DB; + float step; + float e; + int e_levels = 1 << bits; - decode_lsps_scalar(lsps, lsp_indexes, LPC_ORD); - bw_expand_lsps(lsps, LPC_ORD); - lsp_to_lpc(lsps, ak, LPC_ORD); - *e = decode_energy(energy_index); - aks_to_M2(ak, LPC_ORD, model, *e, &snr, 1, 0, 0, 1); - apply_lpc_correction(model); + step = (e_max - e_min) / e_levels; + e = e_min + step * (index); + e = POW10F(e / 10.0); - return snr; + return e; } -#endif static float ge_coeff[2] = {0.8, 0.9}; -void compute_weights2(const float *x, const float *xp, float *w) -{ +void compute_weights2(const float *x, const float *xp, float *w) { w[0] = 30; w[1] = 1; - if (x[1]<0) - { - w[0] *= .6; - w[1] *= .3; + if (x[1] < 0) { + w[0] *= .6; + w[1] *= .3; } - if (x[1]<-10) - { - w[0] *= .3; - w[1] *= .3; + if (x[1] < -10) { + w[0] *= .3; + w[1] *= .3; } /* Higher weight if pitch is stable */ - if (fabsf(x[0]-xp[0])<.2) - { - w[0] *= 2; - w[1] *= 1.5; - } else if (fabsf(x[0]-xp[0])>.5) /* Lower if not stable */ + if (fabsf(x[0] - xp[0]) < .2) { + w[0] *= 2; + w[1] *= 1.5; + } else if (fabsf(x[0] - xp[0]) > .5) /* Lower if not stable */ { - w[0] *= .5; + w[0] *= .5; } /* Lower weight for low energy */ - if (x[1] < xp[1]-10) - { - w[1] *= .5; + if (x[1] < xp[1] - 10) { + w[1] *= .5; } - if (x[1] < xp[1]-20) - { - w[1] *= .5; + if (x[1] < xp[1] - 20) { + w[1] *= .5; } - //w[0] = 30; - //w[1] = 1; + // w[0] = 30; + // w[1] = 1; /* Square the weights because it's applied on the squared error */ w[0] *= w[0]; w[1] *= w[1]; - } /*---------------------------------------------------------------------------*\ @@ -1906,7 +995,7 @@ void compute_weights2(const float *x, const float *xp, float *w) both the pitch and energy tend to only change by small amounts during voiced speech, however it is important that these changes be coded carefully. During unvoiced speech they both change a lot but - the ear is less sensitve to errors so coarser quantisation is OK. + the ear is less sensitive to errors so coarser quantisation is OK. The ear is sensitive to log energy and loq pitch so we quantise in these domains. That way the error measure used to quantise the @@ -1916,15 +1005,14 @@ void compute_weights2(const float *x, const float *xp, float *w) \*---------------------------------------------------------------------------*/ -void quantise_WoE(C2CONST *c2const, MODEL *model, float *e, float xq[]) -{ - int i, n1; - float x[2]; - float err[2]; - float w[2]; +void quantise_WoE(C2CONST *c2const, MODEL *model, float *e, float xq[]) { + int i, n1; + float x[2]; + float err[2]; + float w[2]; const float *codebook1 = ge_cb[0].cb; - int nb_entries = ge_cb[0].m; - int ndim = ge_cb[0].k; + int nb_entries = ge_cb[0].m; + int ndim = ge_cb[0].k; float Wo_min = c2const->Wo_min; float Wo_max = c2const->Wo_max; float Fs = c2const->Fs; @@ -1933,18 +1021,16 @@ void quantise_WoE(C2CONST *c2const, MODEL *model, float *e, float xq[]) assert(Fs == 8000); - x[0] = log10f((model->Wo/PI)*4000.0/50.0)/log10f(2); - x[1] = 10.0*log10f(1e-4 + *e); + x[0] = log10f((model->Wo / PI) * 4000.0 / 50.0) / log10f(2); + x[1] = 10.0 * log10f(1e-4 + *e); compute_weights2(x, xq, w); - for (i=0;iWo = powf(2.0, xq[0])*(PI*50.0)/4000.0; + model->Wo = powf(2.0, xq[0]) * (PI * 50.0) / 4000.0; /* bit errors can make us go out of range leading to all sorts of probs like seg faults */ @@ -1961,9 +1047,9 @@ void quantise_WoE(C2CONST *c2const, MODEL *model, float *e, float xq[]) if (model->Wo > Wo_max) model->Wo = Wo_max; if (model->Wo < Wo_min) model->Wo = Wo_min; - model->L = PI/model->Wo; /* if we quantise Wo re-compute L */ + model->L = PI / model->Wo; /* if we quantise Wo re-compute L */ - *e = POW10F(xq[1]/10.0); + *e = POW10F(xq[1] / 10.0); } /*---------------------------------------------------------------------------*\ @@ -1977,39 +1063,36 @@ void quantise_WoE(C2CONST *c2const, MODEL *model, float *e, float xq[]) \*---------------------------------------------------------------------------*/ -int encode_WoE(MODEL *model, float e, float xq[]) -{ - int i, n1; - float x[2]; - float err[2]; - float w[2]; +int encode_WoE(MODEL *model, float e, float xq[]) { + int i, n1; + float x[2]; + float err[2]; + float w[2]; const float *codebook1 = ge_cb[0].cb; - int nb_entries = ge_cb[0].m; - int ndim = ge_cb[0].k; + int nb_entries = ge_cb[0].m; + int ndim = ge_cb[0].k; - assert((1<Wo/PI)*4000.0/50.0)/log10f(2); - x[1] = 10.0*log10f(1e-4 + e); + x[0] = log10f((model->Wo / PI) * 4000.0 / 50.0) / log10f(2); + x[1] = 10.0 * log10f(1e-4 + e); compute_weights2(x, xq, w); - for (i=0;iWo_min; float Wo_max = c2const->Wo_max; - for (i=0;iWo = powf(2.0, xq[0])*(PI*50.0)/4000.0; + // printf("dec: %f %f\n", xq[0], xq[1]); + model->Wo = powf(2.0, xq[0]) * (PI * 50.0) / 4000.0; /* bit errors can make us go out of range leading to all sorts of probs like seg faults */ @@ -2044,8 +1125,7 @@ void decode_WoE(C2CONST *c2const, MODEL *model, float *e, float xq[], int n1) if (model->Wo > Wo_max) model->Wo = Wo_max; if (model->Wo < Wo_min) model->Wo = Wo_min; - model->L = PI/model->Wo; /* if we quantise Wo re-compute L */ + model->L = PI / model->Wo; /* if we quantise Wo re-compute L */ - *e = POW10F(xq[1]/10.0); + *e = POW10F(xq[1] / 10.0); } - diff --git a/quantise.h b/quantise.h index 4baa87c..08d5532 100644 --- a/quantise.h +++ b/quantise.h @@ -29,113 +29,75 @@ #include "codec2_fft.h" #include "comp.h" -#define WO_BITS 7 -#define WO_LEVELS (1< -#include +#include "sine.h" + #include +#include +#include #include "defines.h" -#include "sine.h" #include "kiss_fft.h" #define HPF_BETA 0.125 /*---------------------------------------------------------------------------*\ - HEADERS + HEADERS \*---------------------------------------------------------------------------*/ void hs_pitch_refinement(MODEL *model, COMP Sw[], float pmin, float pmax, - float pstep); + float pstep); /*---------------------------------------------------------------------------*\ - FUNCTIONS + FUNCTIONS \*---------------------------------------------------------------------------*/ C2CONST c2const_create(int Fs, float framelength_s) { - C2CONST c2const; - - assert((Fs == 8000) || (Fs = 16000)); - c2const.Fs = Fs; - c2const.n_samp = round(Fs*framelength_s); - c2const.max_amp = floor(Fs*P_MIN_S/2); - c2const.p_min = floor(Fs*P_MIN_S); - c2const.p_max = floor(Fs*P_MAX_S); - c2const.m_pitch = floor(Fs*M_PITCH_S); - c2const.Wo_min = TWO_PI/c2const.p_max; - c2const.Wo_max = TWO_PI/c2const.p_min; - - if (Fs == 8000) { - c2const.nw = 279; - } else { - c2const.nw = 511; /* actually a bit shorter in time but lets us maintain constant FFT size */ - } + C2CONST c2const; + + assert((Fs == 8000) || (Fs == 16000)); + c2const.Fs = Fs; + c2const.n_samp = round(Fs * framelength_s); + c2const.max_amp = floor(Fs * P_MAX_S / 2); + c2const.p_min = floor(Fs * P_MIN_S); + c2const.p_max = floor(Fs * P_MAX_S); + c2const.m_pitch = floor(Fs * M_PITCH_S); + c2const.Wo_min = TWO_PI / c2const.p_max; + c2const.Wo_max = TWO_PI / c2const.p_min; + + if (Fs == 8000) { + c2const.nw = 279; + } else { + c2const.nw = 511; /* actually a bit shorter in time but lets us maintain + constant FFT size */ + } - c2const.tw = Fs*TW_S; + c2const.tw = Fs * TW_S; - /* - fprintf(stderr, "max_amp: %d m_pitch: %d\n", c2const.n_samp, c2const.m_pitch); - fprintf(stderr, "p_min: %d p_max: %d\n", c2const.p_min, c2const.p_max); - fprintf(stderr, "Wo_min: %f Wo_max: %f\n", c2const.Wo_min, c2const.Wo_max); - fprintf(stderr, "nw: %d tw: %d\n", c2const.nw, c2const.tw); - */ + /* + fprintf(stderr, "max_amp: %d m_pitch: %d\n", c2const.n_samp, c2const.m_pitch); + fprintf(stderr, "p_min: %d p_max: %d\n", c2const.p_min, c2const.p_max); + fprintf(stderr, "Wo_min: %f Wo_max: %f\n", c2const.Wo_min, c2const.Wo_max); + fprintf(stderr, "nw: %d tw: %d\n", c2const.nw, c2const.tw); + */ - return c2const; + return c2const; } /*---------------------------------------------------------------------------*\ @@ -97,13 +99,13 @@ C2CONST c2const_create(int Fs, float framelength_s) { \*---------------------------------------------------------------------------*/ -void make_analysis_window(C2CONST *c2const, codec2_fft_cfg fft_fwd_cfg, float w[], float W[]) -{ +void make_analysis_window(C2CONST *c2const, codec2_fft_cfg fft_fwd_cfg, + float w[], float W[]) { float m; - COMP wshift[FFT_ENC]; - int i,j; - int m_pitch = c2const->m_pitch; - int nw = c2const->nw; + COMP wshift[FFT_ENC]; + int i, j; + int m_pitch = c2const->m_pitch; + int nw = c2const->nw; /* Generate Hamming window centered on M-sample pitch analysis window @@ -117,20 +119,18 @@ void make_analysis_window(C2CONST *c2const, codec2_fft_cfg fft_fwd_cfg, float w[ */ m = 0.0; - for(i=0; im_pitch; - int nw = c2const->nw; - - for(i=0; im_pitch; + int nw = c2const->nw; + + for (i = 0; i < FFT_ENC; i++) { + Sw[i].real = 0.0; + Sw[i].imag = 0.0; + } - /* Centre analysis window on time axis, we need to arrange input - to FFT this way to make FFT phases correct */ + /* Centre analysis window on time axis, we need to arrange input + to FFT this way to make FFT phases correct */ - /* move 2nd half to start of FFT input vector */ + /* move 2nd half to start of FFT input vector */ - for(i=0; iWo + 5; - pmin = TWO_PI/model->Wo - 5; + pmax = TWO_PI / model->Wo + 5; + pmin = TWO_PI / model->Wo - 5; pstep = 1.0; - hs_pitch_refinement(model,Sw,pmin,pmax,pstep); + hs_pitch_refinement(model, Sw, pmin, pmax, pstep); /* Fine refinement */ - pmax = TWO_PI/model->Wo + 1; - pmin = TWO_PI/model->Wo - 1; + pmax = TWO_PI / model->Wo + 1; + pmin = TWO_PI / model->Wo - 1; pstep = 0.25; - hs_pitch_refinement(model,Sw,pmin,pmax,pstep); + hs_pitch_refinement(model, Sw, pmin, pmax, pstep); /* Limit range */ - if (model->Wo < TWO_PI/c2const->p_max) - model->Wo = TWO_PI/c2const->p_max; - if (model->Wo > TWO_PI/c2const->p_min) - model->Wo = TWO_PI/c2const->p_min; + if (model->Wo < TWO_PI / c2const->p_max) model->Wo = TWO_PI / c2const->p_max; + if (model->Wo > TWO_PI / c2const->p_min) model->Wo = TWO_PI / c2const->p_min; - model->L = floorf(PI/model->Wo); + model->L = floorf(PI / model->Wo); /* trap occasional round off issues with floorf() */ - if (model->Wo*model->L >= 0.95*PI) { - model->L--; + if (model->Wo * model->L >= 0.95 * PI) { + model->L--; } - assert(model->Wo*model->L < PI); + assert(model->Wo * model->L < PI); } /*---------------------------------------------------------------------------*\ @@ -348,35 +342,39 @@ void two_stage_pitch_refinement(C2CONST *c2const, MODEL *model, COMP Sw[]) \*---------------------------------------------------------------------------*/ -void hs_pitch_refinement(MODEL *model, COMP Sw[], float pmin, float pmax, float pstep) -{ - int m; /* loop variable */ - int b; /* bin for current harmonic centre */ - float E; /* energy for current pitch*/ - float Wo; /* current "test" fundamental freq. */ - float Wom; /* Wo that maximises E */ - float Em; /* mamimum energy */ - float r, one_on_r; /* number of rads/bin */ - float p; /* current pitch */ +void hs_pitch_refinement(MODEL *model, COMP Sw[], float pmin, float pmax, + float pstep) { + int m; /* loop variable */ + int b; /* bin for current harmonic centre */ + float E; /* energy for current pitch*/ + float Wo; /* current "test" fundamental freq. */ + float Wom; /* Wo that maximises E */ + float Em; /* mamimum energy */ + float r, one_on_r; /* number of rads/bin */ + float p; /* current pitch */ /* Initialisation */ - model->L = PI/model->Wo; /* use initial pitch est. for L */ + model->L = PI / model->Wo; /* use initial pitch est. for L */ Wom = model->Wo; Em = 0.0; - r = TWO_PI/FFT_ENC; - one_on_r = 1.0/r; + r = TWO_PI / FFT_ENC; + one_on_r = 1.0 / r; /* Determine harmonic sum for a range of Wo values */ - for(p=pmin; p<=pmax; p+=pstep) { + for (p = pmin; p <= pmax; p += pstep) { E = 0.0; - Wo = TWO_PI/p; + Wo = TWO_PI / p; + + float bFloat = Wo * one_on_r; + float currentBFloat = bFloat; /* Sum harmonic magnitudes */ - for(m=1; m<=model->L; m++) { - b = (int)(m*Wo*one_on_r + 0.5); - E += Sw[b].real*Sw[b].real + Sw[b].imag*Sw[b].imag; + for (m = 1; m <= model->L; m++) { + b = (int)(currentBFloat + 0.5); + E += Sw[b].real * Sw[b].real + Sw[b].imag * Sw[b].imag; + currentBFloat += bFloat; } /* Compare to see if this is a maximum */ @@ -399,35 +397,35 @@ void hs_pitch_refinement(MODEL *model, COMP Sw[], float pmin, float pmax, float \*---------------------------------------------------------------------------*/ -void estimate_amplitudes(MODEL *model, COMP Sw[], float W[], int est_phase) -{ - int i,m; /* loop variables */ - int am,bm; /* bounds of current harmonic */ - float den; /* denominator of amplitude expression */ +void estimate_amplitudes(MODEL *model, COMP Sw[], float W[], int est_phase) { + int i, m; /* loop variables */ + int am, bm; /* bounds of current harmonic */ + float den; /* denominator of amplitude expression */ - float r = TWO_PI/FFT_ENC; - float one_on_r = 1.0/r; + float r = TWO_PI / FFT_ENC; + float one_on_r = 1.0 / r; - for(m=1; m<=model->L; m++) { + for (m = 1; m <= model->L; m++) { /* Estimate ampltude of harmonic */ den = 0.0; - am = (int)((m - 0.5)*model->Wo*one_on_r + 0.5); - bm = (int)((m + 0.5)*model->Wo*one_on_r + 0.5); + am = (int)((m - 0.5) * model->Wo * one_on_r + 0.5); + bm = (int)((m + 0.5) * model->Wo * one_on_r + 0.5); - for(i=am; iA[m] = sqrtf(den); if (est_phase) { - int b = (int)(m*model->Wo/r + 0.5); /* DFT bin of centre of current harmonic */ + int b = (int)(m * model->Wo / r + + 0.5); /* DFT bin of centre of current harmonic */ - /* Estimate phase of harmonic, this is expensive in CPU for - embedded devicesso we make it an option */ + /* Estimate phase of harmonic, this is expensive in CPU for + embedded devicesso we make it an option */ - model->phi[m] = atan2f(Sw[b].imag,Sw[b].real); + model->phi[m] = atan2f(Sw[b].imag, Sw[b].real); } } } @@ -443,119 +441,110 @@ void estimate_amplitudes(MODEL *model, COMP Sw[], float W[], int est_phase) \*---------------------------------------------------------------------------*/ -float est_voicing_mbe( - C2CONST *c2const, - MODEL *model, - COMP Sw[], - float W[] - ) -{ - int l,al,bl,m; /* loop variables */ - COMP Am; /* amplitude sample for this band */ - int offset; /* centers Hw[] about current harmonic */ - float den; /* denominator of Am expression */ - float error; /* accumulated error between original and synthesised */ - float Wo; - float sig, snr; - float elow, ehigh, eratio; - float sixty; - COMP Ew; - Ew.real = 0; - Ew.imag = 0; - - int l_1000hz = model->L*1000.0/(c2const->Fs/2); - sig = 1E-4; - for(l=1; l<=l_1000hz; l++) { - sig += model->A[l]*model->A[l]; - } +float est_voicing_mbe(C2CONST *c2const, MODEL *model, COMP Sw[], float W[]) { + int l, al, bl, m; /* loop variables */ + COMP Am; /* amplitude sample for this band */ + int offset; /* centers Hw[] about current harmonic */ + float den; /* denominator of Am expression */ + float error; /* accumulated error between original and synthesised */ + float Wo; + float sig, snr; + float elow, ehigh, eratio; + float sixty; + COMP Ew; + Ew.real = 0; + Ew.imag = 0; + + int l_1000hz = model->L * 1000.0 / (c2const->Fs / 2); + sig = 1E-4; + for (l = 1; l <= l_1000hz; l++) { + sig += model->A[l] * model->A[l]; + } - Wo = model->Wo; - error = 1E-4; + Wo = model->Wo; + error = 1E-4; - /* Just test across the harmonics in the first 1000 Hz */ + /* Just test across the harmonics in the first 1000 Hz */ - for(l=1; l<=l_1000hz; l++) { - Am.real = 0.0; - Am.imag = 0.0; - den = 0.0; - al = ceilf((l - 0.5)*Wo*FFT_ENC/TWO_PI); - bl = ceilf((l + 0.5)*Wo*FFT_ENC/TWO_PI); + for (l = 1; l <= l_1000hz; l++) { + Am.real = 0.0; + Am.imag = 0.0; + den = 0.0; + al = ceilf((l - 0.5) * Wo * FFT_ENC / TWO_PI); + bl = ceilf((l + 0.5) * Wo * FFT_ENC / TWO_PI); - /* Estimate amplitude of harmonic assuming harmonic is totally voiced */ + /* Estimate amplitude of harmonic assuming harmonic is totally voiced */ - offset = FFT_ENC/2 - l*Wo*FFT_ENC/TWO_PI + 0.5; - for(m=al; m V_THRESH) - model->voiced = 1; - else - model->voiced = 0; - - /* post processing, helps clean up some voicing errors ------------------*/ - - /* - Determine the ratio of low freqency to high frequency energy, - voiced speech tends to be dominated by low frequency energy, - unvoiced by high frequency. This measure can be used to - determine if we have made any gross errors. - */ - - int l_2000hz = model->L*2000.0/(c2const->Fs/2); - int l_4000hz = model->L*4000.0/(c2const->Fs/2); - elow = ehigh = 1E-4; - for(l=1; l<=l_2000hz; l++) { - elow += model->A[l]*model->A[l]; - } - for(l=l_2000hz; l<=l_4000hz; l++) { - ehigh += model->A[l]*model->A[l]; - } - eratio = 10.0*log10f(elow/ehigh); + snr = 10.0 * log10f(sig / error); + if (snr > V_THRESH) + model->voiced = 1; + else + model->voiced = 0; + + /* post processing, helps clean up some voicing errors ------------------*/ - /* Look for Type 1 errors, strongly V speech that has been - accidentally declared UV */ + /* + Determine the ratio of low frequency to high frequency energy, + voiced speech tends to be dominated by low frequency energy, + unvoiced by high frequency. This measure can be used to + determine if we have made any gross errors. + */ + + int l_2000hz = model->L * 2000.0 / (c2const->Fs / 2); + int l_4000hz = model->L * 4000.0 / (c2const->Fs / 2); + elow = ehigh = 1E-4; + for (l = 1; l <= l_2000hz; l++) { + elow += model->A[l] * model->A[l]; + } + for (l = l_2000hz; l <= l_4000hz; l++) { + ehigh += model->A[l] * model->A[l]; + } + eratio = 10.0 * log10f(elow / ehigh); - if (model->voiced == 0) - if (eratio > 10.0) - model->voiced = 1; + /* Look for Type 1 errors, strongly V speech that has been + accidentally declared UV */ - /* Look for Type 2 errors, strongly UV speech that has been - accidentally declared V */ + if (model->voiced == 0) + if (eratio > 10.0) model->voiced = 1; - if (model->voiced == 1) { - if (eratio < -10.0) - model->voiced = 0; + /* Look for Type 2 errors, strongly UV speech that has been + accidentally declared V */ - /* A common source of Type 2 errors is the pitch estimator - gives a low (50Hz) estimate for UV speech, which gives a - good match with noise due to the close harmoonic spacing. - These errors are much more common than people with 50Hz3 - pitch, so we have just a small eratio threshold. */ + if (model->voiced == 1) { + if (eratio < -10.0) model->voiced = 0; - sixty = 60.0*TWO_PI/c2const->Fs; - if ((eratio < -4.0) && (model->Wo <= sixty)) - model->voiced = 0; - } - //printf(" v: %d snr: %f eratio: %3.2f %f\n",model->voiced,snr,eratio,dF0); + /* A common source of Type 2 errors is the pitch estimator + gives a low (50Hz) estimate for UV speech, which gives a + good match with noise due to the close harmoonic spacing. + These errors are much more common than people with 50Hz3 + pitch, so we have just a small eratio threshold. */ - return snr; + sixty = 60.0 * TWO_PI / c2const->Fs; + if ((eratio < -4.0) && (model->Wo <= sixty)) model->voiced = 0; + } + // printf(" v: %d snr: %f eratio: %3.2f %f\n",model->voiced,snr,eratio,dF0); + + return snr; } /*---------------------------------------------------------------------------*\ @@ -564,32 +553,29 @@ float est_voicing_mbe( AUTHOR......: David Rowe DATE CREATED: 11/5/94 - Init function that generates the trapezoidal (Parzen) sythesis window. + Init function that generates the trapezoidal (Parzen) synthesis window. \*---------------------------------------------------------------------------*/ -void make_synthesis_window(C2CONST *c2const, float Pn[]) -{ - int i; +void make_synthesis_window(C2CONST *c2const, float Pn[]) { + int i; float win; - int n_samp = c2const->n_samp; - int tw = c2const->tw; + int n_samp = c2const->n_samp; + int tw = c2const->tw; /* Generate Parzen window in time domain */ win = 0.0; - for(i=0; iL; l++) { - b = (int)(l*model->Wo*FFT_DEC/TWO_PI + 0.5); - if (b > ((FFT_DEC/2)-1)) { - b = (FFT_DEC/2)-1; - } - Sw_[b].real = model->A[l]*cosf(model->phi[l]); - Sw_[b].imag = model->A[l]*sinf(model->phi[l]); + for (l = 1; l <= model->L; l++) { + b = (int)(l * model->Wo * FFT_DEC / TWO_PI + 0.5); + if (b > ((FFT_DEC / 2) - 1)) { + b = (FFT_DEC / 2) - 1; } + Sw_[b].real = model->A[l] * cosf(model->phi[l]); + Sw_[b].imag = model->A[l] * sinf(model->phi[l]); + } - /* Perform inverse DFT */ + /* Perform inverse DFT */ - codec2_fftri(fftr_inv_cfg, Sw_,sw_); + codec2_fftri(fftr_inv_cfg, Sw_, sw_); - /* Overlap add to previous samples */ + /* Overlap add to previous samples */ - #ifdef USE_KISS_FFT - #define FFTI_FACTOR ((float)1.0) - #else - #define FFTI_FACTOR ((float32_t)FFT_DEC) - #endif +#ifdef USE_KISS_FFT +#define FFTI_FACTOR ((float)1.0) +#else +#define FFTI_FACTOR ((float32_t)FFT_DEC) +#endif - for(i=0; i