modified to correct for MAX_AMP+1 overflow error, added mbest VQ search
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Tue, 18 Sep 2012 04:46:29 +0000 (04:46 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Tue, 18 Sep 2012 04:46:29 +0000 (04:46 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@723 01035d8c-6547-0410-b346-abe4f91aad63

22 files changed:
codec2-dev/README
codec2-dev/fltk/fl_fdmdv.cxx
codec2-dev/octave/lspwarp.m [new file with mode: 0644]
codec2-dev/octave/pllpcpf.m
codec2-dev/octave/sd.m
codec2-dev/portaudio/Makefile
codec2-dev/portaudio/pa_impresp.c [new file with mode: 0644]
codec2-dev/src/Makefile.am
codec2-dev/src/Makefile.in
codec2-dev/src/c2sim.c
codec2-dev/src/codebook/lspvqanssi1.txt
codec2-dev/src/codebook/lspvqanssi2.txt
codec2-dev/src/codebook/lspvqanssi3.txt
codec2-dev/src/codec2.c
codec2-dev/src/defines.h
codec2-dev/src/phase.c
codec2-dev/src/phase.h
codec2-dev/src/phaseexp.c [new file with mode: 0644]
codec2-dev/src/phaseexp.h [new file with mode: 0644]
codec2-dev/src/quantise.c
codec2-dev/src/quantise.h
codec2-dev/unittest/vqtrainsp.c

index 4a87406aec5986a04eff72573aaf93897d78c9f4..c83988830f112cc8aa2b2dc150b4b4a97078807c 100644 (file)
@@ -64,19 +64,21 @@ Debugging
 Directories
 -----------
 
-  fltk     - FLTK GUI programs(s)
-  octave   - Octave scripts used for visualising internal signals 
-             during development
-  script   - shell scripts for playing and converting raw files
-  src      - C source code
-  raw      - speech files in raw format (16 bits signed linear 8 kHz)
-  unittest - unit test source code
-  voicing  - hand-estimated voicing files, used for development
-  wav      - speech files in wave file format
-  win32    - Support for building Windows DLL version of Codec 2 and FDMDV libraries
+  fltk      - FLTK GUI programs(s)
+  octave    - Octave scripts used for visualising internal signals 
+              during development
+  portaudio - Portaudio test programs
+  script    - shell scripts for playing and converting raw files
+  src       - C source code
+  raw       - speech files in raw format (16 bits signed linear 8 kHz)
+  unittest  - unit test source code
+  voicing   - hand-estimated voicing files, used for development
+  wav       - speech files in wave file format
+  win32     - Support for building Windows DLL version of Codec 2 and FDMDV libraries
 
 TODO
 ----
 
-[ ] Get win32/Makefile integarted into Automake system, such that if
+[ ] Get win32/Makefile integrated into Automake system, such that if
     i586-mingw32msvc exists the Win32 code gets automatically built.
+[ ] Same for fltk & portaudio, build these conditionally if libs exist
\ No newline at end of file
index ae8232c0c31a89e3ad7ef05a6b6e75ff7c5054a7..30c67aab772e2260c0ee15d9542ff7d9f8471ce9 100644 (file)
@@ -638,6 +638,15 @@ void new_data(float mag_dB[]) {
   The ouput of the demod is codec voice data so it's OK if we miss or
   repeat a frame every now and again.
 
+  TODOs:
+
+    + this might work with arbitrary input and output buffer lengths,
+    0,1, or 2 only apply if we are inputting the nominal number of
+    samples on every call.
+
+    + so the I/O buffer sizes might not matter, as long as they of
+    reasonable size (say twice the nominal size).
+
 \*------------------------------------------------------------------*/
 
 void per_frame_rx_processing(short  output_buf[], /* output buf of decoded speech samples          */
diff --git a/codec2-dev/octave/lspwarp.m b/codec2-dev/octave/lspwarp.m
new file mode 100644 (file)
index 0000000..2d2f2c9
--- /dev/null
@@ -0,0 +1,40 @@
+% lspwarp.m
+% David Rowe Sep 2012
+%
+% Experimenting with non-linear LSP frequency axis for LSP quantisation
+% Plots a scaled mel axis.
+
+1;
+
+function mel = freq2mel(f)
+  mel = 70*log10(1 + f/700);
+endfunction
+
+function freq = mel2freq(m)
+  freq = 700*(10 ^ (m/70) - 1);
+endfunction
+
+x = []; y = [];
+
+for freq = 100:25:4000
+  mel = freq2mel(freq);
+  x = [x freq];
+  y = [y mel];
+end
+
+plot(x,y)
+grid
+
+mel_start = floor(freq2mel(100));
+mel_end = floor(freq2mel(4000));
+
+x = []; y = [];
+for mel=mel_start:mel_end
+  freq = mel2freq(mel);
+  x = [x freq];
+  y = [y mel];
+end
+
+hold on;
+plot(x,y, '+')
+hold off;
index b3912f8a6283ad5e7a9de30e4279b96aeb6f73bd..924e045a210afcef71b807cc5661d37ef504cd98 100644 (file)
@@ -9,10 +9,13 @@ function pllpcpf(samname, f)
   
   % switch some stuff off to unclutter display
 
+  plot_Am = 0;
+  plot_Amq = 0;
+  plot_err = 0;
   plot_lsp = 0;
   plot_snr = 0;
   plot_vsnr = 0;
-  plot_sw = 1;
+  plot_sw = 0;
   plot_pw = 1;
   plot_pwb = 1;
   plot_rw = 1;
@@ -69,10 +72,13 @@ function pllpcpf(samname, f)
     axis([1 length(s) -20000 20000]);
 
     figure(2);
+    clf;
     Wo = model(f,1);
     L = model(f,2);
     Am = model(f,3:(L+2));
-    plot((1:L)*Wo*4000/pi, 20*log10(Am),";Am;r");
+    if plot_Am
+      plot((1:L)*Wo*4000/pi, 20*log10(Am),";Am;r");
+    end
     axis([1 4000 -10 80]);
     hold on;
     if plot_sw
@@ -82,25 +88,29 @@ function pllpcpf(samname, f)
     if (file_in_path(".",modelq_name))
 
       Amq = modelq(f,3:(L+2));
-      plot((1:L)*Wo*4000/pi, 20*log10(Amq),";Amq;g" );
+      if plot_Amq
+        plot((1:L)*Wo*4000/pi, 20*log10(Amq),";Amq;g" );
+      end
 
       if (file_in_path(".",pwb_name) && plot_pwb)
-        plot((0:255)*4000/256, 10*log10(Pwb(f,:)),";Pwb;c");
+        plot((0:255)*4000/256, 10*log10(Pwb(f,:)),";Pwb;r");
       endif    
 
       if (file_in_path(".",rw_name) && plot_rw)
-        plot((0:255)*4000/256, 10*log10(Rw(f,:)),";Rw;c");
+        plot((0:255)*4000/256, 10*log10(Rw(f,:)),";Rw;b");
       endif    
 
       if (file_in_path(".",pw_name) && plot_pw)
-        plot((0:255)*4000/256, 10*log10(Pw(f,:)),";Pw;c.");
+        plot((0:255)*4000/256, 10*log10(Pw(f,:)),";Pw;g.");
       endif    
 
       signal = Am * Am';
       noise = (Am-Amq) * (Am-Amq)'; 
       snr1 = 10*log10(signal/noise);
       Am_err_label = sprintf(";Am error SNR %4.2f dB;m",snr1);
-      plot((1:L)*Wo*4000/pi, 20*log10(Amq) - 20*log10(Am), Am_err_label);
+      if plot_err
+        plot((1:L)*Wo*4000/pi, 20*log10(Amq) - 20*log10(Am), Am_err_label);
+      end
     endif
 
 
index 112af6145f309cf691e7c785c9d74eb863c19474..4c3d13c92243552ee1780160a27139943d1568cb 100644 (file)
@@ -26,6 +26,7 @@ function sd(raw_filename, dump_file_prefix, f)
     A2(i,:) = -20*log10(abs(fft(ak2(i,:),Ndft)));
     sd(i) = sum((A1(i,:) - A2(i,:)).^2)/Ndft;
   end
+  printf("sd av %3.2f dB*dB\n", sum(sd)/frames);
 
   figure(1);
   clf;
@@ -46,6 +47,11 @@ function sd(raw_filename, dump_file_prefix, f)
   lsp1 = load(lsp1_filename);
   lsp2 = load(lsp2_filename);
 
+  weights_filename = sprintf("%s_weights.txt", dump_file_prefix); 
+  if file_in_path(".",weights_filename)
+    weights = load(weights_filename);
+  end
+
   k = ' ';
   do 
     figure(2);
@@ -61,7 +67,10 @@ function sd(raw_filename, dump_file_prefix, f)
     axis([1 4000 -20 40]);
     hold on;
     plot((1:Ndft/2)*4000/(Ndft/2), A2(f,1:(Ndft/2)),";A2;");
+    if file_in_path(".",weights_filename)
+      plot(lsp1(f,:)*4000/pi, weights(f,:),";weights;g+");
+    end
+
     for l=1:10
         plot([lsp1(f,l)*4000/pi lsp1(f,l)*4000/pi], [0  -10], 'r');
         plot([lsp2(f,l)*4000/pi lsp2(f,l)*4000/pi], [-10 -20], 'b');
index 6c1e2c120fc9e0aa945144e477b45816fa2a1c98..a1876de9e64a1645b22bd633510d965f601f5925 100644 (file)
@@ -5,7 +5,7 @@ CFLAGS =  -g -Wall -I../src
 LIBS = -lm -lportaudio -pthread
 SRC  = ../src/fdmdv.c ../src/kiss_fft.c
 
-all: pa_rec pa_play pa_recplay
+all: pa_rec pa_play pa_recplay pa_impresp
 
 pa_rec: Makefile pa_rec.c $(SRC)
        gcc $(CFLAGS) pa_rec.c $(SRC) -o pa_rec $(LIBS)
@@ -16,5 +16,8 @@ pa_play: Makefile pa_play.c $(SRC)
 pa_recplay: Makefile pa_recplay.c $(SRC)
        gcc $(CFLAGS) pa_recplay.c $(SRC) -o pa_recplay $(LIBS)
 
+pa_impresp: Makefile pa_impresp.c $(SRC)
+       gcc $(CFLAGS) pa_impresp.c $(SRC) -o pa_impresp $(LIBS)
+
 clean:
        rm -f pa_rec pa_play pa_recplay
diff --git a/codec2-dev/portaudio/pa_impresp.c b/codec2-dev/portaudio/pa_impresp.c
new file mode 100644 (file)
index 0000000..7317e07
--- /dev/null
@@ -0,0 +1,254 @@
+/* 
+   pa_impresp.c
+   David Rowe
+   August 29 2012
+
+   Measures the impulse reponse of the path between the speaker and
+   microphone.  Used to explore why Codec audio quality is
+   different through a speaker and headphones.
+
+   Modified from pa_playrec.c
+*/
+
+/*
+ * $Id: paex_record.c 1752 2011-09-08 03:21:55Z philburk $
+ *
+ * This program uses the PortAudio Portable Audio Library.
+ * For more information see: http://www.portaudio.com
+ * Copyright (c) 1999-2000 Ross Bencina and Phil Burk
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "portaudio.h"
+#include "fdmdv.h"
+
+#define SAMPLE_RATE  48000         /* 48 kHz sampling rate rec. as we
+                                     can trust accuracy of sound
+                                     card */
+#define N8           160           /* processing buffer size at 8 kHz */
+#define N48          (N8*FDMDV_OS) /* processing buffer size at 48 kHz */
+#define MEM8 (FDMDV_OS_TAPS/FDMDV_OS)
+#define NUM_CHANNELS 2             /* I think most sound cards prefer
+                                     stereo, we will convert to mono
+                                     as we sample */
+
+#define IMPULSE_AMP    16384       /* amplitide of impulse                  */
+#define IMPULSE_PERIOD 0.1         /* period (dly between impulses) in secs */
+
+/* state information passed to call back */
+
+typedef struct {
+    float               in48k[FDMDV_OS_TAPS + N48];
+    float               in8k[MEM8 + N8];
+    FILE               *fimp;
+    float              *impulse_buf;
+    int                 impulse_buf_length;
+    int                 impulse_sample_count;
+    int                 framesLeft;
+} paTestData;
+
+
+/* 
+   This routine will be called by the PortAudio engine when audio is
+   required.  It may be called at interrupt level on some machines so
+   don't do anything that could mess up the system like calling
+   malloc() or free().
+*/
+
+static int callback( const void *inputBuffer, void *outputBuffer,
+                           unsigned long framesPerBuffer,
+                           const PaStreamCallbackTimeInfo* timeInfo,
+                           PaStreamCallbackFlags statusFlags,
+                           void *userData )
+{
+    paTestData *data = (paTestData*)userData;
+    int         i;
+    short      *rptr = (short*)inputBuffer;
+    short      *wptr = (short*)outputBuffer;
+    float      *in8k = data->in8k;
+    float      *in48k = data->in48k;
+    float       out8k[N8];
+    float       out48k[N48];
+    short       out48k_short[N48];
+    short       out8k_short[N8];
+
+    (void) timeInfo;
+    (void) statusFlags;
+
+    assert(inputBuffer != NULL);
+
+    /* just use left channel */
+
+    for(i=0; i<framesPerBuffer; i++,rptr+=2)
+       data->in48k[i+FDMDV_OS_TAPS] = *rptr; 
+
+    /* downsample and update filter memory */
+
+    fdmdv_48_to_8(out8k, &in48k[FDMDV_OS_TAPS], N8);
+    for(i=0; i<FDMDV_OS_TAPS; i++)
+       in48k[i] = in48k[i+framesPerBuffer];
+
+    /* write impulse response to disk */
+    
+    for(i=0; i<N8; i++)
+       out8k_short[i] = out8k[i];
+    fwrite(out8k_short, sizeof(short), N8, data->fimp);
+
+    /* play side, read from impulse buffer */
+
+    for(i=0; i<N8; i++) {
+       in8k[MEM8+i] = data->impulse_buf[data->impulse_sample_count];
+       data->impulse_sample_count++;
+       if (data->impulse_sample_count == data->impulse_buf_length)
+           data->impulse_sample_count = 0;
+    }
+
+    /* upsample and update filter memory */
+
+    fdmdv_8_to_48(out48k, &in8k[MEM8], N8);
+    for(i=0; i<MEM8; i++)
+       in8k[i] = in8k[i+N8];
+
+    assert(outputBuffer != NULL);
+
+    /* write signal to both channels */
+
+    for(i=0; i<N48; i++)
+       out48k_short[i] = (short)out48k[i];
+    for(i=0; i<framesPerBuffer; i++,wptr+=2) {
+       wptr[0] = out48k_short[i]; 
+       wptr[1] = out48k_short[i]; 
+    }
+
+    data->framesLeft -= framesPerBuffer;
+    if (data->framesLeft > 0)
+       return paContinue;
+    else
+       return paComplete;
+}
+
+int main(int argc, char *argv[])
+{
+    PaStreamParameters  inputParameters, outputParameters;
+    PaStream*           stream;
+    PaError             err = paNoError;
+    paTestData          data;
+    int                 i, numSecs;
+
+    if (argc != 3) {
+       printf("usage: %s impulseRawFile time(s)\n", argv[0]);
+       exit(0);
+    }
+
+    data.fimp = fopen(argv[1], "wb");
+    if (data.fimp == NULL) {
+       printf("Error opening impulse output file %s\n", argv[1]);
+       exit(1);
+    }
+
+    numSecs = atoi(argv[2]);
+    data.framesLeft = numSecs * SAMPLE_RATE;
+
+    /* init filter states */
+
+    for(i=0; i<MEM8; i++)
+       data.in8k[i] = 0.0;
+    for(i=0; i<FDMDV_OS_TAPS; i++)
+       data.in48k[i] = 0.0;
+
+    /* init imupulse */
+
+    data.impulse_buf_length = IMPULSE_PERIOD*(SAMPLE_RATE/FDMDV_OS);
+    printf("%d\n",data.impulse_buf_length);
+    data.impulse_buf = (float*)malloc(data.impulse_buf_length*sizeof(float));
+    assert(data.impulse_buf != NULL);
+    data.impulse_buf[0] = IMPULSE_AMP;
+    for(i=1; i<data.impulse_buf_length; i++)
+       data.impulse_buf[i] = 0;
+    data.impulse_sample_count = 0;
+
+    err = Pa_Initialize();
+    if( err != paNoError ) goto done;
+
+    inputParameters.device = Pa_GetDefaultInputDevice(); /* default input device */
+    if (inputParameters.device == paNoDevice) {
+        fprintf(stderr,"Error: No default input device.\n");
+        goto done;
+    }
+    inputParameters.channelCount = NUM_CHANNELS;         /* stereo input */
+    inputParameters.sampleFormat = paInt16;
+    inputParameters.suggestedLatency = Pa_GetDeviceInfo( inputParameters.device )->defaultLowInputLatency;
+    inputParameters.hostApiSpecificStreamInfo = NULL;
+
+    outputParameters.device = Pa_GetDefaultOutputDevice(); /* default output device */
+    if (outputParameters.device == paNoDevice) {
+        fprintf(stderr,"Error: No default output device.\n");
+        goto done;
+    }
+    outputParameters.channelCount = NUM_CHANNELS;         /* stereo output */
+    outputParameters.sampleFormat = paInt16;
+    outputParameters.suggestedLatency = Pa_GetDeviceInfo( outputParameters.device )->defaultLowOutputLatency;
+    outputParameters.hostApiSpecificStreamInfo = NULL;
+
+    /* Play some audio --------------------------------------------- */
+
+    err = Pa_OpenStream(
+              &stream,
+             &inputParameters,
+              &outputParameters,
+              SAMPLE_RATE,
+              N48,
+              paClipOff,      
+              callback,
+              &data );
+    if( err != paNoError ) goto done;
+
+    err = Pa_StartStream( stream );
+    if( err != paNoError ) goto done;
+
+    while( ( err = Pa_IsStreamActive( stream ) ) == 1 )
+    {
+        Pa_Sleep(100);
+    }
+    if( err < 0 ) goto done;
+
+    err = Pa_CloseStream( stream );
+    if( err != paNoError ) goto done;
+
+
+done:
+    Pa_Terminate();
+    if( err != paNoError )
+    {
+        fprintf( stderr, "An error occured while using the portaudio stream\n" );
+        fprintf( stderr, "Error number: %d\n", err );
+        fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) );
+        err = 1;          /* Always return 0 or 1, but no other return codes. */
+    }
+
+    fclose(data.fimp);
+
+    return err;
+}
+
index 097f4ccec4a9670b947ca0b4082093e8b4fd74ee..3d2e0c890a656c410a3cf3d853e8b743dd7236cd 100644 (file)
@@ -127,7 +127,6 @@ interp.c \
 lsp.c \
 phase.c \
 quantise.c \
-ampexp.c \
 pack.c \
 codebook.c \
 codebookd.c \
@@ -159,7 +158,7 @@ c2dec_SOURCES = c2dec.c
 c2dec_LDADD = $(lib_LTLIBRARIES) 
 c2dec_LDFLAGS = $(LIBS)
 
-c2sim_SOURCES = c2sim.c
+c2sim_SOURCES = c2sim.c ampexp.c phaseexp.c
 c2sim_LDADD = $(lib_LTLIBRARIES) 
 c2sim_LDFLAGS = $(LIBS)
 
index f186e93b6746f420016f3c4d282b0ea94070c94c..73dcd4284d516f1ca6d09c8950b9b88a02f119d6 100644 (file)
@@ -69,11 +69,11 @@ am_libcodec2_la_OBJECTS = libcodec2_la-dump.lo libcodec2_la-lpc.lo \
        libcodec2_la-fdmdv.lo libcodec2_la-kiss_fft.lo \
        libcodec2_la-interp.lo libcodec2_la-lsp.lo \
        libcodec2_la-phase.lo libcodec2_la-quantise.lo \
-       libcodec2_la-ampexp.lo libcodec2_la-pack.lo \
-       libcodec2_la-codebook.lo libcodec2_la-codebookd.lo \
-       libcodec2_la-codebookvq.lo libcodec2_la-codebookjnd.lo \
-       libcodec2_la-codebookjvm.lo libcodec2_la-codebookvqanssi.lo \
-       libcodec2_la-codebookdt.lo libcodec2_la-codebookge.lo
+       libcodec2_la-pack.lo libcodec2_la-codebook.lo \
+       libcodec2_la-codebookd.lo libcodec2_la-codebookvq.lo \
+       libcodec2_la-codebookjnd.lo libcodec2_la-codebookjvm.lo \
+       libcodec2_la-codebookvqanssi.lo libcodec2_la-codebookdt.lo \
+       libcodec2_la-codebookge.lo
 libcodec2_la_OBJECTS = $(am_libcodec2_la_OBJECTS)
 binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
 PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
@@ -87,7 +87,7 @@ c2demo_DEPENDENCIES = $(am__DEPENDENCIES_1)
 am_c2enc_OBJECTS = c2enc.$(OBJEXT)
 c2enc_OBJECTS = $(am_c2enc_OBJECTS)
 c2enc_DEPENDENCIES = $(am__DEPENDENCIES_1)
-am_c2sim_OBJECTS = c2sim.$(OBJEXT)
+am_c2sim_OBJECTS = c2sim.$(OBJEXT) ampexp.$(OBJEXT) phaseexp.$(OBJEXT)
 c2sim_OBJECTS = $(am_c2sim_OBJECTS)
 c2sim_DEPENDENCIES = $(am__DEPENDENCIES_1)
 am_fdmdv_demod_OBJECTS = fdmdv_demod.$(OBJEXT) fdmdv.$(OBJEXT) \
@@ -333,7 +333,6 @@ interp.c \
 lsp.c \
 phase.c \
 quantise.c \
-ampexp.c \
 pack.c \
 codebook.c \
 codebookd.c \
@@ -357,7 +356,7 @@ c2enc_LDFLAGS = $(LIBS)
 c2dec_SOURCES = c2dec.c
 c2dec_LDADD = $(lib_LTLIBRARIES) 
 c2dec_LDFLAGS = $(LIBS)
-c2sim_SOURCES = c2sim.c
+c2sim_SOURCES = c2sim.c ampexp.c phaseexp.c
 c2sim_LDADD = $(lib_LTLIBRARIES) 
 c2sim_LDFLAGS = $(LIBS)
 fdmdv_get_test_bits_SOURCES = fdmdv_get_test_bits.c fdmdv.c kiss_fft.c
@@ -507,6 +506,7 @@ mostlyclean-compile:
 distclean-compile:
        -rm -f *.tab.c
 
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ampexp.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c2dec.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c2demo.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c2enc.Po@am__quote@
@@ -520,7 +520,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/generate_codebook.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/genlspdtcb.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kiss_fft.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-ampexp.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-codebook.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-codebookd.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-codebookdt.Plo@am__quote@
@@ -543,6 +542,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-quantise.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-sine.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/octave.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/phaseexp.Po@am__quote@
 
 .c.o:
 @am__fastdepCC_TRUE@   if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@@ -649,13 +649,6 @@ libcodec2_la-quantise.lo: quantise.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -c -o libcodec2_la-quantise.lo `test -f 'quantise.c' || echo '$(srcdir)/'`quantise.c
 
-libcodec2_la-ampexp.lo: ampexp.c
-@am__fastdepCC_TRUE@   if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -MT libcodec2_la-ampexp.lo -MD -MP -MF "$(DEPDIR)/libcodec2_la-ampexp.Tpo" -c -o libcodec2_la-ampexp.lo `test -f 'ampexp.c' || echo '$(srcdir)/'`ampexp.c; \
-@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/libcodec2_la-ampexp.Tpo" "$(DEPDIR)/libcodec2_la-ampexp.Plo"; else rm -f "$(DEPDIR)/libcodec2_la-ampexp.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='ampexp.c' object='libcodec2_la-ampexp.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -c -o libcodec2_la-ampexp.lo `test -f 'ampexp.c' || echo '$(srcdir)/'`ampexp.c
-
 libcodec2_la-pack.lo: pack.c
 @am__fastdepCC_TRUE@   if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -MT libcodec2_la-pack.lo -MD -MP -MF "$(DEPDIR)/libcodec2_la-pack.Tpo" -c -o libcodec2_la-pack.lo `test -f 'pack.c' || echo '$(srcdir)/'`pack.c; \
 @am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/libcodec2_la-pack.Tpo" "$(DEPDIR)/libcodec2_la-pack.Plo"; else rm -f "$(DEPDIR)/libcodec2_la-pack.Tpo"; exit 1; fi
index 721631da535f691431938e03b997ffaf8c8d557e..0d9b41c46d00c69926c8f391e3340bcef72bf9ef 100644 (file)
@@ -47,6 +47,7 @@
 #include "postfilter.h"
 #include "interp.h"
 #include "ampexp.h"
+#include "phaseexp.h"
 
 void synth_one_frame(kiss_fft_cfg fft_inv_cfg, short buf[], MODEL *model, float Sn_[], float Pn[]);
 void print_help(const struct option *long_options, int num_opts, char* argv[]);
@@ -436,7 +437,7 @@ int main(int argc, char *argv[])
 
            /* just to make sure we are not cheating - kill all phases */
 
-           for(i=0; i<MAX_AMP; i++)
+           for(i=0; i<=MAX_AMP; i++)
                model.phi[i] = 0;
        
            if (hand_voicing) {
@@ -519,7 +520,7 @@ int main(int argc, char *argv[])
            if (lspanssi) {
                /*  multi-stage VQ from Anssi Ramo OH3GDD */
 
-               lspanssi_quantise(lsps, lsps_, LPC_ORD);
+               lspanssi_quantise(lsps, lsps_, LPC_ORD, 5);
                lsp_to_lpc(lsps_, ak, LPC_ORD);
            }
 
index efe9a40221d40c3737857e3302f6533e7bc2eb39..f7dc0e9addae59585f98da7d587b5dbb1fd6c291 100644 (file)
-10 128
-       0.3360 0.4547 0.6542 0.9336 1.1451 1.3330 1.6239 1.8289 2.1211 2.4767 
-       0.2691 0.3353 0.7667 1.2615 1.4413 1.6191 1.8433 2.0450 2.5208 2.6878 
-       0.2532 0.3475 0.4905 0.9081 1.4308 1.6171 1.8267 2.0767 2.3056 2.4890 
-       0.1642 0.2231 0.3985 0.5937 1.0764 1.5668 2.0179 2.2026 2.5460 2.7686 
-       0.1446 0.2382 0.3611 0.6294 1.4526 1.6285 1.8859 2.0916 2.5247 2.7616 
-       0.2909 0.3707 0.7973 1.0222 1.2198 1.6585 1.9237 2.1546 2.5072 2.6632 
-       0.2723 0.3650 0.5628 0.9811 1.2226 1.3994 1.9010 2.1329 2.3930 2.5913 
-       0.3328 0.4212 0.6131 0.9549 1.4766 1.6833 1.8794 2.1090 2.3587 2.5268 
-       0.1916 0.3023 0.4474 0.7898 1.3276 1.4953 1.7983 2.0377 2.2989 2.7252 
-       0.2257 0.3252 0.8949 1.1911 1.4134 1.6653 1.9306 2.1786 2.4877 2.6719 
-       0.1705 0.2897 0.4621 0.7049 0.8953 1.1664 1.5965 1.8166 2.5390 2.7622 
-       0.2085 0.3298 0.5015 0.7248 0.8937 1.3994 1.8019 2.0194 2.3466 2.5436 
-       0.1516 0.2919 0.9066 1.2688 1.5725 1.8833 2.1739 2.3893 2.6362 2.8002 
-       0.1590 0.2264 0.4001 0.5947 0.9463 1.5007 1.8331 2.0431 2.2922 2.5175 
-       0.2365 0.3283 0.8137 1.0816 1.2930 1.5331 1.8063 2.0186 2.2931 2.5537 
-       0.2813 0.5931 1.0526 1.4005 1.6873 1.9747 2.2304 2.4244 2.6560 2.8101 
-       0.2161 0.3113 0.4777 0.6719 0.8755 1.7048 1.9748 2.2109 2.5294 2.7116 
-       0.2145 0.2934 0.4785 0.8062 1.6183 1.8578 2.0875 2.2896 2.5415 2.7191 
-       0.3137 0.3927 0.6740 0.8238 1.0395 1.7024 1.9657 2.1882 2.5408 2.6864 
-       0.2782 0.4392 0.6951 0.9501 1.3151 1.5618 1.8651 2.1550 2.4891 2.7237 
-       0.2801 0.3536 0.7369 1.1399 1.3120 1.5235 1.7564 1.9534 2.5079 2.6729 
-       0.1942 0.2861 0.4241 0.9135 1.4995 1.6658 1.8824 2.1044 2.3794 2.6924 
-       0.1848 0.2642 0.4669 0.8099 1.1814 1.3632 1.8145 2.0406 2.3029 2.4852 
-       0.1876 0.2791 0.4590 0.7803 0.9716 1.2344 1.7653 1.9954 2.3031 2.4919 
-       0.2118 0.3546 0.5173 0.8545 1.0944 1.2773 1.5391 1.7636 2.5227 2.7473 
-       0.3702 0.5754 0.7567 0.9470 1.2418 1.4175 1.6937 1.9781 2.2335 2.4379 
-       0.2994 0.3896 0.7103 0.9276 1.1109 1.5065 1.7855 1.9749 2.5348 2.6989 
-       0.1669 0.2410 0.4275 0.6556 1.0301 1.2090 1.6554 1.9960 2.2732 2.7085 
-       0.2147 0.3188 0.4951 1.1641 1.3285 1.5939 1.8097 2.2924 2.5835 2.7804 
-       0.2993 0.4572 0.6620 0.8856 1.0647 1.3143 1.9459 2.1805 2.4665 2.6892 
-       0.2834 0.4582 1.1467 1.4071 1.6675 1.8805 2.0877 2.2818 2.5478 2.7149 
-       0.4616 0.6943 1.0694 1.3309 1.6226 1.8894 2.2023 2.3914 2.6245 2.7663 
-       0.3407 0.4436 0.7198 0.9888 1.1796 1.3665 1.5898 1.8618 2.4254 2.5902 
-       0.2732 0.3898 0.5375 0.8858 1.2724 1.4400 1.7338 1.9968 2.2495 2.4836 
-       0.2131 0.3241 0.4965 0.7160 1.2157 1.3966 1.6804 2.1688 2.4174 2.6745 
-       0.2469 0.4291 0.6036 0.7812 1.2001 1.3969 1.6161 2.0469 2.3207 2.5517 
-       0.1485 0.2434 0.4256 1.0104 1.3060 1.5364 1.9441 2.1716 2.5517 2.7629 
-       0.1874 0.2675 0.4621 0.6966 1.2937 1.4904 1.7493 1.9962 2.2875 2.4444 
-       0.3439 0.5125 0.8961 1.2283 1.6415 1.8526 2.1285 2.3249 2.5596 2.7308 
-       0.1505 0.2717 0.7294 0.9670 1.2517 1.4743 1.8532 2.1339 2.4972 2.7315 
-       0.1350 0.1930 0.3427 0.5386 0.8454 1.1797 1.6950 1.9516 2.3599 2.7012 
-       0.2176 0.3366 0.5235 0.9077 1.0848 1.5432 1.8776 2.1216 2.5428 2.7217 
-       0.3014 0.3904 0.6168 0.7906 0.9655 1.5106 1.7991 1.9911 2.5273 2.6787 
-       0.1367 0.2172 0.3931 0.8468 1.1326 1.3594 1.6932 1.8975 2.3663 2.6332 
-       0.2887 0.4712 0.6418 0.8754 1.3482 1.5325 1.7649 2.0353 2.3070 2.4830 
-       0.1483 0.2244 0.6148 0.8199 1.0681 1.3115 1.7512 2.0202 2.4751 2.7189 
-       0.4893 0.7042 0.9602 1.1855 1.4384 1.6609 1.9721 2.2007 2.4766 2.6608 
-       0.2090 0.2716 0.5730 0.8007 1.4094 1.6658 1.9273 2.2034 2.5187 2.7289 
-       0.2523 0.3927 0.5506 0.7813 1.3441 1.5397 1.7531 2.1277 2.3804 2.5818 
-       0.1522 0.2343 0.4990 1.0387 1.4201 1.7548 2.1013 2.3461 2.6402 2.8172 
-       0.1769 0.2704 0.4287 0.7267 1.2940 1.4642 1.9797 2.2008 2.4983 2.7310 
-       0.3926 0.5534 0.9519 1.1643 1.3749 1.5545 1.8195 2.0650 2.4053 2.6192 
-       0.1216 0.1753 0.3177 0.5209 1.1123 1.3918 1.7803 2.0468 2.4208 2.7579 
-       0.2275 0.4219 0.5920 0.7925 1.0098 1.1834 1.6747 1.9399 2.2123 2.6777 
-       0.3513 0.4333 0.7414 1.1633 1.3557 1.5613 1.9002 2.1023 2.4813 2.6792 
-       0.1805 0.2762 0.4687 1.0362 1.2487 1.4739 1.7645 1.9964 2.3579 2.5870 
-       0.1650 0.2325 0.3927 0.5699 1.3112 1.5287 1.8092 2.0778 2.3406 2.6345 
-       0.2073 0.3261 0.5129 0.7185 1.1010 1.2870 1.5341 2.0697 2.3255 2.5546 
-       0.2637 0.3758 0.5427 1.0661 1.2785 1.4782 1.8293 2.0197 2.5442 2.7447 
-       0.3518 0.4465 0.6788 1.0214 1.2058 1.3951 1.8217 2.0068 2.2953 2.6047 
-       0.2520 0.3495 0.5606 1.0545 1.4043 1.5693 1.9423 2.1639 2.4292 2.6359 
-       0.2052 0.3142 0.4657 0.6797 0.8644 1.0609 1.6940 1.9925 2.3114 2.5765 
-       0.1597 0.2850 0.4431 0.8797 1.1379 1.3253 1.8077 1.9974 2.5697 2.7600 
-       0.2704 0.5130 0.7074 0.9081 1.2218 1.3973 1.7209 2.0897 2.3723 2.5672 
-       0.1979 0.3157 0.4424 0.6863 1.3914 1.6539 1.8489 2.1366 2.3713 2.5897 
-       0.1831 0.2738 0.4569 0.7913 1.1047 1.3384 1.6874 1.9033 2.1215 2.2992 
-       0.1547 0.2436 0.4290 0.6646 0.8508 1.4500 1.7414 2.0040 2.5020 2.7217 
-       0.2365 0.3103 0.6833 1.0242 1.6000 1.8179 2.0437 2.2433 2.4953 2.6656 
-       0.3520 0.4860 0.8339 1.1147 1.5155 1.7047 1.9530 2.1948 2.4500 2.6365 
-       0.2076 0.2908 0.7235 0.9151 1.1783 1.3678 1.7172 2.0573 2.3534 2.5666 
-       0.1728 0.2792 0.4252 0.8989 1.3595 1.5128 1.7950 1.9827 2.5640 2.7569 
-       0.1745 0.2588 0.4083 0.5967 1.1944 1.7594 1.9682 2.1809 2.4264 2.6352 
-       0.1576 0.2379 0.3844 0.9002 1.5739 1.7294 1.9991 2.2252 2.5406 2.7395 
-       0.1590 0.2374 0.4064 0.6555 1.2164 1.4072 1.7393 1.9394 2.5174 2.7430 
-       0.4886 0.6711 0.8582 1.0439 1.2552 1.4417 1.8238 2.0966 2.3791 2.5812 
-       0.2051 0.3085 0.4398 0.7621 1.4911 1.8260 1.9903 2.1831 2.4109 2.5801 
-       0.3120 0.4273 0.6226 0.8492 1.0291 1.2194 1.7417 2.0374 2.2845 2.4926 
-       0.2005 0.3242 0.4832 0.7931 1.0221 1.2054 1.8914 2.1318 2.4332 2.7511 
-       0.2252 0.4091 0.5698 0.8823 1.1331 1.3113 1.7990 1.9996 2.3674 2.7118 
-       0.4395 0.6887 1.1368 1.3646 1.5815 1.7778 2.0206 2.2271 2.5163 2.6897 
-       0.3068 0.3953 0.6710 0.8584 1.0526 1.5481 1.8187 2.0131 2.3237 2.5077 
-       0.3999 0.5240 0.7133 0.9845 1.3603 1.5261 1.7888 2.0948 2.3560 2.5175 
-       0.4128 0.5257 0.7499 0.9281 1.1052 1.5338 1.8865 2.0833 2.5113 2.6860 
-       0.2268 0.5364 0.8215 1.0488 1.2645 1.4868 1.8685 2.1692 2.4996 2.7297 
-       0.2220 0.3369 0.4770 0.6673 0.8402 1.0480 1.9389 2.2364 2.5056 2.7767 
-       0.4037 0.5540 0.7367 0.9263 1.1114 1.2888 1.7503 2.0741 2.3214 2.5323 
-       0.2521 0.3693 0.5398 0.7362 0.9155 1.0727 1.5763 2.1858 2.4527 2.6618 
-       0.1489 0.2149 0.3727 0.5700 0.9049 1.1900 1.6205 1.8790 2.1601 2.3320 
-       0.1847 0.2632 0.4350 1.3060 1.5308 1.7242 2.0072 2.2530 2.5575 2.7530 
-       0.2075 0.3405 0.5168 0.8045 1.1630 1.3270 1.6556 1.8807 2.1707 2.7007 
-       0.2232 0.3092 0.4996 0.7629 1.2442 1.8194 2.0729 2.2511 2.5128 2.6962 
-       0.2044 0.2831 0.6379 0.8276 1.2594 1.5083 1.7621 1.9768 2.3941 2.5925 
-       0.2566 0.4715 0.6754 0.8465 1.0929 1.2802 1.5230 2.0233 2.3058 2.5254 
-       0.1728 0.2480 0.3956 0.5761 1.3228 1.8431 2.0752 2.2605 2.5850 2.7719 
-       0.2336 0.3500 0.5382 0.7161 1.1749 1.6151 1.8457 2.1034 2.5132 2.6961 
-       0.1626 0.2245 0.4010 0.5814 1.1522 1.3662 1.6484 1.9770 2.2715 2.4647 
-       0.5064 0.8353 1.2534 1.4713 1.7581 1.9661 2.1943 2.3698 2.5851 2.7201 
-       0.1130 0.2084 0.7565 1.0949 1.4016 1.6644 1.9825 2.2510 2.5828 2.7910 
-       0.2126 0.2938 0.7026 0.9381 1.4298 1.6365 1.8854 2.1055 2.4127 2.6110 
-       0.1614 0.2645 0.4155 0.6642 0.8507 1.1249 1.8711 2.0782 2.5291 2.7432 
-       0.2586 0.3414 0.4880 1.0008 1.5909 1.8256 2.0031 2.1976 2.4261 2.5968 
-       0.1673 0.2558 0.3886 0.5882 1.5263 1.7804 1.9941 2.2378 2.4797 2.7040 
-       0.1448 0.2216 0.4007 0.7222 1.0049 1.4014 1.7176 1.9074 2.1345 2.6733 
-       0.2047 0.4294 0.5915 0.8014 0.9788 1.1973 1.7570 1.9584 2.5234 2.7386 
-       0.2475 0.3425 0.5105 0.7038 0.8549 1.3804 1.9609 2.1499 2.5170 2.6911 
-       0.1982 0.2876 0.4529 1.1780 1.4156 1.5881 1.8443 2.0405 2.5394 2.7164 
-       0.2335 0.4039 0.7689 1.1114 1.3960 1.7002 2.0436 2.3134 2.6207 2.8013 
-       0.1507 0.2238 0.4358 0.7731 1.0890 1.5243 1.8333 2.0400 2.3737 2.7067 
-       0.2541 0.3993 0.6220 0.8230 1.1039 1.2991 1.5801 2.1739 2.5225 2.7008 
-       0.2543 0.3728 0.5599 0.8109 1.4458 1.7316 1.9325 2.1289 2.3867 2.5548 
-       0.2260 0.3130 0.6481 0.8326 1.0378 1.3403 1.6607 1.9169 2.2469 2.4594 
-       0.3529 0.5530 0.8657 1.0988 1.3804 1.6333 1.9592 2.2094 2.5405 2.7394 
-       0.1026 0.1545 0.3283 0.8287 1.2123 1.5327 1.8629 2.1381 2.5010 2.7817 
-       0.3150 0.5394 0.9199 1.2263 1.4777 1.8015 2.1354 2.3972 2.6672 2.8213 
-       0.1836 0.2766 0.4200 0.5903 0.7749 0.9537 1.6318 2.1226 2.4240 2.7110 
-       0.2997 0.3708 0.6137 1.1349 1.3715 1.5328 1.8146 2.0103 2.2614 2.5400 
-       0.4199 0.5157 0.7955 1.0556 1.2265 1.4824 1.8047 2.0097 2.4818 2.6784 
-       0.2618 0.3266 0.5846 1.1892 1.5473 1.6985 1.9038 2.1166 2.3609 2.5916 
-       0.0852 0.1507 0.5832 0.9281 1.2390 1.5409 1.8268 2.1237 2.4848 2.7556 
-       0.2296 0.3152 0.6005 0.9924 1.2153 1.4437 1.7335 1.9371 2.1647 2.3545 
-       0.1950 0.2658 0.5889 1.2970 1.6235 1.7986 2.1255 2.3258 2.5837 2.7473 
-       0.2120 0.3353 0.5072 0.7848 0.9818 1.1919 1.4731 1.7419 2.1646 2.4352 
-       0.3148 0.4107 0.5890 0.7912 0.9374 1.1670 1.8583 2.1654 2.4073 2.6118 
-       0.3546 0.5179 1.0110 1.2769 1.4836 1.6974 1.9885 2.2092 2.5144 2.7007 
-       0.2342 0.3076 0.8029 1.3718 1.5773 1.7549 2.0162 2.2209 2.5384 2.7040 
-       0.3588 0.4791 0.6896 0.8763 1.0393 1.2816 1.7453 1.9395 2.4555 2.6853 
-       0.2030 0.2859 0.5600 0.7655 1.0689 1.5931 1.8341 2.0201 2.2169 2.4952 
-       0.2469 0.3202 0.6416 1.2561 1.4636 1.6476 1.9578 2.1515 2.5350 2.7118
+10 256
+       0.1758 0.2325 0.3916 0.5606 1.0626 1.5769 2.1164 2.2761 2.5949 2.7999 
+       0.1521 0.2404 0.3772 0.9015 1.4054 1.5579 1.7947 1.9811 2.4882 2.6900 
+       0.4223 0.6056 0.9696 1.1914 1.3841 1.5672 1.8329 2.0743 2.4116 2.6234 
+       0.1313 0.2163 0.4031 1.0425 1.3249 1.5738 1.9110 2.1936 2.5496 2.7544 
+       0.2999 0.3797 0.5583 0.9155 1.5153 1.8028 1.9851 2.1696 2.4251 2.5761 
+       0.2125 0.3332 0.4977 0.7872 0.9833 1.1857 1.4595 1.7210 2.1291 2.3781 
+       0.1591 0.2184 0.3912 0.5746 0.8492 1.4360 1.7276 1.9613 2.2853 2.5012 
+       0.2197 0.2949 0.6634 0.8397 1.0910 1.3576 1.6756 1.8970 2.3438 2.5339 
+       0.4189 0.5330 0.7211 1.0209 1.3794 1.5377 1.7934 2.0949 2.3568 2.5091 
+       0.1257 0.1993 0.6106 1.0936 1.4385 1.6787 1.9458 2.1916 2.5018 2.7395 
+       0.2827 0.4198 0.5761 0.8855 1.2018 1.3521 1.5792 1.7611 2.0888 2.6451 
+       0.1798 0.3052 0.4330 0.7897 1.3711 1.5213 1.8613 2.0291 2.5364 2.7726 
+       0.0883 0.1298 0.3197 0.8644 1.2367 1.5544 1.8702 2.1623 2.5103 2.7934 
+       0.1668 0.2484 0.4062 0.7731 1.4153 1.6018 1.9432 2.1927 2.4356 2.6769 
+       0.2660 0.4510 0.6057 0.7803 1.2113 1.4123 1.6018 2.0197 2.2951 2.5269 
+       0.1970 0.2923 0.4497 0.6660 1.2242 1.7391 1.9464 2.1688 2.4235 2.6251 
+       0.2043 0.3011 0.4879 1.2240 1.3719 1.6341 1.8456 2.3066 2.5951 2.7749 
+       0.1960 0.3449 0.5090 0.8307 1.0628 1.2440 1.5223 1.7436 2.5741 2.7868 
+       0.3422 0.4983 1.0662 1.2989 1.4978 1.6881 1.9339 2.1477 2.4571 2.6527 
+       0.1725 0.2411 0.4273 0.6199 1.0212 1.2024 1.5354 2.0466 2.3228 2.6426 
+       0.1752 0.2453 0.3888 0.5690 1.3755 1.8733 2.0960 2.2699 2.5990 2.7772 
+       0.2163 0.2928 0.5757 1.1500 1.4922 1.6758 2.0768 2.2616 2.5238 2.7015 
+       0.1527 0.2148 0.3752 0.5928 1.1300 1.3139 1.7715 1.9751 2.2517 2.7336 
+       0.2793 0.3756 0.5507 0.7341 0.8864 1.4654 1.9608 2.1310 2.4776 2.6431 
+       0.1568 0.2467 0.3955 0.8493 1.2988 1.4984 2.0480 2.2761 2.6066 2.8025 
+       0.2211 0.3091 0.6485 1.1112 1.3016 1.5266 1.8555 2.0720 2.3781 2.5747 
+       0.2012 0.2778 0.7755 1.3916 1.6557 1.8476 2.1327 2.3197 2.5862 2.7458 
+       0.4200 0.6053 0.8969 1.1622 1.4849 1.6800 1.9658 2.1983 2.4634 2.6417 
+       0.1524 0.2137 0.3660 0.5431 1.0506 1.5835 1.8941 2.0930 2.3506 2.6062 
+       0.2539 0.3298 0.4880 1.0866 1.6389 1.8590 2.0297 2.2238 2.4305 2.5985 
+       0.1490 0.2354 0.3523 0.5899 1.5254 1.7098 1.9930 2.2424 2.5434 2.7675 
+       0.3292 0.5926 0.7600 0.9593 1.3205 1.4874 1.7354 2.0276 2.2777 2.4770 
+       0.2279 0.3568 0.5061 0.9325 1.1228 1.3460 1.9175 2.1015 2.5629 2.7649 
+       0.3251 0.4002 0.6573 1.1360 1.3333 1.4974 1.8122 1.9791 2.3106 2.6294 
+       0.1715 0.2795 0.4261 1.0318 1.2758 1.4591 1.8327 2.0086 2.6243 2.7997 
+       0.2652 0.3435 0.4778 0.9549 1.5217 1.7191 1.8950 2.1142 2.3158 2.4999 
+       0.3935 0.5384 0.7142 0.8996 1.2181 1.3894 1.6082 1.9749 2.3746 2.5363 
+       0.2416 0.3049 0.8079 1.3759 1.5411 1.7090 1.9377 2.1433 2.5408 2.6971 
+       0.2059 0.3193 0.4920 0.8434 1.0095 1.4318 1.7810 1.9819 2.4335 2.6197 
+       0.4156 0.5149 0.7530 0.9292 1.1012 1.6025 1.8856 2.0881 2.5362 2.6869 
+       0.2269 0.4375 0.5934 0.7849 0.9785 1.1460 1.6544 1.8826 2.1561 2.6623 
+       0.3085 0.3934 0.6059 0.7601 0.9255 1.3825 1.7690 1.9514 2.3718 2.5482 
+       0.1896 0.3181 0.4753 0.7925 0.9724 1.1929 1.9433 2.1486 2.5434 2.7600 
+       0.1163 0.1776 0.3435 0.7213 1.0756 1.3618 1.8124 2.0266 2.4264 2.7561 
+       0.1640 0.2611 0.4637 0.6976 0.8929 1.3606 1.6637 1.8628 2.5272 2.7552 
+       0.1921 0.2518 0.5555 0.7407 1.3333 1.5577 1.7845 2.1064 2.4157 2.6185 
+       0.2331 0.3536 0.5005 0.7809 1.3358 1.5083 1.7333 2.1940 2.4437 2.6632 
+       0.2056 0.2853 0.6215 0.8327 1.1414 1.5483 1.7742 1.9407 2.1665 2.5996 
+       0.3208 0.4780 0.9442 1.3425 1.5282 1.7582 2.0464 2.2526 2.5865 2.7716 
+       0.2752 0.3570 0.6803 1.0739 1.2423 1.6180 1.8955 2.0892 2.5536 2.7164 
+       0.1652 0.2401 0.3748 0.5366 1.1697 1.8183 2.0168 2.2192 2.4511 2.6629 
+       0.1923 0.2578 0.5457 0.7913 1.0920 1.3526 1.8263 2.0704 2.3184 2.4883 
+       0.2224 0.3361 0.5039 0.9147 1.1599 1.3169 1.8463 2.0467 2.3014 2.6788 
+       0.2708 0.4679 0.6315 0.8213 0.9755 1.2014 1.8963 2.1636 2.4957 2.7522 
+       0.2313 0.3366 0.4789 0.6823 0.8660 1.0114 1.6931 2.3064 2.5454 2.7355 
+       0.3929 0.4783 0.8189 1.0752 1.2229 1.5766 1.9033 2.0991 2.5274 2.6876 
+       0.1614 0.4036 0.5796 0.8109 1.0455 1.2314 1.8061 1.9904 2.4918 2.7303 
+       0.2238 0.3274 0.4851 1.0162 1.2151 1.4275 1.6030 2.2531 2.5822 2.7636 
+       0.1496 0.2156 0.5937 0.7803 1.0021 1.2467 1.7271 2.0531 2.4477 2.7164 
+       0.2352 0.3707 0.7219 1.0819 1.4089 1.7501 2.0830 2.3376 2.6257 2.7939 
+       0.4415 0.5969 0.7706 0.9507 1.1369 1.3044 1.7731 2.1115 2.3365 2.5230 
+       0.2695 0.5174 0.7114 0.9150 1.2299 1.3929 1.7219 2.1080 2.3765 2.5648 
+       0.3723 0.5722 1.2061 1.4462 1.7032 1.9061 2.1227 2.3038 2.5600 2.7230 
+       0.1831 0.2880 0.4092 0.6519 1.4638 1.7207 1.9117 2.1251 2.3508 2.5557 
+       0.1102 0.2082 0.7891 1.1167 1.3907 1.6560 1.9993 2.2804 2.6209 2.8167 
+       0.2266 0.3315 0.5169 0.9196 1.0896 1.6117 1.9061 2.1366 2.5239 2.7008 
+       0.1925 0.2798 0.4606 0.7672 1.3114 1.4917 1.7614 1.9867 2.2726 2.4307 
+       0.2374 0.3578 0.5345 0.7479 1.0785 1.2451 1.6256 2.1214 2.3719 2.6338 
+       0.3256 0.4565 0.8271 1.1259 1.5653 1.7512 2.0054 2.2188 2.4539 2.6376 
+       0.2641 0.3886 0.5392 0.8270 1.2268 1.3692 1.7609 2.0394 2.2798 2.4842 
+       0.2292 0.3151 0.5033 0.6891 1.2249 1.7483 1.9852 2.2207 2.6241 2.7848 
+       0.1589 0.2401 0.4610 0.7210 0.9040 1.4414 1.8311 2.0575 2.3484 2.6672 
+       0.1524 0.2251 0.3907 0.6566 0.9320 1.1413 1.8153 2.0413 2.5131 2.7433 
+       0.0548 0.1327 0.6153 0.8976 1.2395 1.5467 1.8695 2.1401 2.5115 2.7860 
+       0.1795 0.2856 0.6961 0.8736 1.0785 1.3317 1.8714 2.1495 2.4956 2.7196 
+       0.2300 0.3053 0.4911 0.8705 1.6588 1.8946 2.1084 2.3044 2.5459 2.7079 
+       0.2635 0.3343 0.7564 1.1663 1.3193 1.5151 1.7293 1.9271 2.5175 2.6794 
+       0.2207 0.3314 0.4602 0.8075 1.4348 1.6423 1.8436 2.0873 2.3053 2.4962 
+       0.1585 0.2374 0.3722 0.8613 1.5772 1.7433 2.0593 2.2968 2.5824 2.7682 
+       0.2304 0.4589 0.6449 0.8472 1.1364 1.3054 1.7034 1.9975 2.2511 2.7122 
+       0.2166 0.3117 0.5057 0.6720 1.0672 1.5733 1.7716 2.1047 2.3765 2.5770 
+       0.2986 0.4949 0.6756 0.8920 1.1973 1.3641 1.7307 1.9937 2.2331 2.4665 
+       0.1523 0.2185 0.4022 0.8087 1.2387 1.4784 1.8394 2.0542 2.3875 2.6580 
+       0.1720 0.2535 0.3862 0.5572 1.4541 1.7965 1.9742 2.1872 2.4175 2.6449 
+       0.1745 0.2513 0.3982 0.8738 1.5685 1.7377 1.9246 2.1456 2.4042 2.7151 
+       0.1912 0.2525 0.6574 0.8539 1.2780 1.4585 1.7809 2.0333 2.3286 2.5247 
+       0.2338 0.3282 0.5605 1.0661 1.3060 1.5106 2.0005 2.2183 2.5211 2.7188 
+       0.1804 0.2678 0.4272 0.6533 0.8381 1.0226 1.7006 1.9531 2.3067 2.5542 
+       0.5629 0.9651 1.2818 1.4798 1.7544 1.9414 2.1655 2.3402 2.5563 2.6872 
+       0.2084 0.3219 0.4788 0.7050 0.8887 1.0577 1.7453 2.0386 2.2877 2.7504 
+       0.2365 0.6242 0.9315 1.1573 1.3936 1.6484 1.9768 2.2345 2.5289 2.7227 
+       0.3701 0.4643 0.7065 1.0603 1.2288 1.4150 1.9021 2.0919 2.3629 2.5844 
+       0.3189 0.4096 0.6377 0.8815 1.0448 1.2501 1.4944 1.6774 2.3905 2.6020 
+       0.1522 0.2386 0.3880 0.6325 1.2665 1.4377 1.7310 1.9141 2.5610 2.7797 
+       0.3117 0.3923 0.5812 0.7486 0.8815 1.2034 1.9645 2.1964 2.4322 2.6216 
+       0.2827 0.4232 0.5786 0.8290 1.4322 1.6840 1.8718 2.0862 2.3631 2.5200 
+       0.3438 0.4998 0.8579 1.1283 1.5329 1.8031 2.1248 2.3573 2.5990 2.7643 
+       0.1212 0.1709 0.3039 0.5338 1.2153 1.4955 1.8535 2.1107 2.4890 2.7774 
+       0.2421 0.3119 0.7298 1.0887 1.6384 1.8612 2.0820 2.2694 2.4988 2.6617 
+       0.2095 0.2764 0.5724 0.8658 1.4650 1.6787 1.9541 2.2196 2.5420 2.7509 
+       0.2191 0.3270 0.4370 0.8278 1.5300 1.8285 1.9944 2.1749 2.4027 2.5602 
+       0.2094 0.3048 0.4604 0.6568 0.8430 1.7034 1.9470 2.1657 2.4619 2.6636 
+       0.2469 0.3806 0.5348 0.8046 0.9852 1.1631 1.8391 2.0935 2.3307 2.7203 
+       0.2496 0.4449 0.6090 0.7998 0.9565 1.1630 1.6812 1.8863 2.5161 2.7114 
+       0.1438 0.2054 0.3547 0.5545 0.8644 1.1426 1.5377 1.8044 2.1109 2.2725 
+       0.2908 0.3648 0.7277 0.9116 1.0909 1.5579 1.7850 1.9939 2.5543 2.6963 
+       0.2133 0.2985 0.6842 0.8861 1.3707 1.6107 1.8178 1.9834 2.4537 2.6553 
+       0.2895 0.4700 0.6332 0.8526 1.3345 1.5188 1.7413 2.0823 2.4063 2.5756 
+       0.1578 0.2169 0.3704 0.5288 0.9807 1.2198 1.7834 2.0368 2.2934 2.4844 
+       0.2194 0.5249 0.8201 1.0401 1.2425 1.4544 1.8444 2.1393 2.4807 2.7174 
+       0.3707 0.4796 0.6803 0.9829 1.1510 1.3575 1.7494 1.9194 2.4520 2.6604 
+       0.2347 0.3743 0.5113 0.8843 1.2936 1.4434 1.7405 1.9574 2.2134 2.6639 
+       0.1897 0.2704 0.4872 1.0280 1.2828 1.4817 1.7984 1.9971 2.2526 2.4473 
+       0.3061 0.4827 0.7275 0.8994 1.0813 1.2700 1.6292 2.0770 2.5188 2.6817 
+       0.1806 0.2611 0.4129 0.6188 1.2706 1.4448 1.9339 2.2086 2.4997 2.7195 
+       0.2047 0.3245 0.5019 0.7067 1.1818 1.3708 1.5811 2.0002 2.2534 2.4636 
+       0.3587 0.5011 0.8490 1.0702 1.3980 1.6004 1.8911 2.1472 2.4435 2.6474 
+       0.2596 0.3730 0.5779 0.7402 1.2139 1.6142 1.8509 2.0492 2.5275 2.7046 
+       0.2271 0.3349 0.4802 1.0031 1.3797 1.5277 1.8661 2.0556 2.4635 2.7341 
+       0.1396 0.2158 0.5107 1.0619 1.3869 1.7494 2.1243 2.3798 2.6589 2.8261 
+       0.3684 0.4655 0.6615 0.8541 1.0034 1.1941 1.8027 2.1481 2.3677 2.5518 
+       0.2088 0.3135 0.9364 1.2445 1.4724 1.7126 1.9704 2.2088 2.4965 2.6824 
+       0.1733 0.2577 0.4400 0.8798 1.1278 1.3281 1.7297 1.9569 2.1910 2.5702 
+       0.3565 0.5674 0.7572 0.9267 1.1044 1.3307 1.8773 2.1678 2.4682 2.7092 
+       0.1928 0.2750 0.5010 0.7396 0.9972 1.5784 1.8464 2.0140 2.2003 2.4308 
+       0.3765 0.4597 0.7343 1.0932 1.2558 1.4780 1.7493 1.9366 2.5092 2.6906 
+       0.1800 0.2482 0.4743 1.2136 1.6519 1.8203 2.1425 2.3563 2.6016 2.7602 
+       0.2668 0.3960 0.5822 0.8525 1.0589 1.2445 1.7485 1.9852 2.2436 2.4535 
+       0.2348 0.3653 0.4907 0.7280 1.4211 1.7185 1.8921 2.1629 2.4253 2.6101 
+       0.1881 0.2837 0.7011 0.8638 1.2560 1.4354 1.7457 2.1517 2.4840 2.6841 
+       0.1726 0.2317 0.3971 0.5719 1.2753 1.4877 1.8210 2.0346 2.2805 2.4501 
+       0.2021 0.2694 0.4830 0.7346 1.1601 1.8231 2.1155 2.2877 2.5468 2.7307 
+       0.2253 0.3033 0.5790 0.7854 1.2533 1.7287 1.9596 2.1398 2.3553 2.5466 
+       0.1606 0.2248 0.3847 0.5574 1.1029 1.3482 1.5998 1.9156 2.1986 2.3804 
+       0.4353 0.6414 1.0148 1.2530 1.4888 1.7403 2.0825 2.3003 2.5836 2.7395 
+       0.1784 0.2818 0.4341 0.7948 0.9689 1.2203 1.7275 1.9251 2.4207 2.6003 
+       0.1762 0.2560 0.4179 0.7303 0.9629 1.2267 1.7455 1.9819 2.2271 2.4031 
+       0.3984 0.5801 0.9777 1.2731 1.6563 1.8474 2.0826 2.2676 2.4987 2.6701 
+       0.1354 0.2314 0.7761 1.0489 1.2961 1.5164 1.8681 2.1520 2.4995 2.7470 
+       0.2991 0.3988 0.5915 1.0276 1.2258 1.4250 1.8799 2.0505 2.4493 2.6856 
+       0.2010 0.3027 0.4291 0.8210 1.4090 1.5818 1.8218 2.0340 2.2635 2.7229 
+       0.2308 0.2929 0.6434 1.3581 1.5807 1.7420 2.0403 2.2290 2.5418 2.7080 
+       0.2994 0.3718 0.7711 0.9572 1.1657 1.7457 1.9881 2.1990 2.5254 2.6661 
+       0.2109 0.3561 0.6545 0.8223 1.1384 1.3517 1.5612 2.0152 2.4674 2.6558 
+       0.2393 0.3220 0.4971 1.0610 1.5257 1.6839 1.9273 2.1383 2.4156 2.6338 
+       0.1683 0.2504 0.3877 0.5873 1.4056 1.6155 1.8563 2.0790 2.3342 2.7347 
+       0.3831 0.5037 0.7021 0.8808 1.0336 1.2668 1.7299 1.9225 2.3112 2.6202 
+       0.2773 0.3402 0.7620 1.2645 1.4406 1.6097 1.8339 2.0245 2.5119 2.6789 
+       0.3363 0.5632 0.9721 1.2637 1.4991 1.8532 2.1985 2.4537 2.6995 2.8389 
+       0.3280 0.5088 0.8570 1.1350 1.3925 1.6439 1.9898 2.2625 2.6084 2.8047 
+       0.1597 0.2245 0.5593 0.9273 1.2507 1.5549 1.8541 2.1311 2.4626 2.7196 
+       0.3347 0.4067 0.6692 0.8024 1.0221 1.7071 1.9284 2.1468 2.5107 2.6445 
+       0.2847 0.3728 0.5354 0.9063 1.3961 1.5670 1.7828 2.0433 2.2688 2.4525 
+       0.2610 0.3508 0.8032 0.9859 1.2244 1.5762 1.8581 2.1030 2.4214 2.6103 
+       0.1752 0.3509 0.4991 0.7944 1.2337 1.3808 1.7722 1.9542 2.4782 2.7242 
+       0.1469 0.2596 0.4097 0.8394 1.1407 1.3077 1.8196 2.0045 2.5870 2.7816 
+       0.2211 0.3087 0.5999 0.8710 1.1798 1.4936 1.7728 1.9554 2.1406 2.3143 
+       0.1509 0.2284 0.4038 0.7064 1.0916 1.5342 1.8030 1.9716 2.2134 2.6886 
+       0.1876 0.4389 0.7433 0.9568 1.2191 1.5924 1.9645 2.2533 2.5997 2.7830 
+       0.2436 0.4034 0.5910 0.7788 1.2218 1.3931 1.6745 2.1690 2.4051 2.6372 
+       0.1067 0.1707 0.4182 0.9338 1.1840 1.4622 1.7338 1.9712 2.3144 2.6564 
+       0.1924 0.2911 0.4683 0.6795 1.1941 1.3722 1.5996 2.1404 2.3909 2.6000 
+       0.3157 0.4695 0.6310 0.8589 1.3236 1.5054 1.7412 2.0118 2.2522 2.4449 
+       0.3348 0.4388 0.6798 0.8653 1.0403 1.4575 2.0259 2.2035 2.5229 2.6958 
+       0.1513 0.4688 0.8822 1.2424 1.4726 1.7809 2.1290 2.3844 2.6710 2.8350 
+       0.1650 0.2578 0.4115 0.8528 1.1635 1.3411 1.5985 1.7965 2.4082 2.6618 
+       0.1271 0.2409 0.8401 1.2151 1.5597 1.8711 2.1836 2.4189 2.6611 2.8231 
+       0.1496 0.4338 0.7746 1.1129 1.4141 1.6232 1.9263 2.2016 2.5130 2.7624 
+       0.1905 0.2838 0.4213 0.6682 1.5214 1.8759 2.0589 2.2379 2.4936 2.6636 
+       0.2456 0.4494 0.5896 0.9095 1.1140 1.2965 1.7243 1.9015 2.4002 2.6808 
+       0.2169 0.3407 0.5440 0.7308 0.9420 1.1116 1.4378 2.0193 2.3458 2.6192 
+       0.2677 0.4433 0.6157 0.7994 1.1118 1.5315 1.7649 2.1983 2.6092 2.7728 
+       0.1943 0.3031 0.4438 0.6802 1.0895 1.2501 1.8642 2.1387 2.4124 2.7289 
+       0.4297 0.7171 1.1938 1.4019 1.5945 1.7721 2.0149 2.2262 2.5182 2.6865 
+       0.2817 0.5028 0.6943 0.8618 1.1096 1.2979 1.5103 1.9636 2.2656 2.4536 
+       0.2243 0.3890 0.6784 0.9140 1.3747 1.5441 1.8364 2.1029 2.3665 2.5412 
+       0.3574 0.4900 0.6644 0.9247 1.4299 1.6309 1.8339 2.0677 2.3399 2.5100 
+       0.2049 0.3166 0.4561 0.6597 0.8180 1.2661 1.8436 2.0563 2.3772 2.5481 
+       0.5215 0.6958 0.8630 1.0637 1.2808 1.4517 1.8167 2.0873 2.3548 2.5445 
+       0.1920 0.2967 0.4607 1.0024 1.2106 1.4533 1.7725 1.9554 2.4279 2.6166 
+       0.1961 0.3152 0.4661 0.7012 1.2565 1.4225 1.7517 2.0288 2.2747 2.7254 
+       0.2361 0.3248 0.7769 0.9618 1.1800 1.3709 1.7349 2.0322 2.3025 2.5319 
+       0.1507 0.2299 0.3858 0.7118 0.9747 1.3748 1.6886 1.8747 2.0889 2.6390 
+       0.2091 0.2900 0.7508 1.0339 1.4566 1.6563 1.9297 2.1663 2.4403 2.6298 
+       0.2137 0.3071 0.5570 0.7583 0.9379 1.3126 1.6630 1.9210 2.2291 2.4279 
+       0.2668 0.3438 0.6963 1.2648 1.4357 1.6588 1.9702 2.1460 2.5448 2.7099 
+       0.2970 0.4487 0.6175 0.8613 1.0050 1.3940 1.8076 1.9894 2.5570 2.7420 
+       0.4762 0.7388 1.2244 1.4707 1.7598 1.9985 2.2389 2.4028 2.6244 2.7586 
+       0.1499 0.2423 0.3628 0.6927 1.4805 1.6390 1.8853 2.0631 2.5860 2.7761 
+       0.2697 0.3585 0.5474 0.7091 0.9169 1.7121 2.0156 2.2277 2.5745 2.7249 
+       0.2710 0.3558 0.5486 1.1625 1.3530 1.5316 1.8323 2.0087 2.5642 2.7372 
+       0.2633 0.3563 0.5213 0.9584 1.4262 1.5873 1.8383 2.1652 2.3959 2.5696 
+       0.3848 0.4786 0.7087 1.0104 1.1913 1.3713 1.7547 1.9247 2.2100 2.5835 
+       0.2271 0.2927 0.6275 0.8523 1.5725 1.7959 1.9890 2.1862 2.4165 2.5896 
+       0.2181 0.3144 0.4475 0.6284 0.7800 1.3021 2.0094 2.1909 2.5936 2.7693 
+       0.3266 0.4408 0.6486 0.9220 1.0907 1.3106 1.8829 2.0679 2.3198 2.6010 
+       0.1837 0.2617 0.4122 1.3626 1.5493 1.7333 2.0105 2.2742 2.5643 2.7559 
+       0.2976 0.4485 0.7169 0.9778 1.3471 1.5838 1.8802 2.1805 2.5009 2.7376 
+       0.2328 0.3312 0.5098 1.0009 1.1994 1.3786 1.6356 1.9070 2.2851 2.4968 
+       0.2794 0.3826 0.5417 0.7564 0.9045 1.0999 1.6871 2.0486 2.3119 2.5024 
+       0.4184 0.6037 0.7821 0.9673 1.2126 1.3783 1.6892 1.9655 2.2025 2.4035 
+       0.3731 0.4464 0.7658 1.2070 1.3602 1.5675 1.8835 2.0683 2.5124 2.6904 
+       0.2314 0.3515 0.4796 0.6901 0.8348 1.0281 1.9635 2.2122 2.4882 2.7636 
+       0.2659 0.3439 0.5942 0.7509 0.9296 1.5571 1.8076 1.9998 2.5551 2.7010 
+       0.1708 0.2477 0.4112 0.6832 1.1844 1.3761 1.7284 1.9579 2.1848 2.3383 
+       0.5537 0.7504 1.0120 1.2259 1.4638 1.6713 1.9487 2.1717 2.4595 2.6438 
+       0.3007 0.3927 0.6536 0.8457 1.0508 1.5774 1.8298 2.0251 2.2992 2.4802 
+       0.2909 0.3741 0.6808 0.9210 1.0837 1.3417 1.6104 1.8392 2.1065 2.3272 
+       0.1559 0.2363 0.4173 0.6932 1.1096 1.5574 1.8077 2.0036 2.5394 2.7590 
+       0.1930 0.3360 0.5244 0.7608 1.1001 1.2636 1.6611 1.9009 2.1969 2.7229 
+       0.2266 0.2989 0.5046 1.2690 1.4832 1.6462 1.8863 2.0682 2.5529 2.7282 
+       0.1862 0.2944 0.4228 0.6137 1.3243 1.5472 1.7476 2.1261 2.3642 2.5747 
+       0.3062 0.3861 0.7636 1.0288 1.1818 1.3707 1.5442 1.9270 2.3840 2.5222 
+       0.4173 0.6864 0.8879 1.0616 1.2781 1.5609 1.9556 2.2101 2.5238 2.7190 
+       0.3728 0.4653 0.7041 0.8740 1.0346 1.4889 1.7781 1.9515 2.4864 2.6485 
+       0.2813 0.3594 0.8817 1.1702 1.3356 1.6531 1.8890 2.1551 2.5163 2.6695 
+       0.2129 0.2927 0.8019 1.0801 1.3011 1.5868 1.8151 1.9916 2.2430 2.5826 
+       0.2763 0.3397 0.5720 1.1786 1.4411 1.5882 1.8458 2.0294 2.2667 2.5668 
+       0.1668 0.2484 0.3929 1.0800 1.5384 1.6789 1.9590 2.1457 2.5674 2.7524 
+       0.2995 0.3769 0.6437 1.0753 1.2686 1.4490 1.7452 1.9392 2.1687 2.3929 
+       0.4754 0.7185 1.0696 1.3232 1.6208 1.8916 2.2074 2.4001 2.6215 2.7522 
+       0.2396 0.3865 0.5341 0.7449 1.3217 1.5461 1.7311 2.0783 2.3293 2.5500 
+       0.1545 0.2397 0.4226 0.7028 0.9431 1.1939 1.5477 1.7785 2.2104 2.7243 
+       0.1211 0.1950 0.6744 0.9174 1.1811 1.3760 1.7171 1.9820 2.4052 2.7037 
+       0.2379 0.3559 0.5236 0.7186 0.8601 1.1713 1.7691 1.9739 2.5457 2.7405 
+       0.2756 0.3626 0.7125 0.9564 1.1504 1.4734 1.7712 1.9533 2.4390 2.6282 
+       0.1573 0.2128 0.3684 0.5485 1.1972 1.4148 1.6668 2.0137 2.3316 2.6492 
+       0.2152 0.4097 0.6075 0.7645 1.0899 1.2720 1.5197 1.9796 2.2226 2.5092 
+       0.2094 0.3517 1.0980 1.3858 1.6697 1.8943 2.1301 2.3170 2.5542 2.7263 
+       0.3657 0.5074 0.6979 0.8770 1.0621 1.2242 1.6532 1.9868 2.2156 2.4252 
+       0.2063 0.3047 0.4373 0.6036 0.7849 0.9333 1.4718 2.1231 2.4097 2.6422 
+       0.1871 0.2826 0.4687 0.8386 1.1107 1.3254 1.6731 1.8728 2.0899 2.2691 
+       0.4570 0.5569 0.7986 1.0155 1.1670 1.4981 1.8278 2.0003 2.4496 2.6444 
+       0.1654 0.2923 0.4563 0.6790 0.8698 1.1095 1.5515 1.7714 2.5700 2.7883 
+       0.2731 0.4047 0.5913 0.7642 0.9379 1.0969 1.6068 2.2200 2.4888 2.6782 
+       0.2963 0.4236 0.8892 1.1434 1.3432 1.5271 1.7864 2.0219 2.3320 2.5511 
+       0.2774 0.6153 1.0715 1.4189 1.6966 1.9796 2.2484 2.4369 2.6544 2.7978 
+       0.1708 0.2326 0.4438 0.7063 1.1451 1.3412 1.7174 1.9140 2.4104 2.5671 
+       0.3115 0.3929 0.6620 1.1595 1.4066 1.5686 1.9349 2.1353 2.3945 2.6164 
+       0.2994 0.3921 0.5941 0.9092 1.1236 1.2931 1.8266 2.2400 2.4430 2.6005 
+       0.2502 0.3841 0.5481 1.0097 1.2237 1.4210 1.6994 1.8953 2.5762 2.7623 
+       0.3844 0.5541 0.8956 1.0661 1.2330 1.4020 1.7266 2.0392 2.4379 2.6744 
+       0.2518 0.3118 0.6078 1.2466 1.5919 1.7331 1.9383 2.1363 2.3606 2.5907 
+       0.1817 0.2735 0.4265 1.1565 1.3851 1.5703 1.8070 2.0188 2.4711 2.6381 
+       0.2863 0.4920 0.8994 1.2784 1.6748 1.9158 2.2055 2.3899 2.6222 2.7825 
+       0.2538 0.4525 0.6716 0.8342 1.0514 1.2324 1.5285 2.1257 2.3801 2.5957 
+       0.1656 0.2557 0.4754 0.7854 1.0174 1.5229 1.8935 2.2250 2.5797 2.7560 
+       0.2126 0.3152 0.4614 0.8558 1.2696 1.4309 1.9473 2.1460 2.4060 2.6131 
+       0.2416 0.3557 0.5318 0.7569 1.1107 1.2908 1.5501 2.2244 2.6016 2.7591 
+       0.1803 0.2894 0.4074 0.5762 0.7294 0.9863 1.8692 2.1232 2.4965 2.7801 
+       0.1602 0.2526 0.4135 0.6285 0.7946 1.4507 1.7804 2.0623 2.5660 2.7607 
+       0.3068 0.3879 0.5859 0.9980 1.2839 1.4331 1.8261 2.1118 2.3295 2.5154 
+       0.2346 0.3123 0.5079 0.8178 1.3797 1.8754 2.0980 2.2540 2.5021 2.6569 
+       0.1344 0.1887 0.3386 0.5159 0.7964 1.1077 1.6814 1.9596 2.3477 2.7134 
+       0.3438 0.4163 0.6379 1.0504 1.5410 1.7150 1.8916 2.1385 2.3578 2.5197 
+       0.1218 0.1738 0.3110 0.4857 0.9677 1.3695 1.7335 1.9952 2.4210 2.7446
index a86f063946fe9b290f481f14d19637aa3a6f3da7..45bcdee912e98f5b24d350b46741bee56650f19e 100644 (file)
-10 128
-       -0.0147 -0.0342 -0.0543 0.1092 0.0408 -0.0072 -0.0648 -0.1229 -0.1947 0.0071 
-       -0.0091 -0.0209 -0.0622 0.0787 0.0346 0.0103 -0.0146 -0.0648 -0.1321 -0.1730 
-       -0.0035 -0.0175 -0.0320 0.0123 -0.0854 0.0104 0.0407 -0.0322 0.1128 0.0657 
-       -0.1010 -0.1327 0.1325 0.0642 0.0262 -0.0060 -0.0448 -0.0250 -0.0061 0.0206 
-       -0.0444 -0.0613 0.1151 0.0487 0.0388 0.0108 0.0018 -0.0171 -0.0965 -0.0875 
-       0.0810 0.0739 0.0370 -0.0279 -0.0963 0.0392 0.0869 0.0196 0.0511 0.0172 
-       0.0537 0.0361 0.0082 0.0990 0.0353 -0.0108 -0.0637 0.0517 -0.0145 -0.0649 
-       -0.0602 -0.0754 0.0489 -0.0163 0.0956 0.0965 0.0648 0.0463 0.0058 -0.0133 
-       0.0293 0.0603 0.0167 -0.0224 0.0780 0.0279 -0.0613 -0.1258 0.0449 0.0035 
-       0.0174 -0.0102 0.0084 -0.0415 -0.0645 0.0824 -0.0379 -0.1126 0.0116 -0.0417 
-       0.0965 0.0945 0.0524 -0.0058 -0.0460 -0.0694 -0.0885 -0.1297 -0.0643 -0.0695 
-       -0.0419 -0.0705 0.0086 -0.0729 -0.0954 0.0065 -0.0522 -0.0364 -0.0704 -0.0963 
-       0.0074 -0.0003 -0.0243 -0.0588 -0.1308 -0.1649 0.0996 0.0375 -0.0314 -0.0634 
-       0.0201 0.0046 -0.0083 0.0845 0.1524 0.1054 0.0915 0.0709 0.0431 0.0279 
-       -0.0307 -0.0226 0.0579 -0.0178 -0.0520 -0.1040 -0.0811 -0.1101 -0.0603 0.0067 
-       -0.0023 -0.0054 -0.0283 -0.0277 -0.0502 -0.0847 -0.1628 -0.2278 0.1106 0.0762 
-       0.0401 0.0611 0.0217 -0.0237 -0.0896 -0.1339 0.0377 -0.0015 -0.0794 0.0654 
-       -0.0696 -0.0948 0.0192 -0.0333 -0.0427 -0.0568 0.0680 0.0767 0.0298 0.0188 
-       0.0145 0.0059 0.1447 0.1026 0.0129 -0.0477 -0.1243 0.0059 0.0641 0.0344 
-       -0.0260 -0.0537 0.0497 0.0548 0.0185 -0.0202 -0.1208 -0.1595 0.0110 -0.0004 
-       0.0073 -0.0061 -0.0162 0.1075 -0.0093 -0.0955 0.0781 0.0390 0.0147 0.0127 
-       -0.0463 -0.0607 -0.0995 -0.0043 -0.0090 -0.0712 0.0648 -0.0114 0.1143 0.0906 
-       -0.0273 -0.0416 -0.0987 -0.0978 0.0281 -0.0438 0.0545 0.0092 -0.0516 -0.0590 
-       -0.0094 -0.0341 0.0031 0.0376 -0.0002 0.0182 0.1845 0.1550 0.1127 0.0704 
-       0.0164 0.0066 -0.0223 0.1193 0.0670 0.0326 -0.0688 -0.1218 0.1219 0.0858 
-       -0.0393 0.1155 0.1050 0.0798 0.0923 0.0493 0.0349 0.0172 -0.0108 -0.0101 
-       0.0113 -0.0043 -0.0206 -0.0938 -0.1470 -0.0184 0.2036 0.1436 0.0885 0.0520 
-       -0.0046 -0.0146 -0.0485 0.0874 0.0728 0.0130 0.0787 0.0179 0.1454 0.1057 
-       0.0147 -0.0202 0.0980 0.0341 0.0089 0.1605 0.1168 0.0674 0.0047 -0.0356 
-       -0.0184 -0.0422 -0.0348 -0.0878 -0.1492 -0.0190 -0.1073 0.0643 0.0785 0.0469 
-       0.0017 0.0010 -0.0188 -0.0389 0.1461 0.0829 0.0106 -0.0419 -0.1335 0.0455 
-       -0.0141 -0.0342 -0.0581 -0.1275 0.0029 0.0788 0.0009 -0.0857 -0.1333 0.0701 
-       0.0246 0.0300 -0.0139 -0.1013 0.0553 -0.0046 0.1340 0.0891 -0.0000 -0.0099 
-       0.0193 0.0188 -0.0304 -0.0935 -0.0724 -0.1278 -0.0981 0.1049 0.0213 -0.0324 
-       0.0122 0.0135 0.0045 0.0129 0.0863 0.0323 0.1000 0.0333 -0.0765 -0.1290 
-       -0.0254 -0.0335 0.0242 -0.0151 0.0392 -0.0143 -0.0011 0.1281 0.0632 0.0992 
-       0.0300 0.0122 0.0710 0.0054 0.0555 -0.0009 -0.1127 0.0667 0.0725 0.0077 
-       0.0120 0.0208 -0.0224 -0.0305 -0.0824 -0.1289 0.0934 0.0116 0.1218 0.1015 
-       0.0553 0.0466 0.0179 0.0856 0.0036 -0.0286 -0.0862 -0.1354 0.0003 -0.0427 
-       -0.0769 -0.1097 -0.0330 0.0004 0.0368 0.0187 -0.0178 -0.0549 -0.0975 -0.0481 
-       -0.0056 -0.0125 -0.0498 -0.1224 0.0879 0.0490 0.0010 -0.0504 -0.1282 -0.1455 
-       0.0345 0.0252 0.0639 0.0436 0.0018 -0.0101 -0.0604 -0.1014 -0.1625 -0.1853 
-       0.0459 0.0275 -0.0592 0.0171 -0.0051 -0.0655 0.0070 -0.0071 -0.0847 -0.0419 
-       0.0117 -0.0019 -0.0107 -0.0198 -0.0686 -0.1346 -0.2551 0.0653 0.0546 0.0169 
-       0.0419 0.0643 0.0439 -0.0183 0.1345 0.1117 0.0709 0.0597 0.0206 -0.0108 
-       0.0175 0.0235 -0.0410 -0.0876 0.0677 -0.0024 -0.0858 0.0449 -0.0431 -0.0878 
-       0.0360 0.0324 -0.0748 0.0262 -0.0073 0.0055 -0.0062 -0.0367 0.0630 0.0306 
-       -0.0206 -0.0325 -0.0958 0.0271 0.0899 0.0260 0.0175 -0.0376 -0.0852 0.0785 
-       0.0040 -0.0218 0.0395 -0.0094 0.0329 -0.0232 0.0155 0.1310 0.0027 -0.0487 
-       -0.0006 -0.0102 -0.0410 -0.0832 -0.1154 -0.1505 -0.0286 -0.1005 0.0503 0.0202 
-       0.0515 0.0546 0.0414 -0.0274 -0.0806 -0.0317 -0.1043 -0.0968 0.1308 0.0757 
-       0.0393 0.0437 0.0019 0.1016 0.1144 0.0619 -0.0133 -0.0693 -0.0811 -0.0591 
-       -0.0250 -0.0349 -0.0530 -0.0880 -0.0059 -0.0552 -0.0947 0.0038 -0.0871 0.0250 
-       0.0169 0.0118 -0.0051 -0.0363 -0.0630 -0.1078 -0.2100 -0.0420 -0.0627 -0.1092 
-       0.0626 0.0878 0.0130 -0.0802 -0.0096 -0.0056 -0.0393 0.0229 0.0195 0.0029 
-       -0.0155 -0.0260 -0.0791 -0.0859 0.0490 -0.0029 -0.0876 0.0587 0.1117 0.0731 
-       -0.0394 -0.0617 -0.0876 0.0632 0.0291 0.1289 0.0436 0.0422 0.0817 0.0397 
-       -0.0230 -0.0479 -0.0184 0.1379 0.1331 0.1046 0.0278 -0.0011 -0.0559 -0.0687 
-       -0.0196 0.1098 0.1117 0.0376 -0.0293 -0.0616 -0.0564 -0.0511 0.0229 0.0231 
-       -0.0025 -0.0207 -0.0026 -0.0006 -0.0382 0.0972 0.0288 -0.0394 -0.1751 -0.0940 
-       -0.0078 -0.0191 -0.0743 0.1149 0.0452 0.0087 -0.0896 0.1423 0.1322 0.0749 
-       -0.0181 -0.0360 -0.0840 0.1022 0.0532 -0.0138 -0.0959 0.0211 -0.0489 -0.0490 
-       0.0586 0.0749 0.0183 -0.0150 0.0687 0.0499 0.0014 -0.0256 -0.0728 -0.0978 
-       -0.0099 -0.0323 -0.0548 -0.1367 -0.0033 0.0847 -0.0199 0.0653 0.0165 -0.0188 
-       0.0489 0.0751 0.0644 0.0106 -0.0386 -0.0836 -0.0121 0.1574 0.0978 0.0558 
-       0.0018 -0.0064 -0.0594 -0.1062 -0.1658 0.0249 0.0265 -0.0343 -0.0636 -0.0941 
-       0.0094 0.0094 -0.0222 -0.0419 -0.0699 -0.1009 0.0095 -0.0619 -0.1466 -0.1801 
-       -0.0038 -0.0213 -0.0099 -0.0550 -0.1430 -0.0352 -0.0108 -0.0902 -0.0990 0.0438 
-       -0.0391 -0.0655 0.0185 -0.0434 -0.0090 0.0218 -0.0391 -0.0985 0.1176 0.0854 
-       -0.0037 -0.0168 -0.0630 -0.1078 -0.1575 0.0795 0.0005 -0.0563 0.1105 0.0628 
-       0.0010 -0.0107 -0.0399 -0.0046 -0.0590 -0.0576 0.1455 0.0691 -0.0479 -0.0921 
-       -0.0334 0.0136 0.0594 -0.0662 0.0088 -0.0102 0.0221 0.0111 -0.0275 -0.0150 
-       0.0677 0.0726 0.0744 0.0114 -0.0403 -0.0757 0.0324 0.0259 -0.0566 -0.0819 
-       0.0346 0.0153 0.1297 0.0306 -0.0479 0.0364 -0.0078 -0.0478 0.0124 -0.0244 
-       0.0115 0.0970 0.0403 0.0109 0.0545 0.0404 0.0300 0.0262 0.1282 0.0955 
-       0.0053 0.0051 -0.0227 -0.0214 0.0723 -0.0227 0.0111 -0.0319 0.0260 -0.0074 
-       0.0060 0.0108 -0.0224 0.0366 -0.0504 -0.1083 -0.0260 -0.1100 0.0095 -0.0294 
-       -0.0075 -0.0363 0.0145 -0.0409 -0.0557 0.1570 0.0774 0.0589 0.1174 0.0630 
-       -0.0039 0.1001 0.0552 -0.0343 0.0165 -0.0304 -0.0281 -0.0452 -0.0904 -0.0860 
-       0.0687 0.0558 0.0365 0.0904 0.0077 -0.0396 0.0275 -0.0518 0.0720 0.0693 
-       -0.0056 -0.0106 -0.0653 -0.0398 0.1528 0.0959 0.0259 0.0028 -0.0201 -0.0592 
-       0.0228 0.0126 -0.0195 -0.0931 -0.0081 0.1680 0.0867 0.0238 -0.0413 -0.0824 
-       0.0140 0.0052 -0.0176 -0.0877 0.1051 0.1180 0.0579 0.0076 0.0918 0.0552 
-       0.0079 -0.0273 0.0938 0.0138 -0.0477 -0.0275 -0.1236 0.0544 -0.0374 -0.0774 
-       0.1175 0.1285 0.0868 0.0706 0.0503 0.0360 0.0051 0.0021 0.0023 -0.0142 
-       -0.0259 -0.0587 0.0105 0.0977 0.0397 -0.0015 0.0459 -0.0265 -0.0094 0.0595 
-       0.0255 0.0087 -0.0292 0.1515 0.0767 0.0595 0.0743 0.0298 -0.0019 -0.0197 
-       -0.0447 -0.0722 -0.0853 -0.0591 -0.0891 0.0931 0.0636 0.0226 -0.0157 -0.0251 
-       -0.0092 -0.0182 0.0648 0.0048 -0.0966 -0.1542 -0.0521 0.0755 0.0455 0.0445 
-       0.0052 0.0013 0.0210 0.0050 -0.0444 0.1106 0.0641 -0.0159 -0.0881 0.0951 
-       -0.0251 -0.0396 -0.0752 -0.1097 0.1184 0.0701 0.1276 0.1034 0.0433 0.0328 
-       -0.0100 -0.0260 -0.0665 -0.0324 -0.0670 -0.1111 0.0604 0.1558 0.0849 0.0487 
-       0.0406 0.0299 0.0547 -0.0097 -0.0525 0.1006 -0.0051 0.1272 0.0622 0.0121 
-       -0.0324 -0.0434 0.1005 0.0069 -0.0719 -0.0116 0.0058 0.0594 0.1237 0.0979 
-       0.0683 0.0655 0.0314 0.0748 0.0075 -0.0157 0.1503 0.0950 0.0241 0.0222 
-       -0.0270 -0.0390 -0.0800 -0.0240 -0.0651 -0.1203 0.0580 -0.0217 -0.1168 0.0590 
-       0.0328 0.0449 0.0089 0.0301 -0.0706 0.0363 0.0645 -0.0154 -0.0448 -0.1029 
-       -0.1610 0.0975 0.0215 -0.0454 -0.0162 -0.0153 -0.0302 -0.0079 -0.0343 -0.0058 
-       -0.0236 -0.0502 0.0672 0.1472 0.0698 0.0498 -0.0108 0.0730 0.0404 0.0148 
-       0.0177 0.0265 -0.0316 -0.0609 -0.0647 -0.0342 -0.1142 0.2303 0.1815 0.1102 
-       -0.0200 -0.0553 0.0420 0.0520 -0.0653 0.0356 0.0789 0.0216 -0.0054 -0.0371 
-       0.0088 0.0187 -0.0480 -0.1326 0.0108 -0.0327 -0.0693 -0.1156 0.0043 -0.0012 
-       0.0082 -0.0001 -0.0623 0.0107 -0.0475 0.1223 0.1220 0.0633 0.0459 0.0061 
-       -0.0063 -0.0261 0.0375 -0.0171 0.0934 0.0337 -0.0625 -0.0185 -0.0642 -0.1047 
-       -0.0432 -0.0761 -0.0888 -0.0203 0.0424 -0.0029 -0.0429 0.0580 0.0191 -0.0331 
-       -0.0064 -0.0098 -0.0292 -0.0442 -0.0311 -0.0692 -0.1032 -0.1564 -0.2260 0.0398 
-       -0.0265 -0.0424 -0.1001 0.0014 -0.0637 -0.0063 -0.0525 -0.1065 0.0004 -0.0410 
-       0.0145 -0.0077 0.1417 0.0800 0.0254 -0.0140 0.1199 0.0921 0.0366 0.0291 
-       0.0276 0.0304 0.0420 0.0427 0.0185 -0.0148 -0.0656 -0.1486 -0.1264 0.0927 
-       -0.0292 -0.0425 -0.0832 -0.0815 0.1040 0.0397 -0.0615 -0.1320 0.0701 0.0516 
-       -0.0204 -0.0391 -0.0536 0.0029 -0.0463 -0.1175 -0.0620 0.0196 -0.0771 -0.1071 
-       0.0006 0.0056 -0.0265 0.0111 0.0419 -0.0209 0.1261 0.0562 -0.0380 0.1026 
-       -0.0772 0.1495 0.1096 0.0310 -0.0119 0.0310 0.1149 0.1370 0.0874 0.0617 
-       0.0297 0.0336 0.0141 0.0530 0.0093 -0.0372 0.0304 -0.0387 -0.1447 0.0011 
-       -0.0179 -0.0367 -0.0817 0.1134 0.0707 0.0120 -0.0452 -0.1060 0.0488 -0.0015 
-       0.0409 0.0356 0.0243 0.0752 0.0088 0.1064 0.0295 -0.0369 0.0841 0.0314 
-       0.0338 0.0050 0.1358 0.1160 0.0815 0.0488 0.0167 -0.0140 -0.0441 -0.0683 
-       0.0163 0.0106 -0.0497 0.0089 0.0889 0.0220 0.0444 0.1229 0.0578 0.0128 
-       0.0217 0.0172 -0.0237 -0.0151 -0.1139 0.0031 -0.1051 -0.0274 0.0003 -0.0414 
-       -0.0138 -0.0220 -0.0676 -0.1531 -0.0121 -0.0520 0.0733 0.0472 0.0732 0.0526 
-       -0.0100 -0.0324 0.1059 0.0599 0.1064 0.0761 0.0101 -0.0393 0.0684 0.0503 
-       -0.0263 -0.0505 -0.0910 0.0919 0.0648 0.0128 0.1304 0.0943 0.0113 -0.0037 
-       0.0138 -0.0012 0.0282 -0.0654 -0.1621 0.0828 0.0696 0.0341 -0.0190 -0.0422 
-       -0.0095 -0.0187 -0.0493 -0.0305 0.0267 -0.0225 -0.1006 -0.1347 -0.1064 -0.1385 
-       -0.0001 0.0029 -0.0226 -0.0455 -0.0045 -0.0561 -0.0208 -0.0381 -0.0653 0.1681 
-       0.0163 0.0612 0.0337 -0.0040 0.0303 -0.0352 -0.0824 0.0184 -0.0772 0.0627 
-       -0.1619 0.0289 0.0324 0.0509 0.0320 0.0320 0.0065 0.0320 0.0499 0.0672 
-       -0.0476 -0.0707 -0.0346 0.0537 -0.0334 -0.0995 -0.1149 -0.0176 0.0757 0.0611
-
+10 256
+       -0.0388 -0.0448 0.0718 0.0236 0.0461 -0.0074 -0.0045 -0.0744 -0.0979 0.0917 
+       -0.0594 -0.0950 0.0403 -0.0422 -0.1153 -0.0259 0.0572 0.0667 0.0210 0.0034 
+       0.0260 0.0664 0.0204 -0.0106 0.0517 -0.0060 0.0094 -0.0223 -0.0314 0.1428 
+       0.0602 0.0440 0.1044 0.0179 -0.0112 0.0233 -0.0048 -0.0344 -0.0391 -0.0767 
+       -0.0116 -0.0184 -0.0305 0.0507 0.0122 -0.0346 -0.0882 -0.1275 -0.1656 -0.1946 
+       -0.0526 -0.0878 -0.0824 0.0520 -0.0120 -0.0057 0.1112 0.0669 0.0067 -0.0098 
+       0.0071 -0.0051 0.0062 0.0560 0.0114 -0.0544 -0.0607 -0.0451 -0.1365 -0.0438 
+       -0.0277 -0.0398 -0.0767 0.0732 0.0210 -0.0061 -0.0369 -0.0650 0.1656 0.1101 
+       0.0056 0.0015 -0.0253 -0.0701 0.0668 -0.0055 -0.0622 0.1525 0.1171 0.0863 
+       0.0150 0.0106 0.1502 0.0880 0.0200 0.0028 0.0883 0.0589 0.0784 0.0597 
+       0.0230 0.0752 0.0179 -0.0042 -0.0458 -0.0944 -0.0303 -0.0876 0.0190 -0.0269 
+       0.0153 0.0049 -0.0402 0.1146 0.0930 0.0521 0.0743 0.0323 0.1185 0.0858 
+       -0.0358 -0.0526 -0.0997 0.0474 -0.0109 0.1087 0.0361 0.0946 0.1016 0.0670 
+       -0.0397 -0.0659 0.0503 0.1424 0.0577 0.0229 0.0062 0.0025 -0.0406 -0.0565 
+       0.0821 0.0758 0.0284 0.1126 0.0833 0.0719 0.0383 0.0052 0.0157 -0.0119 
+       0.0256 0.0125 -0.0695 0.0534 0.1412 0.0884 0.0229 0.0130 -0.0444 -0.0414 
+       -0.0088 -0.0328 -0.0320 -0.1081 0.0927 0.1051 -0.0099 0.0969 0.0100 -0.0058 
+       -0.0025 -0.0244 0.0835 0.0321 -0.0325 0.0494 0.1347 0.0625 -0.0293 -0.0592 
+       0.0038 -0.0009 0.0106 0.0156 0.0715 0.0170 -0.0870 -0.1503 0.1522 0.1104 
+       -0.0253 -0.0361 -0.1018 -0.0250 0.0433 -0.0489 0.1182 0.0743 -0.0216 -0.0276 
+       -0.0168 -0.0358 0.0289 -0.0741 -0.0962 -0.0068 -0.0544 -0.0652 -0.0321 -0.0721 
+       -0.0226 -0.0391 -0.0844 0.0472 0.0024 0.0820 -0.0133 -0.0865 0.0510 0.0116 
+       -0.0092 -0.0282 -0.1107 0.0255 -0.0160 -0.0710 -0.0995 0.0280 -0.0506 -0.0943 
+       -0.0169 -0.0451 0.0494 0.0563 -0.0726 -0.0805 0.0071 -0.0479 0.0125 0.0353 
+       0.0400 0.0335 0.0513 -0.0390 0.0993 0.1362 0.0582 0.0228 0.0801 0.0381 
+       -0.0435 -0.0852 -0.0297 -0.0220 0.0017 -0.0300 -0.0469 0.0107 -0.0733 -0.1121 
+       0.0107 -0.0078 0.0390 -0.0022 -0.0670 0.0143 0.1181 0.0658 0.0905 0.0827 
+       0.0262 0.0167 -0.0136 -0.0402 -0.1175 0.0265 -0.0788 -0.1620 0.0617 0.0100 
+       -0.0004 -0.0033 0.0011 0.0024 0.0542 -0.0120 0.0617 0.0104 -0.1479 -0.0268 
+       -0.0113 -0.0310 -0.0338 -0.0785 -0.0506 0.0085 -0.1328 -0.0275 0.0604 0.0164 
+       0.0089 -0.0152 0.0384 -0.0395 0.0537 0.1398 0.0844 0.0274 -0.0464 -0.0756 
+       0.0313 0.0513 -0.0211 0.0925 0.0614 -0.0120 0.0034 0.0615 -0.0177 -0.0265 
+       0.0926 0.1094 0.0393 -0.0095 -0.0289 -0.0628 -0.1154 -0.1121 -0.0476 -0.0326 
+       0.0140 0.0076 -0.0226 -0.1038 0.0930 0.0146 0.1595 0.1176 0.0324 0.0084 
+       0.0159 -0.0051 0.0695 0.0338 -0.0356 -0.0735 -0.0174 -0.0850 0.1175 0.1095 
+       -0.0267 0.0451 -0.0052 -0.0474 0.0154 -0.0354 -0.0629 0.0260 -0.0367 -0.0515 
+       -0.0509 -0.0693 0.0258 -0.0142 0.1054 0.0702 0.0208 -0.0118 -0.0680 -0.0829 
+       0.0409 0.0877 0.0209 -0.0767 0.0233 -0.0175 -0.0045 0.0527 0.0414 0.0178 
+       -0.0046 -0.0006 -0.0411 -0.0808 0.0017 -0.0707 0.0037 -0.0459 -0.1297 -0.1546 
+       0.0414 0.0461 0.0061 -0.0232 -0.0280 -0.0416 -0.0750 -0.1091 -0.1349 -0.1495 
+       0.0541 0.0601 0.0057 0.0587 0.0144 -0.0310 -0.0869 -0.1062 0.0846 0.0406 
+       0.0069 -0.0000 -0.0257 -0.0575 0.1055 0.0461 -0.0323 -0.0816 -0.1463 -0.1572 
+       -0.0097 -0.0354 0.0836 0.1357 0.0654 0.0264 -0.0403 -0.0792 0.0919 0.0569 
+       0.0008 -0.0217 -0.0332 -0.1156 -0.0393 0.1228 0.0227 -0.0602 0.0424 -0.0152 
+       -0.0364 -0.0624 -0.0497 -0.0335 0.0117 -0.0460 0.0067 0.1152 0.0671 0.0290 
+       -0.0337 -0.0518 -0.0813 -0.1195 0.0599 0.0157 -0.0503 -0.0989 0.1165 0.0687 
+       0.0253 0.0057 -0.0764 0.0023 0.0192 -0.0261 0.0601 0.1356 0.0598 0.0323 
+       0.0189 0.0218 -0.0202 -0.0381 -0.1006 -0.1560 0.0613 -0.0097 0.0979 0.0609 
+       -0.0142 -0.0133 -0.0759 -0.1357 0.1003 0.0358 0.0450 0.0044 -0.0260 -0.0464 
+       0.0124 -0.0185 0.0735 -0.0084 -0.0601 0.1034 0.0291 -0.0149 -0.0901 -0.1366 
+       0.0449 0.0455 0.0167 0.0931 0.0522 0.0670 0.0097 0.0929 0.0973 0.0438 
+       0.0148 -0.0071 -0.0007 -0.0872 -0.1297 -0.0398 0.0365 -0.0338 0.0935 0.0610 
+       0.0120 -0.0069 -0.0250 0.1371 0.0726 0.0473 0.1336 0.0824 0.0012 -0.0160 
+       -0.0027 -0.0169 -0.0917 0.0203 0.0322 -0.0168 -0.0553 -0.1007 -0.1454 -0.0398 
+       -0.0229 -0.0345 -0.0613 -0.1092 -0.0169 -0.1084 0.0013 -0.0496 0.0759 0.0375 
+       -0.1027 0.0813 0.0274 -0.0446 0.0291 0.0730 0.0888 0.0920 0.0418 0.0258 
+       0.0094 0.0150 -0.0029 -0.0657 0.0064 -0.0338 -0.0987 -0.1261 -0.2111 0.0080 
+       -0.0527 -0.0809 -0.0615 0.0629 0.0247 -0.0117 -0.0375 -0.0983 -0.1161 0.0363 
+       -0.0122 -0.0241 -0.0358 0.0366 -0.0649 0.0340 -0.0435 -0.1040 -0.0322 -0.0986 
+       0.0323 0.0211 -0.0295 0.0395 -0.0105 0.0962 0.0085 0.1202 -0.0126 -0.0469 
+       -0.0020 -0.0253 0.0264 0.0252 0.0297 0.1726 0.0717 0.0233 0.0630 0.0083 
+       0.0135 -0.0013 0.0085 0.0457 0.0088 -0.0351 0.1764 0.1146 0.0020 -0.0597 
+       -0.0227 -0.0334 -0.0421 -0.0044 -0.0757 0.0795 -0.0231 -0.0984 -0.1621 0.0463 
+       -0.0273 -0.0434 -0.0673 -0.0126 -0.0588 -0.1018 0.0909 0.0158 -0.0870 0.0647 
+       -0.0166 -0.0312 -0.0556 0.0506 0.0062 0.1075 0.0855 0.0093 -0.0790 0.0391 
+       -0.0117 -0.0187 -0.0503 0.0134 0.1307 0.0798 0.0929 0.0698 0.0204 -0.0055 
+       -0.0200 -0.0356 -0.0653 0.1188 0.0827 0.0194 0.0039 0.1140 0.0223 -0.0016 
+       0.0223 0.0111 0.1235 0.0610 -0.0344 -0.0815 -0.1164 0.0621 0.0509 0.0150 
+       0.0199 0.0049 0.0952 0.0228 -0.0305 -0.0948 0.0485 0.0047 -0.0736 0.0405 
+       0.0231 0.0233 -0.0248 -0.0321 -0.0993 0.0885 -0.0713 0.1863 0.1235 0.0713 
+       0.0249 0.0475 0.0049 -0.0892 -0.0521 -0.0863 0.0190 -0.0264 -0.0733 0.0135 
+       -0.0037 -0.0098 -0.0392 0.1061 -0.0222 -0.1195 0.1081 0.0681 0.0328 0.0297 
+       -0.0241 -0.0356 -0.0728 -0.0665 -0.0698 0.0948 0.1163 0.0435 -0.0436 -0.1014 
+       0.0771 0.0539 -0.0337 0.0032 -0.0319 -0.0779 0.0425 0.0164 -0.0384 -0.0049 
+       -0.0200 -0.0463 0.0546 -0.0275 -0.0429 0.0472 -0.0687 -0.1068 0.0804 0.0594 
+       0.0135 0.0061 -0.0170 0.0302 -0.0367 -0.0768 -0.1833 -0.0706 -0.0200 -0.0859 
+       -0.0048 -0.0126 -0.0395 -0.0606 0.1435 0.0753 -0.0157 -0.0767 0.0165 -0.0380 
+       -0.0149 -0.0204 -0.0725 -0.0124 -0.0883 -0.0702 0.1520 0.0717 -0.0204 -0.0738 
+       0.0340 0.0745 -0.0069 -0.0318 0.1068 0.0534 -0.0164 -0.0689 0.0426 0.0179 
+       0.0014 -0.0081 -0.0400 0.0501 0.0004 0.1115 0.0528 -0.0222 -0.1313 -0.1611 
+       -0.0106 -0.0425 0.0444 -0.0028 -0.0166 0.0111 -0.0575 0.1284 -0.0212 -0.0725 
+       0.0282 0.0077 0.1315 0.0882 0.0312 -0.0077 -0.0712 -0.1013 -0.0737 -0.0850 
+       -0.0292 0.0692 0.0456 -0.0192 -0.0829 0.0150 0.0265 -0.0351 0.0539 0.0292 
+       -0.0331 0.0631 0.0850 -0.0581 0.0346 -0.0001 0.0148 -0.0089 -0.0501 -0.0425 
+       0.0116 0.0046 0.0079 -0.0015 -0.0468 0.0998 0.0300 -0.0461 0.1537 0.0999 
+       0.0032 0.0002 -0.0452 -0.0338 -0.1053 -0.1275 -0.0483 -0.1059 -0.0106 -0.0536 
+       -0.0113 -0.0314 0.0692 0.0281 0.1084 0.0542 -0.0305 0.1004 0.0678 0.0481 
+       0.0003 -0.0221 0.0068 -0.0124 -0.0277 -0.0336 0.0188 -0.0611 -0.0034 -0.0429 
+       -0.0117 -0.0206 -0.0418 -0.1120 -0.0711 0.1151 0.0821 0.0075 -0.0804 0.0725 
+       0.0551 0.0410 0.0070 -0.0743 -0.1144 -0.0423 -0.0963 -0.0215 0.0208 -0.0200 
+       0.0041 -0.0228 0.0927 -0.0457 0.0246 -0.0148 0.0481 0.0404 0.0448 0.0043 
+       -0.0847 0.0707 -0.0843 0.0221 0.0029 -0.0061 -0.0184 0.0230 0.0447 0.0426 
+       -0.0222 -0.0323 0.1595 0.0395 -0.0287 -0.0080 -0.0173 0.0058 -0.0209 -0.0226 
+       0.0540 0.0607 -0.0095 0.0112 -0.0452 -0.0210 0.0415 -0.0105 0.1407 0.0959 
+       -0.0037 0.1116 0.0705 0.0533 0.0024 -0.0479 0.0717 0.0527 -0.0005 -0.0011 
+       -0.0026 0.0051 -0.0290 -0.0568 0.0009 -0.0509 -0.1070 -0.1665 -0.0076 -0.0655 
+       0.0339 0.0105 0.0750 0.0343 -0.0340 -0.0411 -0.0936 -0.1315 0.0368 -0.0143 
+       -0.0215 -0.0329 -0.0586 0.0161 0.0272 -0.0148 0.1789 0.1499 0.1179 0.0817 
+       0.0503 0.0347 0.0096 0.1076 0.0179 -0.0307 0.0345 -0.0409 0.0743 0.0439 
+       -0.0036 0.0493 -0.0031 -0.0170 -0.0175 -0.0739 0.1356 0.0608 -0.0418 0.0951 
+       0.0215 0.0310 -0.0228 0.0361 -0.0426 -0.0909 0.0439 -0.0347 -0.0571 -0.1173 
+       -0.0235 -0.0310 -0.1199 -0.0549 0.0597 0.0012 -0.0510 0.0578 0.0171 0.0116 
+       -0.0598 -0.0886 0.0787 0.0318 0.0108 0.1027 0.1086 0.1125 0.0542 0.0265 
+       -0.0426 -0.0646 0.1480 0.0959 0.1249 0.0976 0.0418 0.0156 0.0144 -0.0016 
+       -0.0235 -0.0382 -0.1079 0.0280 -0.0206 0.1142 0.0320 0.0239 -0.0318 -0.0675 
+       -0.0016 0.0222 0.0272 0.0252 0.0338 -0.0477 0.0665 0.0154 0.1355 0.1086 
+       -0.0101 -0.0137 -0.0420 -0.0482 0.1416 0.0870 0.0505 -0.0006 -0.0512 0.0936 
+       -0.1569 0.1055 0.1190 0.0746 0.0411 0.0168 -0.0210 0.0419 0.0221 0.0431 
+       0.0152 -0.0125 0.0476 -0.0397 0.0069 0.0611 0.0635 0.1735 0.0993 0.0534 
+       -0.0022 -0.0066 -0.0532 -0.0873 0.0810 0.1075 0.0196 0.0235 0.1139 0.0593 
+       0.0062 -0.0144 -0.0467 0.1598 0.0495 -0.0300 0.0194 -0.0404 -0.0745 0.0586 
+       -0.0168 -0.0323 -0.0615 0.1541 0.1056 0.0652 -0.0137 -0.0426 -0.0922 -0.0914 
+       -0.0149 -0.0433 0.0184 0.1162 0.0290 -0.0033 0.0842 0.0476 0.0956 0.0615 
+       -0.0114 -0.0179 -0.0480 0.0386 -0.1162 -0.0050 0.0600 0.0172 0.0143 -0.0133 
+       0.0689 0.0513 0.0287 -0.0555 -0.1046 0.1122 0.0781 0.0176 0.0647 0.0174 
+       0.0625 0.0659 0.0702 0.0257 -0.0012 -0.0205 -0.0620 0.1231 0.0775 0.0218 
+       -0.0102 -0.0122 -0.0332 -0.0472 0.1187 -0.0061 -0.1233 0.0226 -0.0659 0.0025 
+       -0.0102 0.0202 0.0626 -0.0237 -0.0614 -0.1148 -0.1134 -0.0493 -0.0503 -0.0075 
+       0.1071 0.1029 0.0633 0.0141 -0.0262 0.0431 -0.0019 -0.0340 0.0404 0.0031 
+       0.0144 0.0106 -0.0335 -0.0878 -0.1583 0.0113 0.0872 0.0127 -0.0084 -0.0591 
+       0.0794 0.0916 0.0718 0.0780 0.0376 -0.0109 -0.0019 -0.0360 -0.0566 0.0031 
+       0.0191 0.0077 -0.0712 0.0288 -0.0560 0.1080 0.0954 0.0371 0.0745 0.0327 
+       0.0096 0.0078 -0.0305 -0.0175 -0.0446 -0.1118 -0.0038 0.0978 0.0156 0.0947 
+       -0.0101 -0.0029 -0.0670 -0.0633 0.0303 -0.0377 0.0431 -0.0198 -0.1065 0.0158 
+       -0.0282 -0.0408 -0.0950 -0.0833 -0.0454 0.0033 0.0360 -0.0200 0.0148 0.0266 
+       0.0526 0.0553 0.0023 -0.0188 -0.0704 -0.1153 -0.1703 0.0872 0.0516 0.0149 
+       -0.0179 -0.0308 -0.0730 -0.0672 -0.1464 0.0573 -0.0143 -0.0498 0.1191 0.0667 
+       -0.0174 -0.0350 0.0788 0.0417 -0.0441 0.0726 -0.0406 0.0883 0.0793 0.0338 
+       -0.0303 -0.0683 0.0231 0.0590 -0.0199 0.0672 0.0156 -0.0374 0.0453 0.0159 
+       0.0340 0.0578 0.0174 0.0159 -0.0362 -0.0757 0.0166 -0.0572 -0.1718 -0.0161 
+       0.0039 0.0450 -0.0593 -0.1301 0.0109 -0.0272 -0.0409 -0.0779 -0.0236 -0.0307 
+       0.0466 0.0312 -0.0724 0.0031 -0.0296 0.0298 -0.0261 -0.0711 0.0282 -0.0124 
+       -0.0176 -0.0392 -0.0294 -0.0749 -0.0941 0.1079 0.0995 0.0832 0.1013 0.0605 
+       -0.0096 0.0756 0.0477 0.0350 0.0018 -0.0151 -0.0235 -0.0593 -0.0920 -0.1054 
+       -0.0393 -0.0577 0.1021 0.0403 -0.0168 -0.0715 0.0005 0.1550 0.0879 0.0603 
+       0.0559 0.0707 0.0889 0.0157 0.0541 0.0434 0.1098 0.0817 0.0212 -0.0063 
+       0.0055 -0.0200 0.1100 0.0686 0.0801 0.0559 0.0204 -0.0334 -0.1182 -0.1166 
+       0.0081 -0.0222 0.1073 0.0042 -0.0871 0.0948 0.0225 -0.0241 0.0633 0.0262 
+       0.0119 0.0074 -0.0197 0.1133 0.1274 0.0614 -0.0129 -0.0764 0.0108 0.0575 
+       0.0227 0.0065 0.0389 -0.0127 -0.0162 0.1103 -0.0367 -0.1206 -0.0173 -0.0508 
+       0.0027 0.0009 -0.0322 -0.1115 0.0059 0.0694 0.0132 -0.0082 -0.0915 -0.1071 
+       0.0123 0.0154 -0.0115 0.0046 -0.0207 -0.0214 0.0032 0.0018 0.0887 0.0007 
+       -0.0261 -0.0372 -0.0727 -0.0055 -0.0520 -0.0934 0.0742 -0.0020 0.1235 0.0751 
+       -0.0202 -0.0451 -0.0673 -0.0873 0.0358 -0.0196 -0.0990 -0.0645 -0.0273 -0.0883 
+       0.0026 -0.0156 0.0572 0.0063 0.0556 -0.0120 -0.0814 -0.0208 -0.0749 -0.1270 
+       -0.0152 -0.0171 -0.0509 -0.0738 -0.0393 -0.1016 -0.1152 0.0150 -0.0705 0.0181 
+       0.0355 0.0387 0.0054 -0.0251 0.1005 0.0311 -0.0222 0.1239 0.0214 -0.0383 
+       -0.0668 -0.0961 -0.0138 -0.0696 -0.0309 0.0897 0.0006 -0.0121 0.0050 -0.0158 
+       -0.0213 -0.0304 -0.0796 0.0420 0.0442 -0.0233 0.0838 0.0063 -0.0538 0.1384 
+       0.0607 0.0670 0.0249 -0.0156 -0.0827 -0.0111 0.1093 0.0296 -0.0748 -0.0928 
+       0.0195 0.0081 0.0014 -0.0833 -0.0118 -0.0699 0.1325 0.0669 -0.0539 -0.0902 
+       0.0422 0.0510 0.0412 0.0121 -0.0389 0.0644 0.0444 -0.0285 -0.0844 0.0853 
+       -0.0595 -0.0811 -0.0887 0.0944 0.0162 -0.0248 -0.1339 0.0071 0.0136 0.0028 
+       0.0164 0.0056 -0.0097 -0.0199 -0.0577 -0.1237 -0.0347 0.1165 0.0033 -0.0524 
+       0.0220 0.0049 0.0568 0.0955 -0.0115 0.0285 0.0507 -0.0346 -0.0514 0.0024 
+       -0.0178 -0.0391 -0.0172 -0.0296 -0.1495 0.1534 0.0800 0.0355 -0.0072 -0.0191 
+       0.0130 0.0079 -0.0775 -0.0005 0.0734 -0.0248 0.0141 -0.0524 0.0626 0.0581 
+       -0.0440 -0.0666 0.0835 0.0739 -0.0005 -0.0499 -0.1459 -0.0911 -0.0096 -0.0069 
+       0.0323 0.0089 0.0803 0.1024 -0.0005 -0.0622 0.0699 0.0420 -0.0407 -0.0735 
+       -0.0110 -0.0360 -0.0345 -0.0838 -0.1359 0.0525 -0.0453 0.1013 0.0137 -0.0339 
+       -0.0434 -0.0612 -0.0312 -0.1040 0.0681 0.0145 0.0865 0.0704 0.0045 0.0121 
+       0.0034 -0.0158 -0.0055 -0.0778 -0.1483 0.0164 -0.0170 -0.0739 -0.0866 0.0662 
+       -0.0968 0.2119 0.0816 -0.0024 0.0375 0.0255 -0.0033 -0.0296 -0.0656 -0.0479 
+       -0.0457 -0.0649 -0.0483 0.0569 0.1160 0.0558 0.0225 -0.0176 0.0609 0.0399 
+       -0.0173 0.1029 0.0536 0.0695 0.0692 0.0724 0.0393 0.0234 0.0870 0.0553 
+       -0.0299 0.0699 0.0550 0.0460 0.1220 0.0777 0.0360 0.0197 -0.0423 -0.0479 
+       -0.0417 -0.0790 0.0527 0.0471 0.0153 -0.0500 0.0804 0.0311 -0.0317 -0.0184 
+       -0.0432 0.0101 0.0224 -0.0347 0.0555 0.0383 -0.0005 -0.0272 0.0481 0.0076 
+       0.0070 0.0106 -0.0328 0.0059 0.0522 0.0098 0.0969 0.0328 -0.0726 -0.1430 
+       -0.0053 -0.0183 -0.0472 -0.1430 -0.0076 -0.0367 -0.0338 0.1050 0.0317 -0.0108 
+       0.0273 0.0090 0.0071 -0.1105 0.0261 -0.0215 -0.0876 -0.0062 -0.0341 -0.0785 
+       0.0284 0.0306 0.0309 -0.0246 -0.0621 0.0037 -0.1238 0.0162 0.1779 0.1051 
+       0.0033 -0.0098 -0.0480 -0.0861 -0.1362 -0.0879 -0.0672 0.1604 0.1077 0.0602 
+       0.0501 0.0267 0.1134 0.0498 0.0442 0.0343 -0.0167 -0.0544 0.0912 0.0536 
+       -0.0818 0.0402 0.0457 -0.0075 -0.0406 -0.0795 -0.0359 0.0376 0.0893 0.0937 
+       0.0103 0.0581 0.0677 0.0005 -0.0044 -0.0338 -0.0783 0.0279 -0.0638 0.0775 
+       0.0328 0.0433 -0.0021 0.0455 -0.0944 0.0322 -0.0639 -0.0080 0.0120 -0.0189 
+       -0.0304 -0.0500 -0.1071 0.0147 -0.0467 -0.0768 -0.0413 -0.1117 0.0428 -0.0063 
+       -0.0004 -0.0284 0.0879 0.0130 -0.0380 0.0813 -0.0077 -0.0430 -0.1511 0.0323 
+       -0.0056 -0.0046 -0.0451 -0.0494 -0.0533 -0.1026 -0.0699 -0.1331 0.1455 0.1144 
+       -0.0778 0.0095 0.0448 -0.0100 -0.0204 -0.0563 0.0508 0.0375 -0.0393 -0.0554 
+       0.0258 0.0118 0.0304 -0.0427 0.1746 0.0898 0.0301 0.0213 -0.0334 -0.0536 
+       -0.0064 -0.0145 -0.0339 -0.0359 -0.1144 -0.0061 0.0106 -0.0553 -0.1766 -0.1111 
+       -0.0308 -0.0576 -0.0278 0.0138 0.0289 -0.0456 -0.0787 0.0463 -0.0559 0.0913 
+       -0.0134 -0.0302 0.0037 0.0084 0.0422 0.0565 -0.0777 -0.0011 -0.0378 -0.0698 
+       0.0312 0.0088 0.0107 0.1286 0.0325 -0.0259 -0.1204 0.0533 0.0163 -0.0281 
+       0.0081 0.0051 -0.0210 0.0739 -0.0003 -0.0443 -0.0534 0.1833 0.0996 0.0564 
+       -0.0218 -0.0323 -0.0635 0.0103 0.0698 -0.0012 -0.1264 -0.1836 0.0253 0.0021 
+       0.0081 -0.0096 0.0159 -0.0331 -0.1037 -0.0597 -0.1698 0.0146 -0.0830 -0.1016 
+       0.0139 -0.0083 0.0608 0.1011 0.1067 0.0648 0.0440 0.0027 -0.0506 0.0620 
+       -0.0036 -0.0336 0.0543 -0.0045 0.1037 0.0260 -0.0465 -0.1092 0.0054 -0.0182 
+       -0.0209 -0.0052 -0.0076 -0.0015 0.0051 -0.0002 -0.0060 0.0131 -0.0153 -0.0042 
+       0.0269 0.0275 -0.0309 0.0071 -0.0237 -0.0817 -0.1283 -0.0122 -0.0905 0.0830 
+       0.0138 0.0004 -0.0480 0.1240 0.0235 -0.0221 -0.0859 -0.1375 0.0762 0.0252 
+       0.0534 0.0365 0.0059 0.0859 0.0564 0.0279 -0.0076 -0.0388 -0.1173 -0.1383 
+       -0.0675 -0.1012 0.0503 -0.0278 -0.0085 -0.0357 -0.0796 0.0349 -0.0241 -0.0060 
+       -0.0261 -0.0425 0.0322 -0.0339 -0.1067 -0.1168 -0.1193 0.0233 0.0805 0.0507 
+       0.0481 0.0314 -0.0209 0.0822 0.0370 -0.0209 0.0866 0.0169 -0.0703 0.0637 
+       0.0446 0.0933 0.0269 -0.0322 0.0785 0.0290 0.0313 -0.0117 -0.0655 -0.0783 
+       0.0190 -0.0000 0.0161 -0.0444 0.0632 -0.0727 0.0040 0.0061 -0.0046 0.0136 
+       0.0242 0.0085 0.0646 -0.0305 -0.1284 -0.0157 0.0376 0.0400 -0.0082 -0.0315 
+       -0.0127 -0.0257 -0.0031 -0.0905 -0.0295 -0.0349 -0.0322 0.0358 -0.0159 0.1506 
+       0.0217 0.0263 -0.0179 -0.1047 0.0586 0.0046 -0.0901 -0.1336 0.0600 0.0547 
+       0.0320 0.0283 -0.0610 -0.0342 0.0462 -0.0214 -0.0862 0.0564 -0.0431 -0.1056 
+       -0.0088 -0.0098 -0.0297 0.0749 0.0038 -0.1179 -0.0167 -0.0747 0.0329 0.0306 
+       0.0362 0.0625 -0.0019 -0.0076 0.1143 0.0523 0.1102 0.0852 0.0774 0.0721 
+       -0.1238 0.0062 -0.0096 -0.0049 -0.0004 -0.0242 -0.0735 -0.0698 -0.0309 -0.0119 
+       0.0149 0.0095 0.0074 -0.0678 0.0921 0.0852 0.0107 -0.0623 -0.1286 0.0349 
+       -0.0938 -0.1044 0.1349 0.0413 0.0082 -0.0250 -0.0245 -0.0342 0.0838 0.0701 
+       0.0395 0.0340 -0.0191 -0.0528 -0.1232 0.0854 0.0010 -0.0568 -0.0859 -0.1369 
+       -0.0363 -0.0466 0.0019 -0.0095 0.0356 0.0114 0.0578 -0.0174 0.0490 0.1313 
+       0.0637 0.0652 0.0134 0.0533 -0.0112 -0.0275 0.1647 0.0985 0.0509 0.0515 
+       0.0047 -0.0278 -0.0342 0.0555 0.0335 -0.0198 -0.0151 0.0347 -0.0187 -0.0872 
+       -0.0749 -0.0976 0.1020 0.0244 -0.0239 0.0342 -0.0172 -0.0524 -0.0990 -0.0836 
+       -0.0501 -0.0766 0.0102 -0.0453 -0.0430 -0.0717 -0.0913 -0.1572 0.0174 0.0417 
+       -0.0270 -0.0435 -0.0829 -0.0845 -0.1285 0.0375 -0.0105 -0.0635 -0.0457 -0.0855 
+       -0.0255 -0.0537 -0.0065 0.0748 -0.0545 -0.1221 -0.0740 0.0503 -0.0141 -0.0440 
+       0.0197 0.0293 -0.0282 0.0881 0.0539 0.0014 -0.0512 -0.1213 -0.0122 -0.0763 
+       0.0155 0.0290 -0.0004 0.0346 0.0005 -0.0512 -0.0889 -0.1777 -0.0862 0.0577 
+       0.0492 0.0526 0.0295 0.0002 0.0717 0.0397 -0.0717 -0.0194 -0.0072 -0.0550 
+       0.0164 0.0268 -0.0641 -0.1311 -0.0675 0.0505 0.0258 0.0189 0.0475 0.0397 
+       0.0175 0.0087 0.0465 0.0745 0.0955 0.0324 0.0390 0.0004 0.0062 -0.0504 
+       -0.0204 -0.0244 -0.0380 -0.0494 -0.0846 -0.1212 -0.0376 -0.1026 -0.1728 0.0703 
+       0.0060 -0.0144 0.0579 -0.0025 -0.0519 -0.0835 -0.0028 -0.0179 -0.0986 -0.1509 
+       0.0040 -0.0133 0.0153 -0.0236 -0.0845 -0.1477 0.1582 0.1264 0.0641 0.0506 
+       -0.0352 -0.0554 -0.0777 -0.1243 0.0530 0.0317 -0.0428 -0.0616 -0.1301 0.0143 
+       0.0122 -0.0085 -0.0046 0.1390 0.0363 0.1067 0.0139 -0.0279 0.0389 -0.0089 
+       0.0142 -0.0023 0.0543 -0.0635 -0.0485 0.0599 -0.0472 0.0431 0.0222 -0.0028 
+       -0.0221 -0.0361 -0.0559 -0.0935 -0.0724 -0.1297 0.0263 0.0058 -0.0343 -0.0902 
+       0.0137 0.0296 -0.0198 0.0044 -0.0718 -0.1038 0.0396 -0.0518 -0.0526 0.1067 
+       0.0751 0.0630 0.0749 0.0084 -0.0620 -0.0808 0.0475 -0.0005 0.0609 0.0380 
+       -0.0316 0.0807 0.0816 0.0612 0.0295 -0.0039 -0.0705 -0.0695 0.0152 0.0050 
+       0.0096 0.0134 -0.0208 -0.0572 -0.1158 -0.1724 0.0643 0.0100 -0.0694 -0.0647 
+       0.0617 0.0717 0.0432 -0.0063 -0.0210 -0.0552 -0.0532 0.0478 -0.0396 -0.0843 
+       -0.0085 -0.0240 -0.1077 0.0824 0.0348 -0.0217 0.0533 0.0001 0.0154 -0.0044 
+       0.0373 0.0120 0.1159 0.0733 0.0162 0.1225 0.0383 0.0285 0.0093 -0.0376 
+       -0.0381 -0.0694 0.0125 -0.0220 -0.0212 0.0088 -0.0476 0.0571 0.1549 0.1049 
+       -0.0101 -0.0181 -0.0630 -0.1343 -0.0779 -0.0981 0.1392 0.1052 0.0500 0.0369 
+       0.0108 0.0026 -0.0609 0.0817 0.0789 0.0266 -0.1107 0.0307 0.0982 0.0332 
+       -0.0118 -0.0253 -0.0723 0.0773 0.0071 -0.0670 0.0489 -0.0164 -0.1178 -0.1125 
+       0.0195 0.0089 0.0084 -0.0338 -0.0800 0.1208 0.1946 0.1314 0.0501 0.0125 
+       0.0086 0.0007 -0.0207 0.0667 0.0856 0.0300 -0.0296 -0.0914 -0.1686 0.0065 
+       -0.0144 -0.0199 -0.0912 0.0094 -0.0621 -0.0558 -0.1192 0.0172 0.1005 0.0459 
+       0.0097 -0.0154 0.0627 0.0100 0.0105 -0.0324 -0.1674 0.0110 0.0824 0.0256 
+       -0.0049 0.0101 0.0343 0.0281 0.0643 -0.0030 0.0838 0.1121 0.0124 0.0561 
+       0.0337 0.0512 -0.0225 -0.0871 0.0212 0.1298 0.0677 0.0342 -0.0068 -0.0339 
+       0.0502 0.0655 0.0351 -0.0443 -0.0720 -0.0619 0.1007 0.1348 0.0552 0.0187 
+       0.0316 0.0371 -0.0035 0.0578 -0.0372 0.1005 0.0670 -0.0176 -0.0117 -0.0662 
+       0.0258 0.0044 0.1166 0.0904 0.0584 0.0033 -0.0458 0.1000 -0.0061 -0.0204 
+       0.0064 0.0162 -0.0308 -0.1166 0.0513 -0.0087 0.0658 -0.0118 0.1212 0.0973 
+       0.0186 0.0343 -0.0433 -0.0851 0.0491 -0.0004 -0.0221 0.0576 -0.0538 0.0712 
+       -0.0343 -0.0464 -0.1078 -0.0036 0.0912 0.0273 0.0065 -0.0147 -0.0646 -0.0941 
+       -0.0085 -0.0242 -0.0204 -0.0645 -0.0353 -0.0870 -0.2034 0.1233 0.0411 -0.0043 
+       -0.0170 -0.0171 -0.0598 -0.0571 0.0580 -0.0064 -0.0462 -0.1078 -0.0861 0.1577 
+       -0.0054 0.0012 -0.0199 -0.0119 0.0150 0.0024 0.1201 0.0220 0.0476 -0.0023 
+       0.0042 0.0022 -0.0222 -0.0180 -0.0727 -0.0994 -0.2163 -0.2307 0.0950 0.0551f
index 7667d40919456da0962c7a0796d77829f776b251..a4ea72c96256994059bd2ebd87eea4218e75a6b1 100644 (file)
-10 128 
-       0.0331 0.0140 0.0238 -0.0443 0.0011 -0.0332 0.0261 0.0967 0.0174 -0.0274 
-       0.0004 -0.0159 -0.0151 -0.0035 -0.0676 0.0820 0.0239 -0.0128 -0.0534 -0.0913 
-       0.0361 0.0088 0.0455 0.0643 0.0334 -0.0002 0.0634 0.0324 -0.0234 -0.0344 
-       -0.0419 0.0479 0.0338 0.0046 -0.0233 0.0848 0.0413 -0.0095 0.0078 -0.0078 
-       -0.0627 0.0222 0.0686 0.0179 -0.0321 -0.0445 -0.0409 0.0025 0.0127 0.0238 
-       0.0105 -0.0122 0.0515 -0.0030 -0.0279 -0.0055 -0.0396 -0.0979 0.0637 0.0206 
-       -0.0443 -0.0094 0.0313 -0.0177 0.0073 -0.0035 -0.0126 -0.0421 -0.0754 -0.0631 
-       -0.0014 -0.0035 -0.0600 -0.0123 -0.0528 0.0430 0.0834 0.0469 0.0176 -0.0178 
-       -0.0084 -0.0075 -0.0323 0.0542 -0.0085 0.0081 -0.0140 0.0609 0.0950 0.0529 
-       0.0038 -0.0313 0.0384 -0.0110 0.0706 0.0204 -0.0361 -0.0587 0.0082 -0.0450 
-       -0.0226 -0.0340 -0.0078 -0.0071 -0.0199 -0.0564 -0.0187 0.0098 -0.0425 0.1111 
-       -0.0051 -0.0223 -0.0021 -0.0237 0.0125 0.0308 0.1034 0.0819 0.0415 0.0180 
-       0.0144 0.0316 0.0023 0.0180 -0.1024 0.0074 -0.0180 -0.0135 0.0122 -0.0202 
-       0.0072 0.0557 -0.0270 -0.0570 0.0000 0.0482 0.0247 0.0367 0.0489 0.0253 
-       0.0160 0.0037 0.0107 -0.0391 -0.0538 0.0422 -0.0610 0.0678 0.0721 0.0238 
-       0.0002 -0.0165 0.0200 -0.0057 0.0260 0.0421 -0.0635 -0.0297 0.0236 0.0755 
-       0.0029 0.0097 -0.0636 -0.0513 0.0052 -0.0202 -0.0135 -0.0569 -0.0044 -0.0437 
-       0.0202 0.0254 0.0096 0.0227 0.0581 -0.0098 0.0725 0.0566 0.0566 0.0122 
-       0.0056 -0.0078 0.0027 0.0077 -0.0370 0.0821 0.0069 0.1057 0.0056 -0.0204 
-       -0.0013 -0.0030 -0.0401 -0.0637 -0.0196 -0.0747 0.0805 0.0440 -0.0118 -0.0082 
-       0.0212 0.0244 -0.0090 0.0512 0.0310 0.0859 0.0558 0.0357 0.0148 -0.0117 
-       0.0394 -0.0050 -0.0605 -0.0214 -0.0334 0.0118 -0.0121 0.0166 0.0220 -0.0191 
-       0.0527 0.0281 0.0379 -0.0096 -0.0464 0.0565 0.0584 0.0217 0.0176 -0.0150 
-       0.0044 -0.0019 -0.0442 0.0239 0.0005 -0.0295 -0.0319 -0.0916 0.0052 0.0843 
-       -0.0072 -0.0260 -0.0009 -0.0607 -0.0215 0.0909 0.0301 0.0194 -0.0389 0.0372 
-       -0.0244 0.0655 0.0381 -0.0053 0.0323 -0.0132 -0.0622 0.0348 -0.0268 0.0414 
-       0.0282 0.0127 0.0642 0.0200 -0.0010 -0.0178 0.0428 -0.0176 0.0523 0.0583 
-       -0.0222 -0.0522 0.0121 -0.0280 0.0097 0.0083 0.0693 0.0216 -0.0331 -0.0679 
-       0.0040 -0.0051 -0.0054 0.0593 0.0694 0.0291 0.0212 -0.0131 -0.0355 -0.0828 
-       -0.0114 -0.0214 -0.0291 -0.0100 0.0484 0.0514 -0.0050 -0.0481 -0.0928 -0.0382 
-       0.0043 -0.0232 -0.0107 0.0254 -0.0529 -0.0725 0.0069 -0.0543 -0.0307 -0.0074 
-       -0.0308 -0.0429 -0.0494 -0.0547 -0.0367 -0.0303 0.0010 0.0006 0.0436 -0.0033 
-       -0.0135 -0.0265 -0.0663 0.0275 -0.0292 0.0621 0.0054 -0.0280 -0.0684 0.0520 
-       -0.0220 -0.0339 -0.0628 0.0426 0.0043 -0.0515 0.0551 0.0182 0.0298 0.0200 
-       -0.0161 -0.0366 -0.0145 -0.0313 -0.0542 0.0531 -0.0287 -0.0835 0.0295 -0.0025 
-       0.0136 0.0365 -0.0070 -0.0006 -0.0034 -0.0537 -0.0824 -0.0300 -0.0443 -0.0537 
-       -0.0412 -0.0461 0.0280 -0.0295 0.0462 0.0160 0.0182 -0.0363 -0.0295 0.0578 
-       0.0067 -0.0079 0.0136 0.0280 -0.0380 -0.0697 0.0974 0.0693 0.0221 -0.0083 
-       0.0644 0.0386 0.0082 0.0379 0.0217 0.0044 -0.0131 -0.0544 -0.0200 -0.0410 
-       0.0075 0.0235 -0.0184 -0.0241 0.0992 0.0521 -0.0029 -0.0460 0.0054 0.0294 
-       0.0302 0.0155 -0.0324 0.0561 -0.0174 -0.0466 0.0500 -0.0231 0.0523 -0.0057 
-       0.0189 -0.0051 0.0323 0.0721 0.0506 0.0319 0.0078 -0.0301 0.0647 0.0208 
-       0.0006 -0.0303 0.0657 -0.0290 -0.0723 -0.0058 -0.0059 0.0045 0.0247 -0.0050 
-       0.0027 -0.0013 -0.0206 -0.0098 0.0378 -0.0088 -0.1201 0.0004 0.0469 -0.0132 
-       -0.0096 0.0042 -0.0202 -0.0162 -0.0707 -0.0748 0.0366 -0.0244 0.0670 0.0343 
-       0.0122 0.0133 -0.0012 -0.0725 0.0284 0.0541 0.0377 0.0012 -0.0471 -0.0657 
-       0.0054 -0.0050 -0.0173 -0.0643 -0.0897 0.0083 0.0317 -0.0231 0.0189 -0.0349 
-       0.0479 0.0364 0.0175 -0.0047 0.0490 0.0273 -0.0524 0.0496 0.0271 0.0221 
-       -0.0057 -0.0468 0.0174 0.0310 0.0396 -0.0174 0.0071 0.0750 0.0193 -0.0407 
-       -0.0165 -0.0238 -0.0145 0.0325 0.0240 -0.0095 0.0837 0.0278 -0.0629 0.0425 
-       -0.0013 0.0106 -0.0138 -0.0302 0.0124 -0.0208 -0.0322 0.0570 -0.0919 0.0108 
-       0.0250 -0.0036 0.0778 0.0282 -0.0181 0.0658 -0.0151 -0.0289 0.0024 -0.0424 
-       0.0052 -0.0168 0.0502 0.0163 0.0336 -0.0055 -0.0014 0.0747 -0.0148 0.0879 
-       -0.0007 -0.0380 0.0358 -0.0341 -0.0016 -0.0841 0.0500 0.0108 0.0258 0.0098 
-       -0.0103 -0.0218 -0.0027 0.0836 0.0311 0.0410 -0.0658 0.0210 -0.0035 -0.0311 
-       0.0036 -0.0205 0.0554 0.0110 -0.0399 -0.0077 0.0540 0.0158 -0.0889 -0.0191 
-       -0.0093 -0.0217 -0.0559 -0.0323 0.0064 -0.0082 -0.0505 0.1094 0.0233 0.0104 
-       -0.0027 -0.0063 -0.0228 0.0319 0.0039 -0.0035 -0.0524 -0.0983 -0.0196 -0.0816 
-       0.0007 -0.0054 -0.0087 0.0718 0.0673 0.0261 0.0003 -0.0382 -0.0487 0.0642 
-       0.0414 0.0311 -0.0184 0.0372 -0.0070 -0.0489 0.0336 0.0045 -0.0505 0.0646 
-       -0.0016 -0.0326 0.0291 -0.0384 0.0080 0.0194 -0.0773 0.0538 -0.0259 -0.0623 
-       0.0042 0.0057 0.0095 -0.0028 -0.0474 -0.0106 -0.0336 -0.0917 -0.1022 0.0406 
-       -0.0136 -0.0185 -0.0724 0.0194 -0.0479 -0.0140 -0.0757 0.0021 0.0269 0.0069 
-       -0.0329 -0.0622 -0.0409 -0.0050 0.0310 -0.0029 -0.0395 -0.0014 -0.0338 -0.0037 
-       0.0021 0.0356 -0.0038 -0.0436 0.0328 -0.0135 0.0642 0.0082 -0.0366 0.0725 
-       0.0032 -0.0226 0.0198 0.0280 -0.0233 0.0797 0.0590 -0.0209 -0.0149 0.0414 
-       0.0142 0.0292 -0.0210 0.0102 0.0193 -0.0114 0.0858 0.0370 -0.0288 -0.0721 
-       -0.0300 0.0511 0.0014 -0.0520 -0.0293 -0.0280 -0.0316 -0.0618 0.0265 0.0022 
-       -0.0466 -0.0384 0.0281 -0.0192 -0.0173 -0.0394 -0.0151 0.0920 0.0264 0.0134 
-       0.0104 0.0448 -0.0081 0.0134 -0.0196 -0.0696 -0.0251 0.0656 0.0342 0.0038 
-       0.0085 0.0002 -0.0049 -0.0119 -0.0582 0.0666 0.0333 -0.0120 0.0943 0.0581 
-       -0.0053 -0.0194 -0.0322 0.0674 0.0108 -0.0630 -0.0583 0.0332 -0.0311 -0.0008 
-       0.0009 -0.0191 -0.0084 -0.0479 0.0630 0.0152 0.0364 -0.0387 0.0873 0.0333 
-       -0.0284 -0.0480 0.0674 0.0594 0.0240 0.0460 0.0357 0.0119 0.0218 0.0001 
-       0.0047 0.0330 0.0242 -0.0157 -0.0531 -0.0897 -0.0024 -0.0026 -0.0470 0.0392 
-       0.0141 0.0081 -0.0390 0.0135 -0.0034 0.0998 -0.0108 -0.0435 0.0396 -0.0056 
-       -0.0253 0.0484 0.0575 0.0493 0.0447 0.0176 -0.0247 -0.0445 -0.0268 -0.0338 
-       0.0221 0.0088 -0.0394 0.0439 0.0210 -0.0151 -0.0080 -0.0381 -0.1057 -0.0241 
-       0.0045 -0.0142 -0.0148 -0.1049 0.0239 -0.0108 -0.0227 0.0356 0.0298 0.0291 
-       0.0259 0.0138 0.0545 0.0399 0.0119 -0.0288 -0.0525 0.0369 -0.0402 -0.0714 
-       0.0126 0.0019 0.0168 0.0132 -0.0403 -0.0322 -0.1177 0.0374 -0.0328 0.0688 
-       -0.0122 -0.0087 -0.0245 -0.0224 -0.0416 -0.0666 0.0246 -0.0127 -0.0490 -0.1004 
-       0.0380 0.0432 -0.0029 -0.0318 -0.0515 -0.0173 0.0218 -0.0105 -0.0756 -0.0406 
-       -0.0303 -0.0502 -0.0137 0.0117 -0.0753 0.0318 0.0257 0.0355 0.0225 0.0047 
-       -0.0004 -0.0090 -0.0123 -0.0169 -0.0579 -0.0569 -0.1260 -0.1069 0.0203 0.0183 
-       -0.0513 0.0306 0.0291 0.0125 0.0133 -0.0132 0.0575 0.0286 0.0718 0.0632 
-       0.0159 0.0159 0.0684 0.0424 -0.0104 0.0235 -0.0109 0.0793 0.0514 0.0103 
-       -0.0189 -0.0252 -0.0397 -0.0579 0.0360 0.0704 0.0063 0.0114 0.0053 -0.0474 
-       0.0154 0.0019 -0.0634 -0.0005 0.0707 0.0161 0.0400 0.0428 -0.0240 0.0053 
-       0.0463 0.0411 0.0044 -0.0333 -0.0399 -0.0424 0.0288 0.0026 0.0574 0.0349 
-       -0.0440 0.0233 0.0411 0.0227 0.0604 0.0236 0.0455 0.0564 -0.0089 -0.0337 
-       0.0200 -0.0102 0.0516 -0.0264 0.0798 0.0610 0.0461 0.0285 0.0084 -0.0128 
-       0.0056 -0.0197 0.0184 0.0185 -0.0115 0.0258 0.0488 -0.0095 0.0378 -0.0467 
-       -0.0160 -0.0275 -0.0630 0.0411 0.0026 0.0008 0.0246 0.0143 -0.0397 -0.0783 
-       0.0287 0.0103 0.0180 -0.0400 -0.0527 0.0302 -0.0431 -0.0674 -0.0198 -0.0667 
-       0.0248 0.0268 -0.0210 0.0160 -0.0054 0.0438 -0.0391 0.0117 -0.0422 -0.0909 
-       -0.0109 -0.0259 -0.0233 -0.0397 -0.0817 0.0038 -0.0649 0.0017 -0.0659 -0.0197 
-       -0.0060 -0.0036 -0.0610 0.0391 0.0603 0.0055 -0.0092 -0.0487 0.0421 -0.0159 
-       -0.0781 -0.0043 -0.0051 -0.0053 0.0352 0.0059 -0.0401 -0.0178 0.0339 0.0048 
-       -0.0169 -0.0240 -0.0445 -0.0413 -0.0030 -0.0487 0.0243 -0.0333 -0.0934 0.0163 
-       -0.0025 -0.0043 0.0228 0.1022 -0.0224 -0.0228 0.0191 -0.0046 -0.0043 -0.0059 
-       0.0281 0.0043 0.0595 0.0120 0.0109 -0.0540 -0.0743 0.0183 0.0529 0.0063 
-       -0.0169 -0.0375 0.0310 0.0318 -0.0331 -0.0330 -0.0762 -0.0173 -0.0055 -0.0571 
-       0.0289 0.0161 -0.0396 0.0891 0.0374 0.0106 -0.0196 0.0614 0.0195 -0.0065 
-       0.0363 0.0099 0.0535 0.0015 -0.0277 -0.0609 0.0244 -0.0320 -0.0105 -0.0614 
-       0.0015 -0.0019 -0.0185 -0.0495 -0.0772 -0.0050 0.0227 0.0075 -0.0235 0.0901 
-       -0.0084 -0.0314 -0.0123 -0.0590 -0.0031 -0.0622 -0.0393 -0.0799 0.0214 -0.0346 
-       -0.0264 -0.0235 -0.0640 -0.0518 0.0392 0.0064 0.0438 0.0012 0.0051 0.0452 
-       0.0102 0.0068 -0.0395 0.0338 0.0296 -0.0042 0.0643 0.0102 0.0559 0.0928 
-       -0.0062 -0.0125 -0.0097 -0.0151 0.0683 0.0582 -0.0037 0.0674 0.0678 0.0394 
-       -0.0023 -0.0097 -0.0221 -0.0496 0.0712 -0.0216 -0.0130 0.0238 -0.0221 -0.0721 
-       0.0040 -0.0016 -0.0189 -0.0486 -0.0467 -0.0745 -0.0861 0.0379 0.0106 -0.0242 
-       0.0065 -0.0204 0.0610 0.0462 0.0154 -0.0237 -0.0338 -0.0616 -0.0642 0.0092 
-       0.0214 0.0106 0.0286 -0.0028 0.0757 0.0130 0.0291 -0.0013 -0.0889 -0.0069 
-       -0.0097 0.0663 0.0169 0.0403 0.0104 0.0135 -0.0328 -0.0516 0.0770 0.0410 
-       0.0324 0.0094 0.0360 -0.0668 0.0072 -0.0257 -0.0108 -0.0538 -0.0412 0.0247 
-       0.0222 0.0352 0.0225 0.0112 -0.0068 0.0642 0.0194 -0.0211 -0.0967 0.0409 
-       -0.0113 -0.0479 0.0240 -0.0150 -0.0060 -0.0112 -0.0075 0.0175 0.1012 0.0637 
-       -0.0185 0.0289 -0.0059 0.0278 0.0226 -0.0652 0.0168 -0.0469 -0.0129 -0.0059 
-       0.0163 0.0887 0.0372 0.0273 0.0081 -0.0167 0.0280 0.0110 -0.0139 -0.0224 
-       -0.0040 -0.0014 -0.0326 -0.0406 0.0036 -0.0520 -0.0185 -0.0254 0.0988 0.0697 
-       -0.0874 0.0724 -0.0256 0.0227 0.0017 -0.0065 -0.0133 -0.0286 -0.0499 -0.0222 
-       -0.0037 0.0041 -0.0325 -0.0603 0.0295 -0.0020 -0.0668 -0.0552 -0.0643 0.0571 
-       0.0427 0.0266 -0.0122 0.0151 -0.0276 -0.0337 -0.0581 -0.0633 0.0618 0.0055 
-       0.0178 0.0464 0.0242 -0.0288 0.0417 0.0194 -0.0065 -0.0173 0.0200 -0.0409 
-       -0.0309 -0.0531 -0.0092 0.0458 0.0012 0.0079 -0.0126 -0.0604 0.0546 0.0273 
-       -0.0304 0.0461 0.0475 -0.0405 -0.0342 -0.0273 0.0569 0.0392 -0.0095 -0.0377 
-       -0.0211 -0.0380 -0.0398 0.0478 0.0498 0.0571 0.0397 0.0191 0.0284 0.0027
+10 256
+       -0.0448 0.0001 0.0172 0.0154 0.0284 0.0165 0.0049 0.0650 -0.0157 -0.0570 
+       -0.0027 -0.0099 -0.0142 -0.0054 0.0428 0.0157 -0.0946 -0.0007 -0.0573 -0.0002 
+       -0.0257 -0.0126 -0.0394 0.0355 0.0016 -0.0372 0.0659 0.0098 -0.0417 0.0339 
+       0.0120 0.0079 -0.0497 0.0218 0.0193 -0.0455 -0.0286 -0.0154 0.0650 0.0313 
+       -0.0112 -0.0132 -0.0429 -0.0882 0.0391 -0.0064 -0.0198 0.0007 -0.0053 -0.0190 
+       -0.0376 0.0348 0.0048 -0.0455 0.0447 0.0044 0.0421 0.0439 -0.0146 0.0212 
+       -0.0220 0.0234 -0.0195 -0.0506 0.0390 0.0287 0.0162 -0.0253 -0.0285 -0.0719 
+       -0.0078 0.0123 0.0116 -0.0048 -0.0276 -0.0431 0.0057 0.0633 -0.0132 0.0985 
+       0.0371 0.0052 0.0539 0.0328 0.0008 -0.0286 0.0567 -0.0176 0.0381 -0.0048 
+       -0.0026 -0.0188 -0.0292 0.0289 -0.0405 -0.0465 -0.0549 0.0258 0.0262 0.0591 
+       0.0415 0.0234 0.0114 0.0329 -0.0190 0.0757 0.0361 0.0241 0.0332 0.0085 
+       0.0088 0.0066 -0.0519 0.0015 0.0389 -0.0339 0.0588 0.0153 -0.0093 -0.0500 
+       -0.0305 -0.0453 0.0247 0.0006 -0.0163 0.0617 -0.0091 0.0238 0.0469 0.0053 
+       -0.0265 0.0127 0.0480 -0.0052 -0.0661 -0.0004 -0.0418 0.0376 -0.0022 0.0040 
+       0.0207 0.0042 0.0211 -0.0308 0.0263 -0.0237 -0.0963 0.0393 -0.0146 -0.0574 
+       0.0077 0.0134 -0.0217 0.0058 -0.0260 -0.0553 -0.0193 -0.1024 0.0184 -0.0067 
+       -0.0021 -0.0218 -0.0028 -0.0411 -0.0440 -0.0191 -0.0038 0.0653 -0.0654 0.0175 
+       -0.0912 0.0358 0.0150 -0.0160 -0.0189 0.0112 0.0609 0.0264 -0.0082 -0.0228 
+       -0.0137 -0.0348 0.0099 0.0875 0.0229 0.0329 -0.0068 -0.0321 0.0131 -0.0267 
+       0.0021 -0.0057 -0.0108 -0.0337 -0.0870 0.0699 0.0162 -0.0003 -0.0213 -0.0526 
+       0.0095 0.0212 -0.0131 0.0339 0.0486 0.0083 -0.0527 -0.0828 -0.0263 -0.0044 
+       0.0100 -0.0115 0.0105 0.0016 0.0703 -0.0063 -0.0520 0.0452 0.0468 0.0136 
+       0.0031 0.0679 0.0498 0.0112 0.0089 -0.0109 -0.0175 -0.0306 0.0454 0.0190 
+       0.0140 0.0033 0.0250 0.0414 0.0302 0.0656 0.0106 -0.0438 0.0425 0.0297 
+       -0.0136 -0.0089 0.0292 -0.0570 -0.0207 -0.0578 -0.0200 0.0096 -0.0288 -0.0290 
+       -0.0237 -0.0340 -0.0348 -0.0200 0.0531 0.0455 -0.0336 0.0156 0.0101 0.0120 
+       0.0330 0.0327 0.0085 -0.0142 0.0080 0.0400 -0.0713 0.0304 0.0189 -0.0283 
+       -0.0056 -0.0148 -0.0302 -0.0493 -0.0305 -0.0071 -0.0171 -0.0544 0.0707 0.0573 
+       -0.0000 0.0336 0.0128 -0.0021 0.0394 0.0500 -0.0019 0.0707 0.0548 0.0175 
+       0.0140 0.0079 -0.0015 -0.0309 0.0439 -0.0548 0.0122 -0.0451 0.0653 0.0012 
+       -0.0019 -0.0209 0.0433 -0.0081 0.0258 0.0271 0.0618 -0.0088 0.0476 -0.0092 
+       -0.0156 -0.0215 -0.0410 -0.0159 -0.0253 -0.0529 -0.0907 0.0492 -0.0023 -0.0309 
+       0.0139 0.0095 0.0349 0.0026 0.0672 -0.0409 0.0208 0.0123 -0.0219 -0.0074 
+       0.0400 0.0187 0.0627 0.0243 0.0461 0.0320 -0.0099 0.0219 0.0223 -0.0110 
+       0.0353 -0.0009 -0.0143 -0.0083 0.0480 0.0310 0.0143 0.0290 0.0228 0.0766 
+       -0.0108 -0.0354 -0.0365 0.0355 0.0450 -0.0147 -0.0249 0.0253 -0.0333 -0.0520 
+       -0.0123 -0.0234 -0.0603 -0.0080 0.0498 -0.0231 0.0378 -0.0064 0.0153 0.0342 
+       -0.0098 -0.0323 0.0564 0.0125 -0.0418 -0.0654 0.0277 0.0060 -0.0142 -0.0282 
+       -0.0191 -0.0472 0.0006 -0.0377 0.0193 -0.0421 -0.0317 -0.0306 0.0425 -0.0281 
+       0.0027 -0.0125 0.0462 0.0635 0.0140 -0.0097 -0.0839 0.0006 -0.0341 0.0384 
+       0.0638 0.0314 -0.0167 0.0140 0.0315 -0.0149 0.0075 -0.0323 0.0169 -0.0043 
+       -0.0250 -0.0253 -0.0164 0.0271 0.0231 0.0844 0.0328 0.0004 -0.0434 -0.0305 
+       -0.0174 -0.0299 0.0067 0.0013 -0.0381 0.0698 0.0693 0.0229 -0.0497 0.0203 
+       0.0268 0.0024 -0.0281 -0.0442 0.0609 -0.0170 -0.0262 -0.0295 -0.0590 0.0296 
+       0.0019 0.0100 0.0063 0.0563 -0.0047 -0.0521 0.0342 -0.0262 -0.0250 -0.0731 
+       -0.0019 0.0083 -0.0167 -0.0250 0.0905 0.0295 -0.0235 0.0240 -0.0085 -0.0425 
+       0.0334 0.0360 0.0001 0.0473 0.0096 -0.0164 -0.0682 0.0085 -0.0325 0.0089 
+       0.0292 0.0194 0.0188 -0.0164 0.0557 0.0163 -0.0091 -0.0390 -0.0111 -0.0739 
+       -0.0177 -0.0293 -0.0252 0.0204 -0.0248 -0.0599 0.0085 -0.0476 0.0669 0.0233 
+       -0.0207 0.0434 0.0423 -0.0150 -0.0257 -0.0481 -0.0376 -0.0145 -0.0025 -0.0584 
+       0.0276 -0.0108 -0.0167 0.0067 0.0384 0.0024 -0.0631 -0.0634 0.0484 0.0063 
+       0.0410 0.0029 0.0598 -0.0185 -0.0220 0.0256 0.0253 0.0574 -0.0088 0.0092 
+       0.0108 -0.0016 -0.0568 -0.0072 -0.0287 0.0855 0.0168 0.0099 0.0098 0.0242 
+       0.0275 0.0025 0.0123 -0.0447 -0.0600 0.0458 -0.0256 0.0106 0.0509 0.0257 
+       0.0057 -0.0424 -0.0102 0.0254 -0.0156 -0.0447 0.0341 -0.0178 0.0159 -0.0286 
+       0.0157 -0.0038 0.0302 0.0133 0.0647 0.0414 0.0291 0.0311 -0.0570 -0.0204 
+       -0.0420 -0.0500 -0.0247 -0.0427 -0.0200 -0.0130 -0.0107 0.0257 0.0187 0.0024 
+       -0.0010 0.0157 -0.0007 0.0712 0.0222 0.0342 0.0283 -0.0049 -0.0583 0.0319 
+       0.0326 0.0282 0.0329 -0.0250 -0.0054 -0.0024 -0.0637 0.0180 -0.0274 0.0587 
+       0.0188 0.0090 -0.0607 0.0733 -0.0295 0.0117 0.0048 -0.0001 -0.0214 -0.0250 
+       0.0306 0.0675 -0.0083 -0.0094 0.0439 0.0222 0.0156 0.0079 0.0135 0.0124 
+       -0.0203 -0.0449 0.0442 0.0304 0.0079 -0.0088 -0.0630 0.0592 0.0252 -0.0248 
+       -0.0540 -0.0016 -0.0415 0.0400 0.0277 0.0061 -0.0010 -0.0363 -0.0122 -0.0326 
+       0.0085 -0.0064 -0.0343 -0.0197 -0.0755 0.0224 -0.0976 0.0249 -0.0120 -0.0033 
+       0.0192 -0.0045 -0.0124 -0.0214 -0.0409 0.0415 0.0901 0.0557 0.0273 -0.0086 
+       -0.0035 -0.0273 0.0433 0.0416 0.0390 -0.0103 0.0411 -0.0178 -0.0205 0.0723 
+       0.0248 0.0158 -0.0189 -0.0117 -0.0810 -0.0115 0.0471 0.0118 -0.0131 0.0420 
+       0.0265 0.0408 0.0017 -0.0609 0.0058 -0.0470 0.0231 0.0159 0.0247 0.0172 
+       0.0560 0.0283 0.0232 0.0313 -0.0039 -0.0030 -0.0039 -0.0184 -0.0273 -0.0637 
+       0.0319 -0.0097 0.0658 -0.0493 0.0200 -0.0168 0.0159 -0.0140 0.0371 -0.0051 
+       -0.0129 -0.0201 -0.0616 -0.0031 -0.0652 0.0124 0.0240 -0.0333 0.0030 -0.0068 
+       -0.0164 -0.0268 -0.0498 -0.0044 0.0318 -0.0183 -0.0477 -0.0689 0.0124 -0.0398 
+       -0.0674 0.0499 0.0285 -0.0035 0.0284 0.0140 -0.0336 -0.0695 -0.0080 -0.0162 
+       0.0514 0.0225 0.0104 -0.0118 -0.0291 -0.0267 0.0626 0.0085 -0.0026 -0.0504 
+       -0.0289 -0.0626 0.0145 0.0294 -0.0081 -0.0195 -0.0177 -0.0147 -0.0665 -0.0081 
+       0.0323 0.0014 -0.0027 -0.0791 0.0374 0.0404 0.0081 -0.0446 0.0359 0.0011 
+       -0.0436 -0.0039 0.0279 -0.0073 -0.0466 0.0171 0.0032 -0.0564 0.0110 -0.0309 
+       0.0014 -0.0049 -0.0169 -0.0744 -0.0495 -0.0109 0.0483 -0.0024 0.0018 -0.0113 
+       0.0096 0.0230 -0.0234 0.0300 0.0395 0.0028 0.0213 -0.0088 -0.0767 -0.0434 
+       0.0161 -0.0040 -0.0063 0.0754 0.0118 0.0056 0.0213 0.0662 -0.0067 -0.0473 
+       0.0073 0.0108 0.0361 -0.0158 -0.0203 0.0971 0.0182 -0.0265 0.0153 0.0004 
+       0.0133 -0.0123 0.0149 -0.0131 -0.0651 0.0162 -0.0193 0.0851 -0.0064 -0.0599 
+       0.0052 0.0067 -0.0245 0.0232 -0.0467 -0.0713 -0.0036 0.0355 0.0285 -0.0319 
+       0.0072 0.0180 -0.0099 -0.0709 -0.0310 0.0024 -0.0282 0.0502 0.0075 -0.0490 
+       -0.0082 -0.0056 -0.0460 -0.0437 -0.0132 -0.0471 0.0513 -0.0031 0.0648 0.0065 
+       -0.0056 -0.0269 0.0377 -0.0017 0.0200 0.0260 -0.0426 -0.0225 0.0924 0.0452 
+       0.0022 0.0022 -0.0441 0.0285 0.0551 0.0354 0.0408 0.0650 -0.0064 0.0016 
+       0.0009 -0.0366 -0.0257 0.0224 0.0017 0.0466 0.0064 -0.0264 -0.0167 -0.0743 
+       -0.0401 0.0678 0.0055 0.0270 0.0305 -0.0204 -0.0651 0.0379 -0.0062 0.0080 
+       -0.0115 -0.0488 0.0131 -0.0308 0.0014 -0.0381 0.0385 -0.0273 0.0224 0.0537 
+       0.0198 0.0236 -0.0173 0.0366 0.0517 0.0692 0.0156 -0.0144 -0.0002 -0.0398 
+       0.0110 0.0119 -0.0118 -0.0136 0.0295 0.0079 0.0975 0.0227 0.0070 0.0447 
+       0.0110 -0.0127 -0.0045 0.0650 0.0163 -0.0349 -0.0070 -0.0545 -0.0516 0.0091 
+       -0.0071 -0.0150 -0.0348 -0.0263 0.0004 -0.0201 0.0495 0.0650 -0.0152 -0.0758 
+       -0.0573 0.0169 0.0779 0.0164 0.0250 -0.0273 0.0231 0.0053 -0.0041 -0.0173 
+       0.0089 0.0027 -0.0220 -0.0303 0.0726 0.0734 0.0155 -0.0220 -0.0385 0.0263 
+       0.0144 0.0021 0.0268 -0.0491 0.0216 0.0166 0.0428 -0.0283 -0.0654 0.0027 
+       -0.0128 0.0148 0.0219 -0.0578 0.0282 0.0011 -0.0411 0.0167 0.0522 0.0075 
+       -0.0060 0.0002 -0.0306 0.0240 0.0041 0.0400 0.0898 0.0142 0.0061 -0.0479 
+       0.0104 -0.0304 0.0280 -0.0214 0.0207 -0.0211 0.0092 0.0733 0.0070 -0.0557 
+       0.0122 0.0385 -0.0594 -0.0044 -0.0052 -0.0147 0.0277 0.0331 0.0079 0.0074 
+       0.0135 0.0007 0.0138 -0.0469 0.0263 0.0010 -0.0353 -0.0834 -0.0121 0.0849 
+       0.0107 0.0018 -0.0091 -0.0101 0.0069 -0.0245 0.0251 0.1183 0.0538 0.0334 
+       -0.0043 -0.0108 -0.0031 0.0354 -0.0020 -0.0367 0.0879 0.0530 0.0470 -0.0025 
+       0.0114 -0.0162 0.0573 0.0295 0.0351 0.0044 0.0432 0.0581 0.0629 0.0306 
+       -0.0373 -0.0460 -0.0033 -0.0126 0.0313 0.0058 0.0443 0.0003 -0.0093 -0.0583 
+       0.0139 -0.0175 0.0280 0.0193 -0.0351 -0.0457 -0.0758 0.0120 -0.0254 -0.0525 
+       0.0068 -0.0083 -0.0011 0.0322 0.0357 -0.0078 0.0281 -0.0148 0.0992 0.0421 
+       -0.0325 0.0186 0.0412 -0.0516 -0.0331 -0.0274 0.0218 0.0014 0.0363 0.0486 
+       0.0049 0.0170 0.0039 0.0015 -0.0092 -0.0373 -0.1017 -0.0148 0.0606 0.0267 
+       0.0150 0.0027 0.0289 0.0252 0.0214 -0.0304 -0.0427 0.1018 -0.0115 0.0128 
+       0.0062 0.0444 0.0312 0.0058 -0.0155 -0.0412 -0.0221 -0.0629 -0.0553 -0.0003 
+       0.0005 -0.0425 0.0109 0.0455 -0.0150 0.0230 0.0186 -0.0164 0.0300 0.0524 
+       0.0289 0.0143 -0.0338 -0.0170 -0.0616 -0.0002 -0.0097 -0.0358 0.0131 -0.0453 
+       -0.0042 0.0347 0.0366 0.0406 0.0316 0.0283 0.0771 0.0281 -0.0064 -0.0114 
+       -0.0376 0.0209 -0.0031 -0.0180 0.0168 -0.0250 -0.0023 -0.0501 -0.0893 -0.0054 
+       -0.0048 -0.0375 0.0135 -0.0205 -0.0718 -0.0003 0.0463 0.0024 0.0359 -0.0185 
+       0.0336 0.0044 -0.0568 -0.0200 0.0348 0.0240 -0.0225 0.0005 -0.0074 -0.0497 
+       -0.0184 -0.0202 -0.0416 -0.0565 0.0202 0.0384 0.0588 0.0440 0.0042 -0.0034 
+       0.0197 -0.0064 0.0661 0.0062 0.0058 -0.0545 -0.0129 -0.0020 0.0062 0.0559 
+       0.0073 -0.0366 -0.0099 -0.0712 -0.0113 -0.0222 -0.0578 0.0281 0.0058 -0.0411 
+       0.0370 0.0419 0.0354 0.0095 -0.0026 -0.0056 0.0367 -0.0122 -0.0337 0.0501 
+       -0.0110 -0.0208 -0.0219 -0.0435 -0.0736 0.0396 -0.0008 0.0658 0.0535 0.0217 
+       0.0099 -0.0010 -0.0004 0.0377 -0.0213 -0.0165 -0.0697 -0.0756 -0.0017 -0.0491 
+       -0.0092 -0.0205 -0.0110 0.0257 0.0743 0.0343 0.0003 -0.0560 -0.0179 0.0010 
+       0.0212 -0.0231 -0.0076 -0.0360 -0.0386 0.0158 -0.0052 -0.0883 -0.0250 -0.0030 
+       -0.0264 -0.0185 -0.0380 -0.0198 -0.0400 -0.0710 0.0407 -0.0112 -0.0120 -0.0587 
+       0.0533 0.0061 -0.0203 0.0316 -0.0173 -0.0140 -0.0364 0.0670 0.0168 -0.0195 
+       0.0269 0.0184 -0.0132 -0.0514 0.0285 0.0205 -0.0109 0.0852 -0.0219 0.0117 
+       0.0025 -0.0029 -0.0446 0.0714 0.0095 -0.0356 -0.0928 0.0183 -0.0195 -0.0024 
+       -0.0033 0.0104 -0.0126 0.0083 -0.0147 0.0649 -0.0188 -0.0692 -0.0389 -0.0541 
+       -0.0035 0.0503 0.0364 -0.0331 0.0282 0.0101 0.0018 0.0244 -0.0381 -0.0433 
+       0.0099 -0.0018 0.0365 -0.0126 -0.0485 -0.0076 0.0295 -0.0091 -0.0528 -0.0805 
+       0.0140 -0.0008 -0.0440 0.0647 0.0176 0.0160 0.0544 0.0137 0.0505 0.0373 
+       -0.0174 -0.0283 -0.0353 -0.0398 -0.0626 0.0334 0.0001 -0.0219 -0.0686 0.0596 
+       0.0290 0.0104 0.0133 0.0771 0.0561 0.0145 -0.0056 -0.0142 0.0103 0.0076 
+       -0.0209 -0.0402 -0.0385 0.0139 0.0048 0.0519 0.0129 -0.0451 0.0558 0.0192 
+       0.0162 -0.0129 0.0404 -0.0022 -0.0527 -0.0236 0.0147 -0.0347 -0.0649 0.0510 
+       -0.0080 -0.0000 0.0193 0.0361 0.0420 0.0265 -0.0665 -0.0170 0.0091 -0.0466 
+       -0.0045 -0.0174 -0.0112 -0.0405 -0.0285 -0.0756 0.0136 -0.0180 -0.0802 0.0317 
+       0.0027 -0.0033 0.0137 0.0030 0.0047 0.0192 -0.0287 -0.0689 -0.1230 0.0543 
+       -0.0153 -0.0317 -0.0327 -0.0070 -0.0490 -0.0534 0.0550 0.0315 0.0044 0.0483 
+       -0.0001 -0.0091 -0.0360 0.0283 -0.0340 -0.0101 -0.0276 -0.0497 -0.0943 -0.0275 
+       -0.0432 0.0411 -0.0076 -0.0379 -0.0246 0.0780 -0.0335 0.0379 0.0241 0.0128 
+       0.0249 0.0394 0.0034 0.0102 0.0357 -0.0062 0.0338 0.0552 0.0067 -0.0545 
+       0.0020 -0.0217 -0.0179 -0.0182 -0.0009 0.0758 -0.0288 0.0762 0.0100 -0.0224 
+       0.0492 0.0250 -0.0089 -0.0391 -0.0138 -0.0266 -0.0202 -0.0399 -0.0537 -0.0067 
+       -0.0377 0.0355 0.0496 0.0044 0.0038 -0.0020 0.0115 -0.0098 -0.0519 0.0716 
+       -0.0043 0.0014 -0.0412 -0.0023 0.0181 -0.0058 -0.0509 0.0774 0.0545 -0.0183 
+       0.0151 0.0197 -0.0013 -0.0421 -0.0514 0.0459 -0.0029 -0.0106 -0.0887 0.0042 
+       0.0024 -0.0044 -0.0156 -0.0101 -0.0391 -0.0463 -0.1080 -0.0096 -0.0727 0.0632 
+       0.0033 -0.0211 0.0388 0.0430 -0.0070 0.0680 0.0433 0.0466 0.0099 -0.0310 
+       -0.0225 -0.0464 -0.0129 0.0276 0.0172 0.0052 0.0324 0.0687 0.0261 0.0244 
+       0.0302 0.0094 0.0490 0.0171 0.0291 0.0185 -0.0277 -0.0541 -0.0558 -0.0120 
+       -0.0001 0.0467 -0.0029 0.0710 0.0077 -0.0252 0.0136 -0.0027 0.0405 0.0033 
+       0.0002 0.0030 -0.0209 -0.0679 -0.0126 -0.0342 -0.0270 -0.0723 0.0277 -0.0355 
+       -0.0534 -0.0090 0.0014 0.0227 -0.0068 0.0107 -0.0668 0.0277 -0.0353 0.0357 
+       -0.0151 -0.0289 -0.0291 -0.0370 0.0230 -0.0005 -0.0091 -0.0502 -0.0793 -0.0466 
+       -0.0030 -0.0251 0.0107 0.0607 0.0037 -0.0718 0.0005 0.0495 0.0016 0.0269 
+       0.0111 -0.0064 -0.0114 0.0141 -0.0239 -0.0079 0.0842 0.0459 -0.0648 -0.0352 
+       0.0119 0.0145 -0.0242 0.0128 -0.0131 0.0208 -0.0434 0.0115 -0.0482 -0.0920 
+       -0.0566 0.0295 0.0205 0.0452 0.0305 0.0408 0.0249 0.0225 0.0480 0.0103 
+       0.0050 0.0329 -0.0069 0.0120 0.0461 -0.0060 -0.0195 -0.0051 -0.0226 0.0970 
+       -0.0532 -0.0314 0.0361 0.0334 -0.0250 -0.0199 0.0357 0.0099 0.0315 0.0146 
+       0.0162 0.0001 0.0050 -0.0071 -0.0599 0.0304 0.0448 -0.0437 0.0666 0.0422 
+       0.0224 0.0210 0.0131 -0.0009 -0.0040 0.0236 -0.0103 -0.0693 0.0667 -0.0028 
+       -0.0028 0.0234 -0.0030 -0.0098 -0.0056 -0.0588 0.0325 -0.0306 0.0157 0.0824 
+       -0.0150 0.0181 -0.0314 -0.0280 0.0066 0.0350 0.0371 -0.0499 -0.0216 0.0579 
+       0.0186 -0.0115 0.0481 0.0145 -0.0390 -0.0111 -0.0245 0.0700 0.0707 0.0268 
+       0.0457 0.0144 -0.0249 0.0184 -0.0090 0.0429 0.0374 -0.0121 -0.0585 0.0050 
+       -0.0144 -0.0312 -0.0086 -0.0145 -0.0394 0.0012 -0.0747 -0.0238 0.0552 -0.0041 
+       0.0197 0.0091 0.0300 0.0681 -0.0460 -0.0183 0.0031 0.0105 -0.0013 0.0106 
+       -0.0106 0.0228 -0.0167 0.0270 -0.0454 0.0239 0.0329 0.0804 0.0148 -0.0122 
+       -0.0013 -0.0213 -0.0091 0.0446 -0.0819 0.0332 0.0065 0.0521 0.0092 0.0246 
+       -0.0272 -0.0411 -0.0116 0.0364 0.0307 -0.0209 -0.0694 -0.0261 0.0242 0.0339 
+       0.0095 0.0320 0.0391 -0.0120 -0.0429 -0.0015 0.0394 0.0458 0.0446 -0.0152 
+       0.0215 0.0017 0.0323 0.0435 0.0223 -0.0528 -0.0326 -0.0079 0.0326 -0.0337 
+       0.0113 -0.0106 0.0102 -0.0433 0.0762 0.0202 0.0773 0.0473 0.0202 -0.0192 
+       -0.0142 -0.0300 -0.0323 -0.0507 -0.0188 0.0583 -0.0133 -0.0371 0.0182 -0.0453 
+       -0.0194 -0.0267 0.0097 -0.0096 -0.0342 -0.0371 -0.0563 -0.0846 -0.0199 0.0363 
+       -0.0071 -0.0257 -0.0614 0.0174 0.0309 0.0196 0.0026 -0.0357 -0.0750 0.0312 
+       0.0100 -0.0066 -0.0512 -0.0276 0.0047 0.0012 0.0370 -0.0546 -0.0087 -0.0600 
+       -0.0183 0.0472 0.0493 0.0457 0.0039 0.0270 0.0004 -0.0277 -0.0312 -0.0484 
+       0.0001 0.0017 -0.0427 -0.0643 0.0036 -0.0225 0.0359 0.0129 -0.0554 0.0582 
+       -0.0302 -0.0044 0.0017 0.0292 0.0101 -0.0688 -0.0384 -0.0162 -0.0233 -0.0349 
+       0.0210 -0.0104 0.0601 0.0254 -0.0194 0.0306 -0.0416 -0.0276 0.0364 -0.0230 
+       -0.0053 -0.0353 0.0483 -0.0108 0.0658 0.0474 -0.0131 0.0064 -0.0031 -0.0390 
+       0.0014 0.0001 -0.0184 0.0683 0.0033 0.0384 -0.0511 0.0466 0.0530 0.0181 
+       -0.0167 -0.0340 0.0700 0.0186 -0.0079 0.0352 -0.0031 -0.0509 -0.0289 0.0154 
+       0.0160 -0.0132 0.0177 -0.0510 0.0128 -0.0586 0.0266 -0.0333 -0.0234 -0.0743 
+       -0.0225 -0.0137 -0.0289 -0.0207 0.0086 -0.0565 0.0004 0.0709 -0.0034 0.0091 
+       0.0059 -0.0095 0.0022 -0.0444 -0.0348 -0.0764 -0.0315 0.0318 0.0581 0.0199 
+       0.0221 0.0066 0.0354 -0.0416 -0.0403 0.0179 -0.0488 -0.0521 -0.0149 -0.0437 
+       0.0009 -0.0251 0.0432 0.0046 0.0217 -0.0085 -0.0086 -0.0915 0.0042 -0.0522 
+       -0.0006 -0.0173 0.0162 0.0268 0.0446 0.0554 -0.0169 0.0255 -0.0259 0.0674 
+       -0.0172 -0.0275 0.0095 -0.0324 -0.0134 0.0126 -0.0514 -0.0015 -0.0509 -0.0679 
+       -0.0065 -0.0156 -0.0015 0.0135 0.0402 0.0955 0.0646 0.0284 0.0401 0.0262 
+       -0.0070 0.0105 -0.0468 -0.0359 0.0009 -0.0027 -0.0636 -0.0538 -0.0312 0.0363 
+       -0.0139 0.0451 -0.0091 0.0162 0.0621 -0.0049 0.0528 -0.0294 0.0058 -0.0150 
+       -0.0055 -0.0038 -0.0025 0.0102 -0.0319 0.0348 0.0528 0.0342 0.0931 0.0517 
+       0.0367 0.0192 -0.0221 0.0310 -0.0167 -0.0004 -0.0313 -0.0630 -0.0150 0.0642 
+       -0.0241 0.0472 0.0126 0.0087 -0.0460 -0.0422 0.0454 -0.0237 0.0501 0.0036 
+       0.0067 0.0350 -0.0285 -0.0260 0.0119 -0.0485 -0.0381 -0.0267 -0.0176 -0.0635 
+       0.0121 0.0203 -0.0236 -0.0380 0.0062 0.0477 0.0312 0.0154 0.0621 -0.0062 
+       0.0147 0.0012 0.0265 0.0289 -0.0247 0.0663 -0.0415 0.0201 -0.0639 -0.0118 
+       -0.0047 -0.0297 0.0180 -0.0368 -0.0037 0.0025 -0.0674 0.0523 -0.0049 0.0725 
+       -0.0138 -0.0289 0.0291 -0.0721 -0.0066 0.0466 0.0060 -0.0188 -0.0045 0.0039 
+       -0.0206 -0.0312 -0.0213 0.0357 -0.0527 -0.0117 -0.0109 0.0070 -0.0091 -0.0623 
+       0.0159 0.0003 0.0094 0.0491 -0.0445 0.0458 0.0341 -0.0403 0.0125 -0.0376 
+       -0.0030 -0.0120 0.0270 0.0196 0.0078 -0.0220 -0.0063 0.0069 -0.1155 -0.0071 
+       0.0107 0.0058 -0.0374 -0.0567 -0.0067 -0.0207 -0.0528 0.0424 0.0354 0.0544 
+       -0.0006 0.0268 -0.0395 -0.0105 0.0538 0.0315 -0.0254 -0.0371 0.0691 0.0387 
+       0.0053 0.0247 0.0376 -0.0151 0.0788 0.0358 0.0177 -0.0173 0.0249 0.0386 
+       -0.0155 -0.0192 -0.0087 0.0649 0.0644 -0.0048 0.0391 0.0198 0.0207 0.0028 
+       0.0063 0.0576 0.0064 0.0159 -0.0495 0.0466 -0.0360 -0.0245 0.0206 0.0045 
+       -0.0292 -0.0152 -0.0133 0.0078 0.0236 0.0134 0.0321 0.0179 0.0304 0.0976 
+       -0.0472 0.0330 -0.0177 0.0082 -0.0393 -0.0626 -0.0307 -0.0160 -0.0154 0.0242 
+       -0.0118 -0.0289 -0.0339 -0.0022 -0.0119 -0.0292 -0.0070 -0.0407 -0.0211 0.0994 
+       -0.0136 0.0393 0.0168 0.0094 -0.0201 -0.0588 0.0451 0.0313 -0.0470 -0.0180 
+       -0.0376 0.0210 0.0346 0.0220 0.0013 -0.0235 -0.0347 0.0564 0.0687 0.0463 
+       -0.0151 -0.0277 -0.0742 0.0173 -0.0081 0.0054 0.0073 0.0238 0.0391 -0.0050 
+       0.0288 0.0226 -0.0334 0.0183 -0.0294 -0.0766 0.0303 -0.0139 -0.0288 0.0224 
+       0.0072 0.0021 -0.0350 0.0586 0.0248 -0.0061 0.0084 -0.0499 0.0379 -0.0413 
+       0.0027 -0.0379 -0.0185 -0.0193 0.0240 0.0112 0.0531 0.0152 -0.0539 -0.0001 
+       -0.0403 0.1124 0.0495 0.0017 -0.0102 0.0063 0.0255 0.0427 0.0339 0.0179 
+       0.0147 -0.0187 -0.0070 0.0201 0.0501 0.0406 0.0244 0.0229 0.0504 -0.0278 
+       0.0286 0.0061 0.0390 -0.0127 -0.0494 -0.0466 -0.0221 -0.0553 0.0394 0.0140 
+       0.0248 -0.0015 0.0216 -0.0138 -0.0370 -0.0800 0.0739 0.0365 0.0336 0.0198 
+       0.0358 0.0065 0.0026 0.0450 0.0262 -0.0277 0.0607 0.0459 -0.0322 0.0329 
+       0.0472 -0.0014 -0.0229 -0.0256 -0.0205 -0.0311 0.0209 0.0009 0.0654 0.0323 
+       -0.0083 -0.0015 -0.0071 -0.0311 -0.0958 -0.0447 -0.0118 -0.0156 0.0179 0.0016 
+       -0.0054 -0.0149 -0.0062 0.0064 -0.0028 0.0588 -0.0587 -0.0651 -0.0034 0.0403 
+       -0.0015 -0.0163 0.0265 -0.0220 -0.0352 0.0251 0.0590 0.0119 -0.0104 0.0940 
+       -0.0048 -0.0088 0.0069 0.0226 0.0261 0.0015 -0.0014 -0.0309 -0.0625 -0.1062 
+       0.0077 -0.0140 0.0336 -0.0286 0.0313 -0.0402 -0.0572 -0.0535 -0.0277 -0.0120 
+       -0.0529 0.0170 -0.0417 -0.0091 0.0040 -0.0097 0.0085 0.0216 0.0661 0.0418 
+       0.0026 -0.0300 0.0471 0.0453 0.0268 -0.0077 0.0540 0.0083 -0.0211 -0.0500 
+       -0.0222 -0.0034 -0.0612 -0.0342 -0.0290 -0.0053 -0.0037 0.0149 -0.0412 -0.0411 
+       -0.0367 -0.0270 0.0195 -0.0235 0.0508 0.0002 0.0213 -0.0001 -0.0568 0.0487 
+       0.0032 -0.0000 -0.0413 0.0267 -0.0607 0.0555 -0.0391 -0.0442 0.0651 0.0161 
+       -0.0238 0.0092 0.0057 0.0582 -0.0106 0.0010 -0.0128 -0.0633 0.0037 0.0546 
+       0.0106 0.0113 0.0629 0.0377 0.0070 -0.0085 -0.0181 0.0358 -0.0333 -0.0568 
+       -0.0163 -0.0154 0.0006 0.0057 -0.0288 -0.0147 0.0418 -0.0554 -0.0491 -0.0034 
+       0.0261 0.0061 0.0060 -0.0365 0.0020 0.0751 0.0240 0.0186 -0.0222 -0.0682 
+       0.0038 0.0548 -0.0005 -0.0198 -0.0420 0.0222 0.0435 -0.0153 -0.0288 -0.0441 
+       -0.0114 0.0403 -0.0115 -0.0618 -0.0497 -0.0004 -0.0247 -0.0300 -0.0054 0.0201 
+       -0.0021 -0.0148 -0.0452 0.0361 0.0075 -0.0055 -0.0213 0.0548 -0.0598 0.0699 
+       0.0202 0.0480 0.0067 -0.0108 -0.0308 -0.0518 -0.0435 0.0528 0.0067 -0.0035 
+       -0.0289 -0.0196 0.0430 -0.0288 0.0063 -0.0093 0.0660 0.0666 -0.0003 0.0001 
+       -0.0464 -0.0121 0.0027 -0.0316 0.0434 0.0140 0.0117 -0.0558 0.0441 0.0242 
+       -0.0072 -0.0009 -0.0181 -0.0302 -0.0572 -0.0376 -0.0297 -0.0474 -0.0468 -0.0785 
+       -0.0017 -0.0191 0.0442 0.0479 0.0001 -0.0254 -0.0184 -0.0616 0.0675 0.0144 
+       0.0293 0.0027 -0.0168 -0.0050 0.0017 -0.0517 0.0031 0.0243 -0.0694 -0.0506 
+       0.0011 -0.0199 0.0034 -0.0641 0.0259 0.0020 0.0352 0.0282 0.0726 0.0554 
+       0.0098 -0.0183 -0.0606 -0.0063 -0.0203 -0.0588 -0.0239 -0.0324 -0.0089 -0.0059 
+       0.0253 0.0271 0.0258 0.0208 -0.0024 -0.0103 -0.0023 0.0049 0.0740 0.0714
index 004e73da5918ec69cdd3e9f678092aaee68913ee..5fc2abd4fdbacad003461c145d1586063838ee81 100644 (file)
@@ -113,7 +113,7 @@ struct CODEC2 * CODEC2_WIN32SUPPORT codec2_create(int mode)
     c2->bg_est = 0.0;
     c2->ex_phase = 0.0;
 
-    for(l=1; l<MAX_AMP; l++)
+    for(l=1; l<=MAX_AMP; l++)
        c2->prev_model_dec.A[l] = 0.0;
     c2->prev_model_dec.Wo = TWO_PI/P_MAX;
     c2->prev_model_dec.L = PI/c2->prev_model_dec.Wo;
index ed6b435d32ef912c108502f43806cda7f906a271..4870770c9873e69fed4fe85a5fd8d48d90a13ac5 100644 (file)
@@ -68,8 +68,8 @@
 typedef struct {
   float Wo;            /* fundamental frequency estimate in radians  */
   int   L;             /* number of harmonics                        */
-  float A[MAX_AMP];    /* amplitiude of each harmonic                */
-  float phi[MAX_AMP];  /* phase of each harmonic                     */
+  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;
 
index 27229886a05388f7d2a2595b951afb4f93ddc657..d41303b73c3c52f5e395f53e4808f31d11a9fe4f 100644 (file)
@@ -200,9 +200,9 @@ void phase_synth_zero_order(
 {
   int   m;
   float new_phi;
-  COMP  Ex[MAX_AMP];           /* excitation samples */
-  COMP  A_[MAX_AMP];           /* synthesised harmonic samples */
-  COMP  H[MAX_AMP];             /* LPC freq domain samples */
+  COMP  Ex[MAX_AMP+1];         /* excitation samples */
+  COMP  A_[MAX_AMP+1];         /* synthesised harmonic samples */
+  COMP  H[MAX_AMP+1];           /* LPC freq domain samples */
   float G;
   float jitter = 0.0;
   float r;
@@ -271,1539 +271,3 @@ void phase_synth_zero_order(
 
 }
 
-/* Bruce Perens' funcs to load codebook files */
-
-struct codebook {
-    unsigned int        k;
-    unsigned int        log2m;
-    unsigned int        m;
-    COMP                *cb;
-    unsigned int         offset; 
-};
-
-static const char format[] =
-"The table format must be:\n"
-"\tTwo integers describing the dimensions of the codebook.\n"
-"\tThen, enough numbers to fill the specified dimensions.\n";
-
-float get_float(FILE * in, const char * name, char * * cursor, char * buffer, int size)
-{
-  for ( ; ; ) {
-    char *     s = *cursor;
-    char       c;
-
-    while ( (c = *s) != '\0' && !isdigit(c) && c != '-' && c != '.' )
-      s++;
-     
-    /* Comments start with "#" and continue to the end of the line. */
-    if ( c != '\0' && c != '#' ) {
-      char *   end = 0;
-      float    f = 0;
-
-      f = strtod(s, &end);
-
-      if ( end != s )
-        *cursor = end;
-        return f;
-    }
-
-    if ( fgets(buffer, size, in) == NULL ) {
-      fprintf(stderr, "%s: Format error. %s\n", name, format);
-      exit(1);
-    }
-    *cursor = buffer;
-  }
-}
-
-static struct codebook *load(const char * name)
-{
-    FILE               *file;
-    char               line[2048];
-    char               *cursor = line;
-    struct codebook    *b = malloc(sizeof(struct codebook));
-    int                        i;
-    int                        size;
-    float               angle;
-
-    file = fopen(name, "rt");
-    assert(file != NULL);
-
-    *cursor = '\0';
-
-    b->k = (int)get_float(file, name, &cursor, line, sizeof(line));
-    b->m = (int)get_float(file, name ,&cursor, line, sizeof(line));
-    size = b->k * b->m;
-
-    b->cb = (COMP *)malloc(size * sizeof(COMP));
-
-    for ( i = 0; i < size; i++ ) {
-       angle = get_float(file, name, &cursor, line, sizeof(line));
-       b->cb[i].real = cos(angle);
-       b->cb[i].imag = sin(angle);
-    }
-
-    fclose(file);
-
-    return b;
-}
-
-
-/* states for phase experiments */
-
-struct PEXP {
-    float            phi1;
-    float            phi_prev[MAX_AMP];
-    float            Wo_prev;
-    int              frames;
-    float            snr;
-    float            var;
-    int              var_n;
-    struct codebook *vq1,*vq2,*vq3,*vq4,*vq5; 
-    float            vq_var;
-    int              vq_var_n;
-    MODEL            prev_model;
-    int              state;
-};
-
-
-/*---------------------------------------------------------------------------* \
-
-  phase_experiment_create()
-
-  Inits states for phase quantisation experiments.
-
-\*---------------------------------------------------------------------------*/
-
-struct PEXP * phase_experiment_create() {
-    struct PEXP *pexp;
-    int i;
-
-    pexp = (struct PEXP *)malloc(sizeof(struct PEXP));
-    assert (pexp != NULL);
-
-    pexp->phi1 = 0;
-    for(i=0; i<MAX_AMP; i++)
-       pexp->phi_prev[i] = 0.0;
-    pexp->Wo_prev = 0.0;
-    pexp->frames = 0;
-    pexp->snr = 0.0;
-    pexp->var = 0.0;
-    pexp->var_n = 0;
-    
-    /* smoothed 10th order for 1st 1 khz */
-    //pexp->vq1 = load("../unittest/ph1_10_1024.txt");
-    //pexp->vq1->offset = 0;
-
-    /* load experimental phase VQ */
-
-    //pexp->vq1 = load("../unittest/testn1_20_1024.txt");
-    pexp->vq1 = load("../unittest/test.txt");
-    //pexp->vq2 = load("../unittest/testn21_40_1024.txt");
-    pexp->vq2 = load("../unittest/test11_20_1024.txt");
-    pexp->vq3 = load("../unittest/test21_30_1024.txt");
-    pexp->vq4 = load("../unittest/test31_40_1024.txt");
-    pexp->vq5 = load("../unittest/test41_60_1024.txt");
-    pexp->vq1->offset = 0;
-    pexp->vq2->offset = 10;
-    pexp->vq3->offset = 20;
-    pexp->vq4->offset = 30;
-    pexp->vq5->offset = 40;
-
-    pexp->vq_var = 0.0;
-    pexp->vq_var_n = 0;
-
-    pexp->state = 0;
-
-    return pexp;
-}
-
-
-/*---------------------------------------------------------------------------* \
-
-  phase_experiment_destroy()
-
-\*---------------------------------------------------------------------------*/
-
-void phase_experiment_destroy(struct PEXP *pexp) {
-    assert(pexp != NULL);
-    if (pexp->snr != 0.0)
-       printf("snr: %4.2f dB\n", pexp->snr/pexp->frames);
-    if (pexp->var != 0.0)
-       printf("var...: %4.3f  std dev...: %4.3f (%d non zero phases)\n", 
-              pexp->var/pexp->var_n, sqrt(pexp->var/pexp->var_n), pexp->var_n);
-    if (pexp->vq_var != 0.0)
-       printf("vq var: %4.3f  vq std dev: %4.3f (%d non zero phases)\n", 
-              pexp->vq_var/pexp->vq_var_n, sqrt(pexp->vq_var/pexp->vq_var_n), pexp->vq_var_n);
-    free(pexp);
-}
-
-
-/*---------------------------------------------------------------------------* \
-
-  Various test and experimental functions ................
-
-\*---------------------------------------------------------------------------*/
-
-/* Bubblesort to find highest amplitude harmonics */
-
-struct AMPINDEX {
-    float amp;
-    int   index;
-};
-
-static void bubbleSort(struct AMPINDEX numbers[], int array_size)
-{
-    int i, j;
-    struct AMPINDEX temp;
-  for (i = (array_size - 1); i > 0; i--)
-  {
-    for (j = 1; j <= i; j++)
-    {
-       //printf("i %d j %d %f %f \n", i, j, numbers[j-1].amp, numbers[j].amp);
-      if (numbers[j-1].amp < numbers[j].amp)
-      {
-        temp = numbers[j-1];
-        numbers[j-1] = numbers[j];
-        numbers[j] = temp;
-      }
-    }
-  }
-}
-
-
-static void print_pred_error(struct PEXP *pexp, MODEL *model, int start, int end, float mag_thresh) {
-    int   i;
-    float mag;
-
-    mag = 0.0;
-    for(i=start; i<=end; i++)
-       mag += model->A[i]*model->A[i];
-    mag = 10*log10(mag/(end-start));
-    
-    if (mag > mag_thresh) {
-       for(i=start; i<=end; i++) {
-           float pred = pexp->phi_prev[i] + N*i*(model->Wo + pexp->Wo_prev)/2.0;
-           float err = pred - model->phi[i];
-           err = atan2(sin(err),cos(err));
-           printf("%f\n",err);    
-       }
-       //printf("\n");
-    }
-  
-}
-
-
-static void predict_phases(struct PEXP *pexp, MODEL *model, int start, int end) {
-    int i;
-
-    for(i=start; i<=end; i++) {
-       model->phi[i] = pexp->phi_prev[i] + N*i*model->Wo;
-    }
-   
-}
-static float refine_Wo(struct PEXP     *pexp, 
-                      MODEL           *model, 
-                      int              start, 
-                      int              end);
-
-/* Fancy state based phase prediction.  Actually works OK on most utterances,
-   but could use some tuning.  Breaks down a bit on mmt1. */
-
-static void predict_phases_state(struct PEXP *pexp, MODEL *model, int start, int end) {
-    int i, next_state;
-    float best_Wo, dWo;
-
-    //best_Wo = refine_Wo(pexp, model, start, end);
-    //best_Wo = (model->Wo + pexp->Wo_prev)/2.0;
-    best_Wo = model->Wo;
-
-    dWo = fabs(model->Wo - pexp->Wo_prev)/model->Wo;
-    next_state = pexp->state;
-    switch(pexp->state) {
-    case 0:
-       if (dWo < 0.1) {
-           /* UV -> V transition, so start with phases in lock.  They will
-              drift a bit over voiced track which is kinda what we want, so
-              we don't get clicky speech.
-           */
-           next_state = 1;
-           for(i=start; i<=end; i++)
-               pexp->phi_prev[i] = i*pexp->phi1;
-       }
-       
-       break;
-    case 1:
-       if (dWo > 0.1)
-           next_state = 0;
-       break;
-    }
-    pexp->state = next_state;
-
-    if (pexp->state == 0)
-       for(i=start; i<=end; i++) {
-           model->phi[i] = PI*(1.0 - 2.0*rand()/RAND_MAX);
-       }
-    else
-       for(i=start; i<=end; i++) {
-           model->phi[i] = pexp->phi_prev[i] + N*i*best_Wo;
-       }
-    printf("state %d\n", pexp->state);
-}
-
-static void struct_phases(struct PEXP *pexp, MODEL *model, int start, int end) {
-    int i;
-
-    for(i=start; i<=end; i++)
-       model->phi[i] = pexp->phi1*i;
-   
-}
-
-
-static void predict_phases2(struct PEXP *pexp, MODEL *model, int start, int end) {
-    int i;
-    float pred, str, diff;
-
-    for(i=start; i<=end; i++) {
-       pred = pexp->phi_prev[i] + N*i*model->Wo;
-       str = pexp->phi1*i;
-       diff = str - pred;
-       diff = atan2(sin(diff), cos(diff));
-       if (diff > 0)
-           pred += PI/16;
-       else
-           pred -= PI/16;
-       model->phi[i] = pred;
-    }
-   
-}
-
-static void skip_phases(struct PEXP *pexp, MODEL *model, int start, int end) {
-    int i;
-
-    for(i=start; i<=end; i+=2)
-       model->phi[i] = model->phi[i-1] - model->phi[i-2];
-   
-}
-
-static void rand_phases(MODEL *model, int start, int end) {
-    int i;
-
-    for(i=start; i<=end; i++)
-       model->phi[i] = PI*(1.0 - 2.0*(float)rand()/RAND_MAX);
-   
-}
-
-static void quant_phase(float *phase, float min, float max, int bits) {
-    int   levels = 1 << bits; 
-    int   index;
-    float norm, step;
-
-    norm = (*phase - min)/(max - min);
-    index = floor(levels*norm);
-
-    //printf("phase %f norm %f index %d ", *phase, norm, index);
-    if (index < 0 ) index = 0;
-    if (index > (levels-1)) index = levels-1;
-    //printf("index %d ", index);
-    step = (max - min)/levels;
-    *phase = min + step*index + 0.5*step;
-    //printf("step %f phase %f\n", step, *phase);
-}
-
-static void quant_phases(MODEL *model, int start, int end, int bits) {
-    int i;
-
-    for(i=start; i<=end; i++) {
-       quant_phase(&model->phi[i], -PI, PI, bits);
-    }
-}
-
-static void fixed_bits_per_frame(struct PEXP *pexp, MODEL *model, int m, int budget) {
-    int res, finished;
-
-    res = 3;
-    finished = 0;
-
-    while(!finished) {
-       if (m > model->L/2)
-           res = 2;
-       if (((budget - res) < 0) || (m > model->L))
-           finished = 1;
-       else {
-           quant_phase(&model->phi[m], -PI, PI, res);      
-           budget -= res;
-           m++;
-       }
-    }
-    printf("m: %d L: %d budget: %d\n", m, model->L, budget);
-    predict_phases(pexp, model, m, model->L);
-    //rand_phases(model, m, model->L);
-}
-
-/* used to plot histogram of quantisation error, for 3 bits, 8 levels,
-   should be uniform between +/- PI/8 */
-
-static void check_phase_quant(MODEL *model, float tol)
-{
-    int m;
-    float phi_before[MAX_AMP];
-
-    for(m=1; m<=model->L; m++)
-       phi_before[m] = model->phi[m];
-
-    quant_phases(model, 1, model->L, 3);
-
-    for(m=1; m<=model->L; m++) {
-       float err = phi_before[m] - model->phi[m];
-       printf("%f\n", err);
-       if (fabs(err) > tol)
-           exit(0);
-    }
-}
-
-
-static float est_phi1(MODEL *model, int start, int end)
-{
-    int m;
-    float delta, s, c, phi1_est;
-
-    if (end > model->L) 
-       end = model->L;
-
-    s = c = 0.0;
-    for(m=start; m<end; m++) {
-       delta = model->phi[m+1] - model->phi[m];
-       s += sin(delta);
-       c += cos(delta);
-    }
-
-    phi1_est = atan2(s,c);
-    
-    return phi1_est;
-}
-
-static void print_phi1_pred_error(MODEL *model, int start, int end)
-{
-    int m;
-    float phi1_est;
-
-    phi1_est = est_phi1(model, start, end);
-
-    for(m=start; m<end; m++) {
-       float err = model->phi[m+1] - model->phi[m] - phi1_est;
-       err = atan2(sin(err),cos(err));
-       printf("%f\n", err);
-    }
-}
-
-
-static void first_order_band(MODEL *model, int start, int end, float phi1_est)
-{
-    int   m;
-    float pred_err, av_pred_err;
-    float c,s;
-
-    s = c = 0.0;
-    for(m=start; m<end; m++) {
-       pred_err = model->phi[m] - phi1_est*m;
-       s += sin(pred_err);
-       c += cos(pred_err);
-    }
-
-    av_pred_err = atan2(s,c);
-    for(m=start; m<end; m++) {
-       model->phi[m] = av_pred_err + phi1_est*m;
-       model->phi[m] = atan2(sin(model->phi[m]), cos(model->phi[m]));
-    }
-
-}
-
-
-static void sub_linear(MODEL *model, int start, int end, float phi1_est)
-{
-    int   m;
-
-    for(m=start; m<end; m++) {
-       model->phi[m] = m*phi1_est;
-    }
-}
-
-
-static void top_amp(struct PEXP *pexp, MODEL *model, int start, int end, int n_harm, int pred)
-{
-    int removed = 0, not_removed = 0;
-    int top, i, j;
-    struct AMPINDEX sorted[MAX_AMP];
-
-    /* sort into ascending order of amplitude */
-
-    printf("\n");
-    for(i=start,j=0; i<end; i++,j++) {
-       sorted[j].amp = model->A[i];
-       sorted[j].index = i;
-       printf("%f ", model->A[i]);
-    }
-    bubbleSort(sorted, end-start);
-
-    printf("\n");
-    for(j=0; j<n_harm; j++)
-       printf("%d %f\n", j, sorted[j].amp);
-
-    /* keep phase of top n_harm, predict others */
-
-    for(i=start; i<end; i++) {         
-       top = 0;
-       for(j=0; j<n_harm; j++) {
-           if (model->A[i] == sorted[j].amp) {
-               top = 1;
-               assert(i == sorted[j].index);
-           }
-       }
-       
-       #define ALTTOP
-       #ifdef ALTTOP
-       model->phi[i] = 0.0; /* make sure */
-       if (top) {
-           model->phi[i] = i*pexp->phi1;
-           removed++;
-       }
-       else {
-           model->phi[i] = PI*(1.0 - 2.0*(float)rand()/RAND_MAX); // note: try rand for higher harms
-           removed++;
-       }
-       #else
-       if (!top) {
-           model->phi[i] = 0.0; /* make sure */
-           if (pred)  {
-               //model->phi[i] = pexp->phi_prev[i] + i*N*(model->Wo + pexp->Wo_prev)/2.0;
-               model->phi[i] = i*model->phi[1];
-           }
-           else
-               model->phi[i] = PI*(1.0 - 2.0*(float)rand()/RAND_MAX); // note: try rand for higher harms
-           removed++;
-       }
-       else {
-           /* need to make this work thru budget of bits */
-           quant_phase(&model->phi[i], -PI, PI, 3);        
-           not_removed++;
-       }
-       #endif
-    }
-    printf("dim: %d rem %d not_rem %d\n", end-start, removed, not_removed);
-           
-}
-
-    
-static void limit_prediction_error(struct PEXP *pexp, MODEL *model, int start, int end, float limit) 
-{
-    int   i;
-    float pred, pred_error, error;
-
-    for(i=start; i<=end; i++) {
-       pred = pexp->phi_prev[i] + N*i*(model->Wo + pexp->Wo_prev)/2.0;
-       pred_error = pred - model->phi[i]; 
-       pred_error -= TWO_PI*floor((pred_error+PI)/TWO_PI);
-       quant_phase(&pred_error, -limit, limit, 2);     
-       
-       error = pred - pred_error - model->phi[i];
-       error -= TWO_PI*floor((error+PI)/TWO_PI);
-       printf("%f\n", pred_error);
-       model->phi[i] = pred - pred_error;
-    }
-}
-
-
-static void quant_prediction_error(struct PEXP *pexp, MODEL *model, int start, int end, float limit) 
-{
-    int   i;
-    float pred, pred_error;
-
-    for(i=start; i<=end; i++) {
-       pred = pexp->phi_prev[i] + N*i*(model->Wo + pexp->Wo_prev)/2.0;
-       pred_error = pred - model->phi[i]; 
-       pred_error -= TWO_PI*floor((pred_error+PI)/TWO_PI);
-       
-       printf("%f\n", pred_error);
-       model->phi[i] = pred - pred_error;
-    }
-}
-
-
-static void print_sparse_pred_error(struct PEXP *pexp, MODEL *model, int start, int end, float mag_thresh)
-{
-    int    i, index;
-    float  mag, pred, error;
-    float  sparse_pe[MAX_AMP];
-
-    mag = 0.0;
-    for(i=start; i<=end; i++)
-       mag += model->A[i]*model->A[i];
-    mag = 10*log10(mag/(end-start));
-    
-    if (mag > mag_thresh) {
-       for(i=0; i<MAX_AMP; i++) {
-           sparse_pe[i] = 0.0;
-       }
-
-       for(i=start; i<=end; i++) {
-           pred = pexp->phi_prev[i] + N*i*(model->Wo + pexp->Wo_prev)/2.0;
-           error = pred - model->phi[i];
-           error = atan2(sin(error),cos(error));
-
-           index = MAX_AMP*i*model->Wo/PI;
-           assert(index < MAX_AMP);
-           sparse_pe[index] = error;
-       }
-
-       /* dump spare phase vector in polar format */
-
-       for(i=0; i<MAX_AMP; i++)
-           printf("%f ", sparse_pe[i]);
-       printf("\n");
-    }
-}
-
-
-static void update_snr_calc(struct PEXP *pexp, MODEL *model, float before[])
-{
-    int m;
-    float signal, noise, diff;
-
-    signal = 0.0; noise = 0.0;
-    for(m=1; m<=model->L; m++) {           
-       signal += model->A[m]*model->A[m];
-       diff = cos(model->phi[m]) - cos(before[m]);         
-       noise  += pow(model->A[m]*diff, 2.0);
-       diff = sin(model->phi[m]) - sin(before[m]);         
-       noise  += pow(model->A[m]*diff, 2.0);
-       //printf("%f %f\n", before[m], model->phi[m]);
-    }
-    //printf("%f %f snr = %f\n", signal, noise, 10.0*log10(signal/noise));
-    pexp->snr += 10.0*log10(signal/noise);
-}
-
-
-static void update_variance_calc(struct PEXP *pexp, MODEL *model, float before[])
-{
-    int m;
-    float diff;
-
-    for(m=1; m<model->L; m++) {            
-        diff = model->phi[m] - before[m];
-        diff = atan2(sin(diff), cos(diff));
-        pexp->var += diff*diff;
-    }
-    pexp->var_n += model->L;
-}
-
-void print_vec(COMP cb[], int d, int e)
-{
-    int i,j;
-
-    for(j=0; j<e; j++) {
-       for(i=0; i<d; i++) 
-           printf("%f %f ", cb[j*d+i].real, cb[j*d+i].imag);
-       printf("\n");
-    }
-}
-
-static COMP cconj(COMP a)
-{
-    COMP res;
-
-    res.real = a.real;
-    res.imag = -a.imag;
-
-    return res;
-}
-
-static COMP cadd(COMP a, COMP b)
-{
-    COMP res;
-
-    res.real = a.real + b.real;
-    res.imag = a.imag + b.imag;
-
-    return res;
-}
-
-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;
-
-    return res;
-}
-
-static int vq_phase(COMP cb[], COMP vec[], float weights[], int d, int e, float *se)
-{
-   float   error;      /* current error                */
-   int     besti;      /* best index so far            */
-   float   best_error; /* best error so far            */
-   int    i,j;
-   int     ignore;
-   COMP    diffr;
-   float   diffp, metric, best_metric;
-
-   besti = 0;
-   best_metric = best_error = 1E32;
-   for(j=0; j<e; j++) {
-       error = 0.0;
-       metric = 0.0;
-       for(i=0; i<d; i++) {
-           ignore = (vec[i].real == 0.0) && (vec[i].imag == 0.0);
-           if (!ignore) {
-               diffr = cmult(cb[j*d+i], cconj(vec[i]));
-               diffp = atan2(diffr.imag, diffr.real);
-               error  += diffp*diffp;
-               metric += weights[i]*weights[i]*diffp*diffp;
-               //metric += weights[i]*diffp*diffp;
-               //metric = log10(weights[i]*fabs(diffp));
-               //printf("diffp %f metric %f\n", diffp, metric);
-               //if (metric < log10(PI/(8.0*sqrt(3.0))))
-               //   metric = log10(PI/(8.0*sqrt(3.0)));
-           }
-       }
-       if (metric < best_metric) {
-           best_metric = metric;
-           best_error = error;
-           besti = j;
-       }
-   }
-
-   *se += best_error;
-
-   return(besti);
-}
-
-
-static float refine_Wo(struct PEXP     *pexp, 
-                      MODEL           *model, 
-                      int              start, 
-                      int              end)
-
-{
-    int i;
-    float Wo_est, best_var, Wo, var, pred, error, best_Wo;
-
-    /* test variance over a range of Wo values */
-
-    Wo_est = (model->Wo + pexp->Wo_prev)/2.0;
-    best_var = 1E32;
-    for(Wo=0.97*Wo_est; Wo<=1.03*Wo_est; Wo+=0.001*Wo_est) {
-
-       /* predict phase and sum differences between harmonics */
-
-       var = 0.0;
-       for(i=start; i<=end; i++) {
-           pred = pexp->phi_prev[i] + N*i*Wo;
-           error = pred - model->phi[i];
-           error = atan2(sin(error),cos(error));
-           var += error*error;
-       }
-
-       if (var < best_var) {
-           best_var = var;
-           best_Wo = Wo;
-       }
-    }
-
-    return best_Wo;
-}
-
-
-static void split_vq(COMP sparse_pe_out[], struct PEXP *pexp, struct codebook *vq, float weights[], COMP sparse_pe_in[])
-{
-    int i, j, non_zero, vq_ind;
-    
-    //printf("\n offset %d k %d m %d  j: ", vq->offset, vq->k, vq->m);
-    vq_ind = vq_phase(vq->cb, &sparse_pe_in[vq->offset], &weights[vq->offset], vq->k, vq->m, &pexp->vq_var);
-  
-    non_zero = 0;
-    for(i=0, j=vq->offset; i<vq->k; i++,j++) {
-       //printf("%f ", atan2(sparse_pe[i].imag, sparse_pe[i].real));
-       if ((sparse_pe_in[j].real != 0.0) && (sparse_pe_in[j].imag != 0.0)) {
-           //printf("%d ", j);
-           sparse_pe_out[j] = vq->cb[vq->k * vq_ind + i];
-           non_zero++;
-       }
-    }
-    pexp->vq_var_n += non_zero;
-}
-
-
-static void sparse_vq_pred_error(struct PEXP     *pexp, 
-                                MODEL           *model 
-)
-{
-    int              i, index;
-    float            pred, error, error_q_angle, best_Wo;
-    COMP             sparse_pe_in[MAX_AMP], sparse_pe_out[MAX_AMP];
-    float            weights[MAX_AMP];
-    COMP             error_q_rect;
-
-     best_Wo = refine_Wo(pexp, model, 1, model->L);
-    //best_Wo = (model->Wo + pexp->Wo_prev)/2.0;
-
-     /* transform to sparse pred error vector */
-
-    for(i=0; i<MAX_AMP; i++) {
-       sparse_pe_in[i].real = 0.0;
-       sparse_pe_in[i].imag = 0.0;
-       sparse_pe_out[i].real = 0.0;
-       sparse_pe_out[i].imag = 0.0;
-    }
-
-    //printf("\n");
-    for(i=1; i<=model->L; i++) {
-       pred = pexp->phi_prev[i] + N*i*best_Wo;
-       error = pred - model->phi[i];
-
-       index = MAX_AMP*i*model->Wo/PI;
-       assert(index < MAX_AMP);
-       sparse_pe_in[index].real = cos(error);
-       sparse_pe_in[index].imag = sin(error);
-       sparse_pe_out[index] = sparse_pe_in[index];
-       weights[index] = model->A[i];
-       //printf("%d ", index);
-    }
-    
-    /* vector quantise */
-        
-    split_vq(sparse_pe_out, pexp, pexp->vq1, weights, sparse_pe_in);
-    split_vq(sparse_pe_out, pexp, pexp->vq2, weights, sparse_pe_in);
-    split_vq(sparse_pe_out, pexp, pexp->vq3, weights, sparse_pe_in);
-    split_vq(sparse_pe_out, pexp, pexp->vq4, weights, sparse_pe_in);
-    split_vq(sparse_pe_out, pexp, pexp->vq5, weights, sparse_pe_in);
-    
-    /* transform quantised phases back */
-
-    for(i=1; i<=model->L; i++) {
-       pred = pexp->phi_prev[i] + N*i*best_Wo;
-
-       index = MAX_AMP*i*model->Wo/PI;
-       assert(index < MAX_AMP);
-       error_q_rect  = sparse_pe_out[index];
-       error_q_angle = atan2(error_q_rect.imag, error_q_rect.real);
-       model->phi[i] = pred - error_q_angle;
-       model->phi[i] = atan2(sin(model->phi[i]), cos(model->phi[i]));
-    }
-}
-
-
-/*
-  est delta (in Wo)
-  see if this gives us a better (smaller variance) prediction error
-*/
-
-static void print_pred_error_sparse_wo_correction(struct PEXP *pexp, 
-                                                 MODEL *model, 
-                                                 int start, int end, 
-                                                 float mag_thresh)
-{
-    int   i, index;
-    float mag, pred, error[MAX_AMP], diff, c, s, delta, err;
-    float sparse_pe[MAX_AMP];
-
-    mag = 0.0;
-    for(i=start; i<=end; i++)
-       mag += model->A[i]*model->A[i];
-    mag = 10*log10(mag/(end-start));
-    
-    if (mag > mag_thresh) {
-       for(i=0; i<MAX_AMP; i++) {
-           sparse_pe[i] = 0.0;
-       }
-
-       /* predict phase and sum differences between harmonics */
-
-       for(i=start; i<=end; i++) {
-           //model->phi[i] = pexp->phi_prev[i] + N*i*(model->Wo + pexp->Wo_prev)/2.0 + 0.01*N*i;
-           pred = pexp->phi_prev[i] + N*i*(model->Wo + pexp->Wo_prev)/2.0;
-           error[i] = pred - model->phi[i];
-       }
-
-       /* estimate delta Wo */
-
-       c = s = 0.0;
-       for(i=start+1; i<=end; i++) {
-           diff = error[i] - error[i-1];
-           c += log(model->A[i])*cos(diff);
-           s += log(model->A[i])*sin(diff);
-       }
-       delta = atan2(s,c)/N;
-       //printf("delta %f\n",delta);
-       delta = 0;
-       /* now predict phases using corrected Wo */
-       for(i=start; i<=end; i++) {
-           pred = pexp->phi_prev[i] + N*i*(model->Wo + pexp->Wo_prev)/2.0 - N*i*delta;
-           err = pred - model->phi[i];
-           err = atan2(sin(err),cos(err));
-
-           index = MAX_AMP*i*model->Wo/PI;
-           assert(index < MAX_AMP);
-           sparse_pe[index] = err;
-       }
-
-       /* dump spare phase vector in polar format */
-       
-       for(i=0; i<MAX_AMP; i++)
-           printf("%f ", sparse_pe[i]);
-       printf("\n");
-       
-    }
-  
-}
-
-
-static void print_pred_error_sparse_wo_correction1(struct PEXP *pexp, 
-                                                 MODEL *model, 
-                                                 int start, int end, 
-                                                 float mag_thresh)
-{
-    int   i, index;
-    float mag, pred, best_Wo, err;
-    float sparse_pe[MAX_AMP];
-
-    mag = 0.0;
-    for(i=start; i<=end; i++)
-       mag += model->A[i]*model->A[i];
-    mag = 10*log10(mag/(end-start));
-    
-    if (mag > mag_thresh) {
-
-       best_Wo = refine_Wo(pexp, model, start, end);
-
-       /* now predict phases using corrected Wo */
-       for(i=0; i<MAX_AMP; i++) {
-           sparse_pe[i] = 0.0;
-       }
-
-       for(i=start; i<=end; i++) {
-           pred = pexp->phi_prev[i] + N*i*best_Wo;
-           err = pred - model->phi[i];
-           err = atan2(sin(err),cos(err));
-
-           index = MAX_AMP*i*model->Wo/PI;
-           assert(index < MAX_AMP);
-           sparse_pe[index] = err;
-       }
-
-       /* dump spare phase vector in polar format */
-       
-       for(i=0; i<MAX_AMP; i++)
-           printf("%f ", sparse_pe[i]);
-       printf("\n");
-       
-    }
-  
-}
-
-
-static void predict_phases1(struct PEXP *pexp, MODEL *model, int start, int end) {
-    int i;
-    float best_Wo;
-
-    best_Wo = refine_Wo(pexp, model, 1, model->L);
-    
-    for(i=start; i<=end; i++) {
-       model->phi[i] = pexp->phi_prev[i] + N*i*best_Wo;
-    }
-}
-
-
-/*
-  This functions tests theory that some bands can be combined together
-  due to less frequency resolution at higher frequencies.  This will
-  reduce the amount of information we need to encode.
-*/
-
-void smooth_phase(struct PEXP *pexp, MODEL *model, int mode)
-{
-    int    m, i, j, index, step, v, en, nav, st;
-    COMP   sparse_pe_in[MAX_AMP], av;
-    COMP   sparse_pe_out[MAX_AMP];
-    COMP   smoothed[MAX_AMP];
-    float  best_Wo, pred, err;
-    float  weights[MAX_AMP];
-    float  avw, smoothed_weights[MAX_AMP];
-    COMP   smoothed_in[MAX_AMP], smoothed_out[MAX_AMP];
-
-    best_Wo = refine_Wo(pexp, model, 1, model->L);
-
-    for(m=0; m<MAX_AMP; m++) {
-       sparse_pe_in[m].real = sparse_pe_in[m].imag = 0.0;
-       sparse_pe_out[m].real = sparse_pe_out[m].imag = 0.0;
-    }
-
-    /* set up sparse array */
-
-    for(m=1; m<=model->L; m++) {
-       pred = pexp->phi_prev[m] + N*m*best_Wo;
-       err = model->phi[m] - pred;
-       err = atan2(sin(err),cos(err));
-
-       index = MAX_AMP*m*model->Wo/PI;
-       assert(index < MAX_AMP);
-       sparse_pe_in[index].real = model->A[m]*cos(err);
-       sparse_pe_in[index].imag = model->A[m]*sin(err);
-       sparse_pe_out[index] = sparse_pe_in[index];
-       weights[index] = model->A[m];
-    }
-
-    /* now combine samples at high frequencies to reduce dimension */
-
-    step = 2;
-    st = 0;
-    for(i=st,v=0; i<MAX_AMP; i+=step,v++) {
-
-       /* average over one band */
-
-       av.real = 0.0; av.imag = 0.0; avw = 0.0; nav = 0;
-       en = i+step;
-       if (en > (MAX_AMP-1))
-           en = MAX_AMP-1;
-       for(j=i; j<en; j++) {
-           if ((sparse_pe_in[j].real != 0.0) &&(sparse_pe_in[j].imag != 0.0) ) {
-               av = cadd(av, sparse_pe_in[j]);
-               avw += weights[j];
-               nav++;
-           }
-       }
-       if (nav) {
-           smoothed[v] = av;
-           smoothed_weights[v] = avw/nav;
-       }
-       else
-           smoothed[v].real = smoothed[v].imag = 0.0;
-    }
-
-    if (mode == 2) {
-       for(i=0; i<MAX_AMP; i++) {
-           smoothed_in[i] = smoothed[i];
-           smoothed_out[i] = smoothed_in[i];
-       }
-       split_vq(smoothed_out, pexp, pexp->vq1, smoothed_weights, smoothed_in);
-       for(i=0; i<MAX_AMP; i++)
-           smoothed[i] = smoothed_out[i];
-    }
-
-    /* set all samples to smoothed average */
-
-    for(i=st,v=0; i<MAX_AMP; i+=step,v++) {
-       en = i+step;
-       if (en > (MAX_AMP-1))
-           en = MAX_AMP-1;
-       for(j=i; j<en; j++)
-           sparse_pe_out[j] = smoothed[v];
-       if (mode == 1)
-           printf("%f ", atan2(smoothed[v].imag, smoothed[v].real));
-    }
-    if (mode == 1)
-       printf("\n");
-
-    /* convert back to Am */
-    
-    for(m=1; m<=model->L; m++) {
-       index = MAX_AMP*m*model->Wo/PI;
-       assert(index < MAX_AMP);
-       pred = pexp->phi_prev[m] + N*m*best_Wo;
-       err = atan2(sparse_pe_out[index].imag, sparse_pe_out[index].real);
-       model->phi[m] = pred + err;
-    }
-    
-}
-
-/*
-  Another version of a functions that tests the theory that some bands
-  can be combined together due to less frequency resolution at higher
-  frequencies.  This will reduce the amount of information we need to
-  encode.
-*/
-
-void smooth_phase2(struct PEXP *pexp, MODEL *model) {
-    float m;
-    float step;
-    int   a,b,h,i;
-    float best_Wo, pred, err, s,c, phi1_;
-
-    best_Wo = refine_Wo(pexp, model, 1, model->L);
-
-    step = (float)model->L/30;
-    printf("\nL: %d step: %3.2f am,bm: ", model->L, step);
-    for(m=(float)model->L/4; m<=model->L; m+=step) {
-       a = floor(m);
-       b = floor(m+step);
-       if (b > model->L) b = model->L;
-       h = b-a;
-
-       printf("%d,%d,(%d)  ", a, b, h);
-       c = s = 0.0;
-       if (h>1) {
-           for(i=a; i<b; i++) {
-               pred = pexp->phi_prev[i] + N*i*best_Wo;
-               err = model->phi[i] - pred;
-               c += cos(err); s += sin(err);
-           }
-           phi1_ = atan2(s,c);
-           for(i=a; i<b; i++) {
-               pred = pexp->phi_prev[i] + N*i*best_Wo;
-               printf("%d: %4.3f -> ", i, model->phi[i]); 
-               model->phi[i] = pred + phi1_;
-               model->phi[i] = atan2(sin(model->phi[i]),cos(model->phi[i]));
-               printf("%4.3f  ", model->phi[i]); 
-           }
-       }
-    }
-}
-
-
-#define MAX_BINS 40
-//static float bins[] = {2600.0, 2800.0, 3000.0, 3200.0, 3400.0, 3600.0, 3800.0, 4000.0};
-static float bins[] = {/*
-
-                       1000.0, 1100.0, 1200.0, 1300.0, 1400.0, 
-                      1500.0, 1600.0, 1700.0, 1800.0, 1900.0,*/
-
-    2000.0, 2400.0, 2800.0,
-    3000.0, 3400.0, 3600.0, 4000.0};
-
-void smooth_phase3(struct PEXP *pexp, MODEL *model) {
-    int    m, i;
-    int   nbins;
-    int   b;
-    float f, best_Wo, pred, err;
-    COMP  av[MAX_BINS];
-
-    nbins = sizeof(bins)/sizeof(float);
-    best_Wo = refine_Wo(pexp, model, 1, model->L);
-
-    /* clear all bins */
-
-    for(i=0; i<MAX_BINS; i++) {
-       av[i].real = 0.0;
-       av[i].imag = 0.0;
-    }
-
-    /* add phases into each bin */
-
-    for(m=1; m<=model->L; m++) {
-       f = m*model->Wo*FS/TWO_PI;
-       if (f > bins[0]) {
-
-           /* find bin  */
-
-           for(i=0; i<nbins; i++)
-               if ((f > bins[i]) && (f <= bins[i+1]))
-                   b = i;
-           assert(b < MAX_BINS);
-
-           /* est predicted phase from average */
-
-           pred = pexp->phi_prev[m] + N*m*best_Wo; 
-           err = model->phi[m] - pred;
-           av[b].real += cos(err); av[b].imag += sin(err);
-       }
-           
-    }
-
-    /* use averages to est phases */
-
-    for(m=1; m<=model->L; m++) {
-       f = m*model->Wo*FS/TWO_PI;
-       if (f > bins[0]) {
-
-           /* find bin */
-
-           for(i=0; i<nbins; i++)
-               if ((f > bins[i]) && (f <= bins[i+1]))
-                   b = i;
-           assert(b < MAX_BINS);
-
-           /* add predicted phase error to this bin */
-
-           printf("L %d m %d f %4.f b %d\n", model->L, m, f, b);
-
-           pred = pexp->phi_prev[m] + N*m*best_Wo;
-           err = atan2(av[b].imag, av[b].real);
-           printf(" %d: %4.3f -> ", m, model->phi[m]); 
-           model->phi[m] = pred + err;
-           model->phi[m] = atan2(sin(model->phi[m]),cos(model->phi[m]));
-           printf("%4.3f\n", model->phi[m]); 
-       }
-    }
-    printf("\n");
-}
-
-
-/* 
-   Try to code the phase of the largest amplitude in each band.  Randomise the
-   phase of the other harmonics. The theory is that only the largest harmonic
-   will be audible.
-*/
-
-void cb_phase1(struct PEXP *pexp, MODEL *model) {
-    int   m, i;
-    int   nbins;
-    int   b;
-    float f, best_Wo;
-    float max_val[MAX_BINS];
-    int   max_ind[MAX_BINS];
-
-    nbins = sizeof(bins)/sizeof(float);
-    best_Wo = refine_Wo(pexp, model, 1, model->L);
-
-    for(i=0; i<nbins; i++)
-       max_val[i] = 0.0;
-
-    /* determine max amplitude for each bin */
-
-    for(m=1; m<=model->L; m++) {
-       f = m*model->Wo*FS/TWO_PI;
-       if (f > bins[0]) {
-
-           /* find bin  */
-
-           for(i=0; i<nbins; i++)
-               if ((f > bins[i]) && (f <= bins[i+1]))
-                   b = i;
-           assert(b < MAX_BINS);
-
-           if (model->A[m] > max_val[b]) {
-               max_val[b] = model->A[m];
-               max_ind[b] = m;
-           }
-       }
-           
-    }
-
-    /* randomise phase of other harmonics */
-
-    for(m=1; m<=model->L; m++) {
-       f = m*model->Wo*FS/TWO_PI;
-       if (f > bins[0]) {
-
-           /* find bin */
-
-           for(i=0; i<nbins; i++)
-               if ((f > bins[i]) && (f <= bins[i+1]))
-                   b = i;
-           assert(b < MAX_BINS);
-
-           if (m != max_ind[b])
-               model->phi[m] = pexp->phi_prev[m] + N*m*best_Wo;
-       }
-    }
-}
-
-
-/* 
-   Theory is only the phase of the envelope of signal matters within a
-   Critical Band. So we estimate the position of an impulse that
-   approximates the envelope of the signal.
-*/
-
-void cb_phase2(struct PEXP *pexp, MODEL *model) {
-    int   st, m, i, a, b, step;
-    float diff,w,c,s,phi1_;
-    float A[MAX_AMP];
-
-    for(m=1; m<=model->L; m++) {
-       A[m] = model->A[m];
-       model->A[m] = 0;
-    }
-
-    st = 2*model->L/4;
-    step = 3;
-    model->phi[1] = pexp->phi_prev[1] + (pexp->Wo_prev+model->Wo)*N/2.0;
-
-    printf("L=%d ", model->L);
-    for(m=st; m<st+step*2; m+=step) {
-       a = m; b=a+step;
-       if (b > model->L)
-           b = model->L;
-       
-       c = s = 0;
-       for(i=a; i<b-1; i++) {
-           printf("diff %d,%d ", i, i+1);
-           diff = model->phi[i+1] - model->phi[i];
-           //w = (model->A[i+1] + model->A[i])/2; 
-           w = 1.0;
-           c += w*cos(diff); s += w*sin(diff);
-       }
-       phi1_ = atan2(s,c);
-       printf("replacing: ");
-       for(i=a; i<b; i++) {
-           //model->phi[i] = i*phi1_;
-           //model->phi[i] = i*model->phi[1];
-           //model->phi[i] = m*(pexp->Wo_prev+model->Wo)*N/2.0;
-           model->A[m] = A[m];
-           printf("%d ", i);
-       }
-       printf(" . ");
-    }
-    printf("\n");
-}
-
-
-static void smooth_phase4(MODEL *model) {
-    int    m;
-    float  phi_m, phi_m_1;
-
-    if (model->L > 25) {
-       printf("\nL %d\n", model->L);
-       for(m=model->L/2; m<=model->L; m+=2) {
-           if ((m+1) <= model->L) {
-               phi_m   = (model->phi[m] - model->phi[m+1])/2.0;
-               phi_m_1 = (model->phi[m+1] - model->phi[m])/2.0;
-               model->phi[m] = phi_m;
-               model->phi[m+1] = phi_m_1;
-               printf("%d %4.3f %4.3f  ", m, phi_m, phi_m_1);
-           }
-       }
-    }
-
-}
-
-/* try repeating last frame, just advance phases to account for time shift */
-
-static void repeat_phases(struct PEXP *pexp, MODEL *model) {
-    int m;
-
-    *model = pexp->prev_model;
-    for(m=1; m<=model->L; m++)
-       model->phi[m] += N*m*model->Wo;
-
-}
-
-/*---------------------------------------------------------------------------*\
-
-  phase_experiment()
-
-  Phase quantisation experiments.
-
-\*---------------------------------------------------------------------------*/
-
-void phase_experiment(struct PEXP *pexp, MODEL *model, char *arg) {
-    int              m;
-    float            before[MAX_AMP], best_Wo;
-
-    assert(pexp != NULL);
-    memcpy(before, &model->phi[0], sizeof(float)*MAX_AMP);
-
-    if (strcmp(arg,"q3") == 0) { 
-       quant_phases(model, 1, model->L, 3);
-       update_snr_calc(pexp, model, before);
-       update_variance_calc(pexp, model, before);
-    }
-
-    if (strcmp(arg,"dec2") == 0) {
-       if ((pexp->frames % 2) != 0) {
-           predict_phases(pexp, model, 1, model->L);   
-           update_snr_calc(pexp, model, before);
-           update_variance_calc(pexp, model, before);
-       }
-    }
-
-    if (strcmp(arg,"repeat") == 0) {
-       if ((pexp->frames % 2) != 0) {
-           repeat_phases(pexp, model); 
-           update_snr_calc(pexp, model, before);
-           update_variance_calc(pexp, model, before);
-       }
-    }
-
-    if (strcmp(arg,"vq") == 0) {
-       sparse_vq_pred_error(pexp, model);
-       update_snr_calc(pexp, model, before);
-       update_variance_calc(pexp, model, before);
-    }
-
-    if (strcmp(arg,"pred") == 0) 
-       predict_phases_state(pexp, model, 1, model->L);
-
-    if (strcmp(arg,"pred1k") == 0) 
-       predict_phases(pexp, model, 1, model->L/4);
-
-    if (strcmp(arg,"smooth") == 0) {
-       smooth_phase(pexp, model,0);
-       update_snr_calc(pexp, model, before);
-    }
-    if (strcmp(arg,"smoothtrain") == 0) 
-       smooth_phase(pexp, model,1);
-    if (strcmp(arg,"smoothvq") == 0) {
-       smooth_phase(pexp, model,2);
-       update_snr_calc(pexp, model, before);
-    }
-
-    if (strcmp(arg,"smooth2") == 0) 
-       smooth_phase2(pexp, model);
-    if (strcmp(arg,"smooth3") == 0) 
-       smooth_phase3(pexp, model);
-    if (strcmp(arg,"smooth4") == 0) 
-       smooth_phase4(model);
-    if (strcmp(arg,"vqsmooth3") == 0)  {
-       sparse_vq_pred_error(pexp, model);
-       smooth_phase3(pexp, model);
-    }
-
-    if (strcmp(arg,"cb1") == 0) {
-       cb_phase1(pexp, model);
-       update_snr_calc(pexp, model, before);
-    }
-
-    if (strcmp(arg,"top") == 0) {
-       //top_amp(pexp, model, 1, model->L/4, 4, 1);
-       //top_amp(pexp, model, model->L/4, model->L/3, 4, 1);
-       //top_amp(pexp, model, model->L/3+1, model->L/2, 4, 1);
-       //top_amp(pexp, model, model->L/2, model->L, 6, 1);
-        //rand_phases(model, model->L/2, 3*model->L/4);
-       //struct_phases(pexp, model, model->L/2, 3*model->L/4);
-       //update_snr_calc(pexp, model, before);
-    }
-
-    if (strcmp(arg,"pred23") == 0) {
-       predict_phases2(pexp, model, model->L/2, model->L);
-       update_snr_calc(pexp, model, before);
-    }
-
-    if (strcmp(arg,"struct23") == 0) {
-       struct_phases(pexp, model, model->L/2, 3*model->L/4 );
-       update_snr_calc(pexp, model, before);
-    }
-
-    if (strcmp(arg,"addnoise") == 0) {
-       int m;
-       float max;
-
-       max = 0;
-       for(m=1; m<=model->L; m++)
-           if (model->A[m] > max)
-               max = model->A[m];
-       max = 20.0*log10(max);
-       for(m=1; m<=model->L; m++)
-           if (20.0*log10(model->A[m]) < (max-20)) {
-               model->phi[m] += (PI/4)*(1.0 -2.0*rand()/RAND_MAX);
-               //printf("m %d\n", m);
-           }
-    }
-
-    /* normalise phases */
-
-    for(m=1; m<=model->L; m++)
-       model->phi[m] = atan2(sin(model->phi[m]), cos(model->phi[m]));
-
-    /* update states */
-
-    //best_Wo = refine_Wo(pexp, model,  model->L/2, model->L);
-    pexp->phi1 += N*model->Wo;
-    
-    for(m=1; m<=model->L; m++)
-       pexp->phi_prev[m] = model->phi[m];          
-    pexp->Wo_prev = model->Wo;
-    pexp->frames++;
-    pexp->prev_model = *model;
-}
-
-#ifdef OLD_STUFF
-    //quant_phases(model, 1, model->L, 3);
-    //update_variance_calc(pexp, model, before);
-    //print_sparse_pred_error(pexp, model, 1, model->L, 40.0);
-
-    //sparse_vq_pred_error(pexp, model);
-    //quant_phases(model, model->L/4+1, model->L, 3);
-
-    //predict_phases1(pexp, model, 1, model->L/4);
-    //quant_phases(model, model->L/4+1, model->L, 3);
-
-    //quant_phases(model, 1, model->L/8, 3);
-
-    //update_snr_calc(pexp, model, before);
-    //update_variance_calc(pexp, model, before);
-   
-    //fixed_bits_per_frame(pexp, model, 40);
-    //struct_phases(pexp, model, 1, model->L/4);
-    //rand_phases(model, 10, model->L);
-    //for(m=1; m<=model->L; m++)
-    // model->A[m] = 0.0;
-    //model->A[model->L/2] = 1000;
-    //repeat_phases(model, 20);
-    //predict_phases(pexp, model, 1, model->L/4);
-    //quant_phases(model, 1, 10, 3);
-    //quant_phases(model, 10, 20, 2);
-    //repeat_phases(model, 20);
-    //rand_phases(model, 3*model->L/4, model->L);
-    // print_phi1_pred_error(model, 1, model->L);
-    //predict_phases(pexp, model, 1, model->L/4);
-    //first_order_band(model, model->L/4, model->L/2);
-    //first_order_band(model, model->L/2, 3*model->L/4);
-    //if (fabs(model->Wo - pexp->Wo_prev)< 0.1*model->Wo)
-    
-    //print_pred_error(pexp, model, 1, model->L, 40.0);
-    //print_sparse_pred_error(pexp, model, 1, model->L, 40.0);
-
-    //phi1_est = est_phi1(model, 1, model->L/4);
-    //print_phi1_pred_error(model, 1, model->L/4);
-
-    //first_order_band(model, 1, model->L/4, phi1_est);        
-    //sub_linear(model, 1, model->L/4, phi1_est);
-
-    //top_amp(pexp, model, 1, model->L/4, 4);
-    //top_amp(pexp, model, model->L/4, model->L/2, 4);
-
-    //first_order_band(model, 1, model->L/4, phi1_est);        
-    //first_order_band(model, model->L/4, model->L/2, phi1_est);       
-
-    //if (fabs(model->Wo - pexp->Wo_prev) > 0.2*model->Wo)
-    // rand_phases(model, model->L/2, model->L);
-       
-    //top_amp(pexp, model, 1, model->L/4, 4);
-    //top_amp(pexp, model, model->L/4, model->L/2, 8);
-    //top_amp(pexp, model, model->L/4+1, model->L/2, 10, 1);
-    //top_amp(pexp, model, 1, model->L/4, 10, 1);
-    //top_amp(pexp, model, model->L/4+1, 3*model->L/4, 10, 1);
-    //top_amp(pexp, model, 1, 3*model->L/4, 20, 1);
-
-    #ifdef REAS_CAND1
-    predict_phases(pexp, model, 1, model->L/4);
-    top_amp(pexp, model, model->L/4+1, 3*model->L/4, 10, 1);
-    rand_phases(model, 3*model->L/4+1, model->L);
-    #endif
-
-    #ifdef REAS_CAND2
-    if ((pexp->frames % 2) == 0) {
-       //printf("quant\n");
-       predict_phases(pexp, model, 1, model->L/4);     
-       //top_amp(pexp, model, model->L/4+1, 3*model->L/4, 20, 1);
-       top_amp(pexp, model,  model->L/4+1, 7*model->L/8, 20, 1);
-       rand_phases(model, 7*model->L/8+1, model->L);
-     }
-    else {
-       //printf("predict\n");
-       predict_phases(pexp, model, 1, model->L);
-    }
-    #endif
-
-    //#define REAS_CAND3
-    #ifdef REAS_CAND3
-    if ((pexp->frames % 3) != 0) {
-       printf("pred\n");
-       predict_phases(pexp, model, 1, model->L);       
-    }
-    else {
-       predict_phases(pexp, model, 1, model->L/4);     
-       fixed_bits_per_frame(pexp, model, model->L/4+1, 60);
-    }
-    #endif
-    //predict_phases(pexp, model, model->L/4, model->L);       
-
-    //print_pred_error(pexp, model, 1, model->L);
-    //limit_prediction_error(pexp, model, model->L/2, model->L, PI/2);
-#endif
index 8619c3fc9abfd3ca04f7b0b87e6dcf324a743224..367948dffb843a0b971aee8d274af9b934f1672f 100644 (file)
 
 #include "kiss_fft.h"
 
-void phase_synth_zero_order(kiss_fft_cfg fft_dec_cfg, MODEL *model, float aks[], 
-                            float *ex_phase, int order);
-
-struct PEXP;
-
-struct PEXP * phase_experiment_create();
-void phase_experiment_destroy(struct PEXP *pexp);
-void phase_experiment(struct PEXP *pexp, MODEL *model, char *arg);
+void phase_synth_zero_order(kiss_fft_cfg fft_dec_cfg, 
+                           MODEL *model, 
+                           float aks[], 
+                            float *ex_phase, 
+                           int order);
 
 #endif
diff --git a/codec2-dev/src/phaseexp.c b/codec2-dev/src/phaseexp.c
new file mode 100644 (file)
index 0000000..2cd88b0
--- /dev/null
@@ -0,0 +1,1575 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: phaseexp.c                                           
+  AUTHOR......: David Rowe                                             
+  DATE CREATED: June 2012                                                 
+                                                                             
+  Experimental functions for quantising, modelling and synthesising phase.
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2012 David Rowe
+
+  All rights reserved.
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU Lesser General Public License version 2.1, as
+  published by the Free Software Foundation.  This program is
+  distributed in the hope that it will be useful, but WITHOUT ANY
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+  License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with this program; if not,see <http://www.gnu.org/licenses/>. 
+*/
+
+#include "defines.h"
+#include "phase.h"
+#include "kiss_fft.h"
+#include "comp.h"
+#include "glottal.c"
+
+#include <assert.h>
+#include <ctype.h>
+#include <math.h>
+#include <string.h>
+#include <stdlib.h>
+
+/* Bruce Perens' funcs to load codebook files */
+
+struct codebook {
+    unsigned int        k;
+    unsigned int        log2m;
+    unsigned int        m;
+    COMP                *cb;
+    unsigned int         offset; 
+};
+
+static const char format[] =
+"The table format must be:\n"
+"\tTwo integers describing the dimensions of the codebook.\n"
+"\tThen, enough numbers to fill the specified dimensions.\n";
+
+float get_float(FILE * in, const char * name, char * * cursor, char * buffer, int size)
+{
+  for ( ; ; ) {
+    char *     s = *cursor;
+    char       c;
+
+    while ( (c = *s) != '\0' && !isdigit(c) && c != '-' && c != '.' )
+      s++;
+     
+    /* Comments start with "#" and continue to the end of the line. */
+    if ( c != '\0' && c != '#' ) {
+      char *   end = 0;
+      float    f = 0;
+
+      f = strtod(s, &end);
+
+      if ( end != s )
+        *cursor = end;
+        return f;
+    }
+
+    if ( fgets(buffer, size, in) == NULL ) {
+      fprintf(stderr, "%s: Format error. %s\n", name, format);
+      exit(1);
+    }
+    *cursor = buffer;
+  }
+}
+
+static struct codebook *load(const char * name)
+{
+    FILE               *file;
+    char               line[2048];
+    char               *cursor = line;
+    struct codebook    *b = malloc(sizeof(struct codebook));
+    int                        i;
+    int                        size;
+    float               angle;
+
+    file = fopen(name, "rt");
+    assert(file != NULL);
+
+    *cursor = '\0';
+
+    b->k = (int)get_float(file, name, &cursor, line, sizeof(line));
+    b->m = (int)get_float(file, name ,&cursor, line, sizeof(line));
+    size = b->k * b->m;
+
+    b->cb = (COMP *)malloc(size * sizeof(COMP));
+
+    for ( i = 0; i < size; i++ ) {
+       angle = get_float(file, name, &cursor, line, sizeof(line));
+       b->cb[i].real = cos(angle);
+       b->cb[i].imag = sin(angle);
+    }
+
+    fclose(file);
+
+    return b;
+}
+
+
+/* states for phase experiments */
+
+struct PEXP {
+    float            phi1;
+    float            phi_prev[MAX_AMP];
+    float            Wo_prev;
+    int              frames;
+    float            snr;
+    float            var;
+    int              var_n;
+    struct codebook *vq1,*vq2,*vq3,*vq4,*vq5; 
+    float            vq_var;
+    int              vq_var_n;
+    MODEL            prev_model;
+    int              state;
+};
+
+
+/*---------------------------------------------------------------------------* \
+
+  phase_experiment_create()
+
+  Inits states for phase quantisation experiments.
+
+\*---------------------------------------------------------------------------*/
+
+struct PEXP * phase_experiment_create() {
+    struct PEXP *pexp;
+    int i;
+
+    pexp = (struct PEXP *)malloc(sizeof(struct PEXP));
+    assert (pexp != NULL);
+
+    pexp->phi1 = 0;
+    for(i=0; i<MAX_AMP; i++)
+       pexp->phi_prev[i] = 0.0;
+    pexp->Wo_prev = 0.0;
+    pexp->frames = 0;
+    pexp->snr = 0.0;
+    pexp->var = 0.0;
+    pexp->var_n = 0;
+    
+    /* smoothed 10th order for 1st 1 khz */
+    //pexp->vq1 = load("../unittest/ph1_10_1024.txt");
+    //pexp->vq1->offset = 0;
+
+    /* load experimental phase VQ */
+
+    //pexp->vq1 = load("../unittest/testn1_20_1024.txt");
+    pexp->vq1 = load("../unittest/test.txt");
+    //pexp->vq2 = load("../unittest/testn21_40_1024.txt");
+    pexp->vq2 = load("../unittest/test11_20_1024.txt");
+    pexp->vq3 = load("../unittest/test21_30_1024.txt");
+    pexp->vq4 = load("../unittest/test31_40_1024.txt");
+    pexp->vq5 = load("../unittest/test41_60_1024.txt");
+    pexp->vq1->offset = 0;
+    pexp->vq2->offset = 10;
+    pexp->vq3->offset = 20;
+    pexp->vq4->offset = 30;
+    pexp->vq5->offset = 40;
+
+    pexp->vq_var = 0.0;
+    pexp->vq_var_n = 0;
+
+    pexp->state = 0;
+
+    return pexp;
+}
+
+
+/*---------------------------------------------------------------------------* \
+
+  phase_experiment_destroy()
+
+\*---------------------------------------------------------------------------*/
+
+void phase_experiment_destroy(struct PEXP *pexp) {
+    assert(pexp != NULL);
+    if (pexp->snr != 0.0)
+       printf("snr: %4.2f dB\n", pexp->snr/pexp->frames);
+    if (pexp->var != 0.0)
+       printf("var...: %4.3f  std dev...: %4.3f (%d non zero phases)\n", 
+              pexp->var/pexp->var_n, sqrt(pexp->var/pexp->var_n), pexp->var_n);
+    if (pexp->vq_var != 0.0)
+       printf("vq var: %4.3f  vq std dev: %4.3f (%d non zero phases)\n", 
+              pexp->vq_var/pexp->vq_var_n, sqrt(pexp->vq_var/pexp->vq_var_n), pexp->vq_var_n);
+    free(pexp);
+}
+
+
+/*---------------------------------------------------------------------------* \
+
+  Various test and experimental functions ................
+
+\*---------------------------------------------------------------------------*/
+
+/* Bubblesort to find highest amplitude harmonics */
+
+struct AMPINDEX {
+    float amp;
+    int   index;
+};
+
+static void bubbleSort(struct AMPINDEX numbers[], int array_size)
+{
+    int i, j;
+    struct AMPINDEX temp;
+  for (i = (array_size - 1); i > 0; i--)
+  {
+    for (j = 1; j <= i; j++)
+    {
+       //printf("i %d j %d %f %f \n", i, j, numbers[j-1].amp, numbers[j].amp);
+      if (numbers[j-1].amp < numbers[j].amp)
+      {
+        temp = numbers[j-1];
+        numbers[j-1] = numbers[j];
+        numbers[j] = temp;
+      }
+    }
+  }
+}
+
+
+static void print_pred_error(struct PEXP *pexp, MODEL *model, int start, int end, float mag_thresh) {
+    int   i;
+    float mag;
+
+    mag = 0.0;
+    for(i=start; i<=end; i++)
+       mag += model->A[i]*model->A[i];
+    mag = 10*log10(mag/(end-start));
+    
+    if (mag > mag_thresh) {
+       for(i=start; i<=end; i++) {
+           float pred = pexp->phi_prev[i] + N*i*(model->Wo + pexp->Wo_prev)/2.0;
+           float err = pred - model->phi[i];
+           err = atan2(sin(err),cos(err));
+           printf("%f\n",err);    
+       }
+       //printf("\n");
+    }
+  
+}
+
+
+static void predict_phases(struct PEXP *pexp, MODEL *model, int start, int end) {
+    int i;
+
+    for(i=start; i<=end; i++) {
+       model->phi[i] = pexp->phi_prev[i] + N*i*model->Wo;
+    }
+   
+}
+static float refine_Wo(struct PEXP     *pexp, 
+                      MODEL           *model, 
+                      int              start, 
+                      int              end);
+
+/* Fancy state based phase prediction.  Actually works OK on most utterances,
+   but could use some tuning.  Breaks down a bit on mmt1. */
+
+static void predict_phases_state(struct PEXP *pexp, MODEL *model, int start, int end) {
+    int i, next_state;
+    float best_Wo, dWo;
+
+    //best_Wo = refine_Wo(pexp, model, start, end);
+    //best_Wo = (model->Wo + pexp->Wo_prev)/2.0;
+    best_Wo = model->Wo;
+
+    dWo = fabs(model->Wo - pexp->Wo_prev)/model->Wo;
+    next_state = pexp->state;
+    switch(pexp->state) {
+    case 0:
+       if (dWo < 0.1) {
+           /* UV -> V transition, so start with phases in lock.  They will
+              drift a bit over voiced track which is kinda what we want, so
+              we don't get clicky speech.
+           */
+           next_state = 1;
+           for(i=start; i<=end; i++)
+               pexp->phi_prev[i] = i*pexp->phi1;
+       }
+       
+       break;
+    case 1:
+       if (dWo > 0.1)
+           next_state = 0;
+       break;
+    }
+    pexp->state = next_state;
+
+    if (pexp->state == 0)
+       for(i=start; i<=end; i++) {
+           model->phi[i] = PI*(1.0 - 2.0*rand()/RAND_MAX);
+       }
+    else
+       for(i=start; i<=end; i++) {
+           model->phi[i] = pexp->phi_prev[i] + N*i*best_Wo;
+       }
+    printf("state %d\n", pexp->state);
+}
+
+static void struct_phases(struct PEXP *pexp, MODEL *model, int start, int end) {
+    int i;
+
+    for(i=start; i<=end; i++)
+       model->phi[i] = pexp->phi1*i;
+   
+}
+
+
+static void predict_phases2(struct PEXP *pexp, MODEL *model, int start, int end) {
+    int i;
+    float pred, str, diff;
+
+    for(i=start; i<=end; i++) {
+       pred = pexp->phi_prev[i] + N*i*model->Wo;
+       str = pexp->phi1*i;
+       diff = str - pred;
+       diff = atan2(sin(diff), cos(diff));
+       if (diff > 0)
+           pred += PI/16;
+       else
+           pred -= PI/16;
+       model->phi[i] = pred;
+    }
+   
+}
+
+static void skip_phases(struct PEXP *pexp, MODEL *model, int start, int end) {
+    int i;
+
+    for(i=start; i<=end; i+=2)
+       model->phi[i] = model->phi[i-1] - model->phi[i-2];
+   
+}
+
+static void rand_phases(MODEL *model, int start, int end) {
+    int i;
+
+    for(i=start; i<=end; i++)
+       model->phi[i] = PI*(1.0 - 2.0*(float)rand()/RAND_MAX);
+   
+}
+
+static void quant_phase(float *phase, float min, float max, int bits) {
+    int   levels = 1 << bits; 
+    int   index;
+    float norm, step;
+
+    norm = (*phase - min)/(max - min);
+    index = floor(levels*norm);
+
+    //printf("phase %f norm %f index %d ", *phase, norm, index);
+    if (index < 0 ) index = 0;
+    if (index > (levels-1)) index = levels-1;
+    //printf("index %d ", index);
+    step = (max - min)/levels;
+    *phase = min + step*index + 0.5*step;
+    //printf("step %f phase %f\n", step, *phase);
+}
+
+static void quant_phases(MODEL *model, int start, int end, int bits) {
+    int i;
+
+    for(i=start; i<=end; i++) {
+       quant_phase(&model->phi[i], -PI, PI, bits);
+    }
+}
+
+static void fixed_bits_per_frame(struct PEXP *pexp, MODEL *model, int m, int budget) {
+    int res, finished;
+
+    res = 3;
+    finished = 0;
+
+    while(!finished) {
+       if (m > model->L/2)
+           res = 2;
+       if (((budget - res) < 0) || (m > model->L))
+           finished = 1;
+       else {
+           quant_phase(&model->phi[m], -PI, PI, res);      
+           budget -= res;
+           m++;
+       }
+    }
+    printf("m: %d L: %d budget: %d\n", m, model->L, budget);
+    predict_phases(pexp, model, m, model->L);
+    //rand_phases(model, m, model->L);
+}
+
+/* used to plot histogram of quantisation error, for 3 bits, 8 levels,
+   should be uniform between +/- PI/8 */
+
+static void check_phase_quant(MODEL *model, float tol)
+{
+    int m;
+    float phi_before[MAX_AMP];
+
+    for(m=1; m<=model->L; m++)
+       phi_before[m] = model->phi[m];
+
+    quant_phases(model, 1, model->L, 3);
+
+    for(m=1; m<=model->L; m++) {
+       float err = phi_before[m] - model->phi[m];
+       printf("%f\n", err);
+       if (fabs(err) > tol)
+           exit(0);
+    }
+}
+
+
+static float est_phi1(MODEL *model, int start, int end)
+{
+    int m;
+    float delta, s, c, phi1_est;
+
+    if (end > model->L) 
+       end = model->L;
+
+    s = c = 0.0;
+    for(m=start; m<end; m++) {
+       delta = model->phi[m+1] - model->phi[m];
+       s += sin(delta);
+       c += cos(delta);
+    }
+
+    phi1_est = atan2(s,c);
+    
+    return phi1_est;
+}
+
+static void print_phi1_pred_error(MODEL *model, int start, int end)
+{
+    int m;
+    float phi1_est;
+
+    phi1_est = est_phi1(model, start, end);
+
+    for(m=start; m<end; m++) {
+       float err = model->phi[m+1] - model->phi[m] - phi1_est;
+       err = atan2(sin(err),cos(err));
+       printf("%f\n", err);
+    }
+}
+
+
+static void first_order_band(MODEL *model, int start, int end, float phi1_est)
+{
+    int   m;
+    float pred_err, av_pred_err;
+    float c,s;
+
+    s = c = 0.0;
+    for(m=start; m<end; m++) {
+       pred_err = model->phi[m] - phi1_est*m;
+       s += sin(pred_err);
+       c += cos(pred_err);
+    }
+
+    av_pred_err = atan2(s,c);
+    for(m=start; m<end; m++) {
+       model->phi[m] = av_pred_err + phi1_est*m;
+       model->phi[m] = atan2(sin(model->phi[m]), cos(model->phi[m]));
+    }
+
+}
+
+
+static void sub_linear(MODEL *model, int start, int end, float phi1_est)
+{
+    int   m;
+
+    for(m=start; m<end; m++) {
+       model->phi[m] = m*phi1_est;
+    }
+}
+
+
+static void top_amp(struct PEXP *pexp, MODEL *model, int start, int end, int n_harm, int pred)
+{
+    int removed = 0, not_removed = 0;
+    int top, i, j;
+    struct AMPINDEX sorted[MAX_AMP];
+
+    /* sort into ascending order of amplitude */
+
+    printf("\n");
+    for(i=start,j=0; i<end; i++,j++) {
+       sorted[j].amp = model->A[i];
+       sorted[j].index = i;
+       printf("%f ", model->A[i]);
+    }
+    bubbleSort(sorted, end-start);
+
+    printf("\n");
+    for(j=0; j<n_harm; j++)
+       printf("%d %f\n", j, sorted[j].amp);
+
+    /* keep phase of top n_harm, predict others */
+
+    for(i=start; i<end; i++) {         
+       top = 0;
+       for(j=0; j<n_harm; j++) {
+           if (model->A[i] == sorted[j].amp) {
+               top = 1;
+               assert(i == sorted[j].index);
+           }
+       }
+       
+       #define ALTTOP
+       #ifdef ALTTOP
+       model->phi[i] = 0.0; /* make sure */
+       if (top) {
+           model->phi[i] = i*pexp->phi1;
+           removed++;
+       }
+       else {
+           model->phi[i] = PI*(1.0 - 2.0*(float)rand()/RAND_MAX); // note: try rand for higher harms
+           removed++;
+       }
+       #else
+       if (!top) {
+           model->phi[i] = 0.0; /* make sure */
+           if (pred)  {
+               //model->phi[i] = pexp->phi_prev[i] + i*N*(model->Wo + pexp->Wo_prev)/2.0;
+               model->phi[i] = i*model->phi[1];
+           }
+           else
+               model->phi[i] = PI*(1.0 - 2.0*(float)rand()/RAND_MAX); // note: try rand for higher harms
+           removed++;
+       }
+       else {
+           /* need to make this work thru budget of bits */
+           quant_phase(&model->phi[i], -PI, PI, 3);        
+           not_removed++;
+       }
+       #endif
+    }
+    printf("dim: %d rem %d not_rem %d\n", end-start, removed, not_removed);
+           
+}
+
+    
+static void limit_prediction_error(struct PEXP *pexp, MODEL *model, int start, int end, float limit) 
+{
+    int   i;
+    float pred, pred_error, error;
+
+    for(i=start; i<=end; i++) {
+       pred = pexp->phi_prev[i] + N*i*(model->Wo + pexp->Wo_prev)/2.0;
+       pred_error = pred - model->phi[i]; 
+       pred_error -= TWO_PI*floor((pred_error+PI)/TWO_PI);
+       quant_phase(&pred_error, -limit, limit, 2);     
+       
+       error = pred - pred_error - model->phi[i];
+       error -= TWO_PI*floor((error+PI)/TWO_PI);
+       printf("%f\n", pred_error);
+       model->phi[i] = pred - pred_error;
+    }
+}
+
+
+static void quant_prediction_error(struct PEXP *pexp, MODEL *model, int start, int end, float limit) 
+{
+    int   i;
+    float pred, pred_error;
+
+    for(i=start; i<=end; i++) {
+       pred = pexp->phi_prev[i] + N*i*(model->Wo + pexp->Wo_prev)/2.0;
+       pred_error = pred - model->phi[i]; 
+       pred_error -= TWO_PI*floor((pred_error+PI)/TWO_PI);
+       
+       printf("%f\n", pred_error);
+       model->phi[i] = pred - pred_error;
+    }
+}
+
+
+static void print_sparse_pred_error(struct PEXP *pexp, MODEL *model, int start, int end, float mag_thresh)
+{
+    int    i, index;
+    float  mag, pred, error;
+    float  sparse_pe[MAX_AMP];
+
+    mag = 0.0;
+    for(i=start; i<=end; i++)
+       mag += model->A[i]*model->A[i];
+    mag = 10*log10(mag/(end-start));
+    
+    if (mag > mag_thresh) {
+       for(i=0; i<MAX_AMP; i++) {
+           sparse_pe[i] = 0.0;
+       }
+
+       for(i=start; i<=end; i++) {
+           pred = pexp->phi_prev[i] + N*i*(model->Wo + pexp->Wo_prev)/2.0;
+           error = pred - model->phi[i];
+           error = atan2(sin(error),cos(error));
+
+           index = MAX_AMP*i*model->Wo/PI;
+           assert(index < MAX_AMP);
+           sparse_pe[index] = error;
+       }
+
+       /* dump spare phase vector in polar format */
+
+       for(i=0; i<MAX_AMP; i++)
+           printf("%f ", sparse_pe[i]);
+       printf("\n");
+    }
+}
+
+
+static void update_snr_calc(struct PEXP *pexp, MODEL *model, float before[])
+{
+    int m;
+    float signal, noise, diff;
+
+    signal = 0.0; noise = 0.0;
+    for(m=1; m<=model->L; m++) {           
+       signal += model->A[m]*model->A[m];
+       diff = cos(model->phi[m]) - cos(before[m]);         
+       noise  += pow(model->A[m]*diff, 2.0);
+       diff = sin(model->phi[m]) - sin(before[m]);         
+       noise  += pow(model->A[m]*diff, 2.0);
+       //printf("%f %f\n", before[m], model->phi[m]);
+    }
+    //printf("%f %f snr = %f\n", signal, noise, 10.0*log10(signal/noise));
+    pexp->snr += 10.0*log10(signal/noise);
+}
+
+
+static void update_variance_calc(struct PEXP *pexp, MODEL *model, float before[])
+{
+    int m;
+    float diff;
+
+    for(m=1; m<model->L; m++) {            
+        diff = model->phi[m] - before[m];
+        diff = atan2(sin(diff), cos(diff));
+        pexp->var += diff*diff;
+    }
+    pexp->var_n += model->L;
+}
+
+void print_vec(COMP cb[], int d, int e)
+{
+    int i,j;
+
+    for(j=0; j<e; j++) {
+       for(i=0; i<d; i++) 
+           printf("%f %f ", cb[j*d+i].real, cb[j*d+i].imag);
+       printf("\n");
+    }
+}
+
+static COMP cconj(COMP a)
+{
+    COMP res;
+
+    res.real = a.real;
+    res.imag = -a.imag;
+
+    return res;
+}
+
+static COMP cadd(COMP a, COMP b)
+{
+    COMP res;
+
+    res.real = a.real + b.real;
+    res.imag = a.imag + b.imag;
+
+    return res;
+}
+
+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;
+
+    return res;
+}
+
+static int vq_phase(COMP cb[], COMP vec[], float weights[], int d, int e, float *se)
+{
+   float   error;      /* current error                */
+   int     besti;      /* best index so far            */
+   float   best_error; /* best error so far            */
+   int    i,j;
+   int     ignore;
+   COMP    diffr;
+   float   diffp, metric, best_metric;
+
+   besti = 0;
+   best_metric = best_error = 1E32;
+   for(j=0; j<e; j++) {
+       error = 0.0;
+       metric = 0.0;
+       for(i=0; i<d; i++) {
+           ignore = (vec[i].real == 0.0) && (vec[i].imag == 0.0);
+           if (!ignore) {
+               diffr = cmult(cb[j*d+i], cconj(vec[i]));
+               diffp = atan2(diffr.imag, diffr.real);
+               error  += diffp*diffp;
+               metric += weights[i]*weights[i]*diffp*diffp;
+               //metric += weights[i]*diffp*diffp;
+               //metric = log10(weights[i]*fabs(diffp));
+               //printf("diffp %f metric %f\n", diffp, metric);
+               //if (metric < log10(PI/(8.0*sqrt(3.0))))
+               //   metric = log10(PI/(8.0*sqrt(3.0)));
+           }
+       }
+       if (metric < best_metric) {
+           best_metric = metric;
+           best_error = error;
+           besti = j;
+       }
+   }
+
+   *se += best_error;
+
+   return(besti);
+}
+
+
+static float refine_Wo(struct PEXP     *pexp, 
+                      MODEL           *model, 
+                      int              start, 
+                      int              end)
+
+{
+    int i;
+    float Wo_est, best_var, Wo, var, pred, error, best_Wo;
+
+    /* test variance over a range of Wo values */
+
+    Wo_est = (model->Wo + pexp->Wo_prev)/2.0;
+    best_var = 1E32;
+    for(Wo=0.97*Wo_est; Wo<=1.03*Wo_est; Wo+=0.001*Wo_est) {
+
+       /* predict phase and sum differences between harmonics */
+
+       var = 0.0;
+       for(i=start; i<=end; i++) {
+           pred = pexp->phi_prev[i] + N*i*Wo;
+           error = pred - model->phi[i];
+           error = atan2(sin(error),cos(error));
+           var += error*error;
+       }
+
+       if (var < best_var) {
+           best_var = var;
+           best_Wo = Wo;
+       }
+    }
+
+    return best_Wo;
+}
+
+
+static void split_vq(COMP sparse_pe_out[], struct PEXP *pexp, struct codebook *vq, float weights[], COMP sparse_pe_in[])
+{
+    int i, j, non_zero, vq_ind;
+    
+    //printf("\n offset %d k %d m %d  j: ", vq->offset, vq->k, vq->m);
+    vq_ind = vq_phase(vq->cb, &sparse_pe_in[vq->offset], &weights[vq->offset], vq->k, vq->m, &pexp->vq_var);
+  
+    non_zero = 0;
+    for(i=0, j=vq->offset; i<vq->k; i++,j++) {
+       //printf("%f ", atan2(sparse_pe[i].imag, sparse_pe[i].real));
+       if ((sparse_pe_in[j].real != 0.0) && (sparse_pe_in[j].imag != 0.0)) {
+           //printf("%d ", j);
+           sparse_pe_out[j] = vq->cb[vq->k * vq_ind + i];
+           non_zero++;
+       }
+    }
+    pexp->vq_var_n += non_zero;
+}
+
+
+static void sparse_vq_pred_error(struct PEXP     *pexp, 
+                                MODEL           *model 
+)
+{
+    int              i, index;
+    float            pred, error, error_q_angle, best_Wo;
+    COMP             sparse_pe_in[MAX_AMP], sparse_pe_out[MAX_AMP];
+    float            weights[MAX_AMP];
+    COMP             error_q_rect;
+
+     best_Wo = refine_Wo(pexp, model, 1, model->L);
+    //best_Wo = (model->Wo + pexp->Wo_prev)/2.0;
+
+     /* transform to sparse pred error vector */
+
+    for(i=0; i<MAX_AMP; i++) {
+       sparse_pe_in[i].real = 0.0;
+       sparse_pe_in[i].imag = 0.0;
+       sparse_pe_out[i].real = 0.0;
+       sparse_pe_out[i].imag = 0.0;
+    }
+
+    //printf("\n");
+    for(i=1; i<=model->L; i++) {
+       pred = pexp->phi_prev[i] + N*i*best_Wo;
+       error = pred - model->phi[i];
+
+       index = MAX_AMP*i*model->Wo/PI;
+       assert(index < MAX_AMP);
+       sparse_pe_in[index].real = cos(error);
+       sparse_pe_in[index].imag = sin(error);
+       sparse_pe_out[index] = sparse_pe_in[index];
+       weights[index] = model->A[i];
+       //printf("%d ", index);
+    }
+    
+    /* vector quantise */
+        
+    split_vq(sparse_pe_out, pexp, pexp->vq1, weights, sparse_pe_in);
+    split_vq(sparse_pe_out, pexp, pexp->vq2, weights, sparse_pe_in);
+    split_vq(sparse_pe_out, pexp, pexp->vq3, weights, sparse_pe_in);
+    split_vq(sparse_pe_out, pexp, pexp->vq4, weights, sparse_pe_in);
+    split_vq(sparse_pe_out, pexp, pexp->vq5, weights, sparse_pe_in);
+    
+    /* transform quantised phases back */
+
+    for(i=1; i<=model->L; i++) {
+       pred = pexp->phi_prev[i] + N*i*best_Wo;
+
+       index = MAX_AMP*i*model->Wo/PI;
+       assert(index < MAX_AMP);
+       error_q_rect  = sparse_pe_out[index];
+       error_q_angle = atan2(error_q_rect.imag, error_q_rect.real);
+       model->phi[i] = pred - error_q_angle;
+       model->phi[i] = atan2(sin(model->phi[i]), cos(model->phi[i]));
+    }
+}
+
+
+/*
+  est delta (in Wo)
+  see if this gives us a better (smaller variance) prediction error
+*/
+
+static void print_pred_error_sparse_wo_correction(struct PEXP *pexp, 
+                                                 MODEL *model, 
+                                                 int start, int end, 
+                                                 float mag_thresh)
+{
+    int   i, index;
+    float mag, pred, error[MAX_AMP], diff, c, s, delta, err;
+    float sparse_pe[MAX_AMP];
+
+    mag = 0.0;
+    for(i=start; i<=end; i++)
+       mag += model->A[i]*model->A[i];
+    mag = 10*log10(mag/(end-start));
+    
+    if (mag > mag_thresh) {
+       for(i=0; i<MAX_AMP; i++) {
+           sparse_pe[i] = 0.0;
+       }
+
+       /* predict phase and sum differences between harmonics */
+
+       for(i=start; i<=end; i++) {
+           //model->phi[i] = pexp->phi_prev[i] + N*i*(model->Wo + pexp->Wo_prev)/2.0 + 0.01*N*i;
+           pred = pexp->phi_prev[i] + N*i*(model->Wo + pexp->Wo_prev)/2.0;
+           error[i] = pred - model->phi[i];
+       }
+
+       /* estimate delta Wo */
+
+       c = s = 0.0;
+       for(i=start+1; i<=end; i++) {
+           diff = error[i] - error[i-1];
+           c += log(model->A[i])*cos(diff);
+           s += log(model->A[i])*sin(diff);
+       }
+       delta = atan2(s,c)/N;
+       //printf("delta %f\n",delta);
+       delta = 0;
+       /* now predict phases using corrected Wo */
+       for(i=start; i<=end; i++) {
+           pred = pexp->phi_prev[i] + N*i*(model->Wo + pexp->Wo_prev)/2.0 - N*i*delta;
+           err = pred - model->phi[i];
+           err = atan2(sin(err),cos(err));
+
+           index = MAX_AMP*i*model->Wo/PI;
+           assert(index < MAX_AMP);
+           sparse_pe[index] = err;
+       }
+
+       /* dump spare phase vector in polar format */
+       
+       for(i=0; i<MAX_AMP; i++)
+           printf("%f ", sparse_pe[i]);
+       printf("\n");
+       
+    }
+  
+}
+
+
+static void print_pred_error_sparse_wo_correction1(struct PEXP *pexp, 
+                                                 MODEL *model, 
+                                                 int start, int end, 
+                                                 float mag_thresh)
+{
+    int   i, index;
+    float mag, pred, best_Wo, err;
+    float sparse_pe[MAX_AMP];
+
+    mag = 0.0;
+    for(i=start; i<=end; i++)
+       mag += model->A[i]*model->A[i];
+    mag = 10*log10(mag/(end-start));
+    
+    if (mag > mag_thresh) {
+
+       best_Wo = refine_Wo(pexp, model, start, end);
+
+       /* now predict phases using corrected Wo */
+       for(i=0; i<MAX_AMP; i++) {
+           sparse_pe[i] = 0.0;
+       }
+
+       for(i=start; i<=end; i++) {
+           pred = pexp->phi_prev[i] + N*i*best_Wo;
+           err = pred - model->phi[i];
+           err = atan2(sin(err),cos(err));
+
+           index = MAX_AMP*i*model->Wo/PI;
+           assert(index < MAX_AMP);
+           sparse_pe[index] = err;
+       }
+
+       /* dump spare phase vector in polar format */
+       
+       for(i=0; i<MAX_AMP; i++)
+           printf("%f ", sparse_pe[i]);
+       printf("\n");
+       
+    }
+  
+}
+
+
+static void predict_phases1(struct PEXP *pexp, MODEL *model, int start, int end) {
+    int i;
+    float best_Wo;
+
+    best_Wo = refine_Wo(pexp, model, 1, model->L);
+    
+    for(i=start; i<=end; i++) {
+       model->phi[i] = pexp->phi_prev[i] + N*i*best_Wo;
+    }
+}
+
+
+/*
+  This functions tests theory that some bands can be combined together
+  due to less frequency resolution at higher frequencies.  This will
+  reduce the amount of information we need to encode.
+*/
+
+void smooth_phase(struct PEXP *pexp, MODEL *model, int mode)
+{
+    int    m, i, j, index, step, v, en, nav, st;
+    COMP   sparse_pe_in[MAX_AMP], av;
+    COMP   sparse_pe_out[MAX_AMP];
+    COMP   smoothed[MAX_AMP];
+    float  best_Wo, pred, err;
+    float  weights[MAX_AMP];
+    float  avw, smoothed_weights[MAX_AMP];
+    COMP   smoothed_in[MAX_AMP], smoothed_out[MAX_AMP];
+
+    best_Wo = refine_Wo(pexp, model, 1, model->L);
+
+    for(m=0; m<MAX_AMP; m++) {
+       sparse_pe_in[m].real = sparse_pe_in[m].imag = 0.0;
+       sparse_pe_out[m].real = sparse_pe_out[m].imag = 0.0;
+    }
+
+    /* set up sparse array */
+
+    for(m=1; m<=model->L; m++) {
+       pred = pexp->phi_prev[m] + N*m*best_Wo;
+       err = model->phi[m] - pred;
+       err = atan2(sin(err),cos(err));
+
+       index = MAX_AMP*m*model->Wo/PI;
+       assert(index < MAX_AMP);
+       sparse_pe_in[index].real = model->A[m]*cos(err);
+       sparse_pe_in[index].imag = model->A[m]*sin(err);
+       sparse_pe_out[index] = sparse_pe_in[index];
+       weights[index] = model->A[m];
+    }
+
+    /* now combine samples at high frequencies to reduce dimension */
+
+    step = 2;
+    st = 0;
+    for(i=st,v=0; i<MAX_AMP; i+=step,v++) {
+
+       /* average over one band */
+
+       av.real = 0.0; av.imag = 0.0; avw = 0.0; nav = 0;
+       en = i+step;
+       if (en > (MAX_AMP-1))
+           en = MAX_AMP-1;
+       for(j=i; j<en; j++) {
+           if ((sparse_pe_in[j].real != 0.0) &&(sparse_pe_in[j].imag != 0.0) ) {
+               av = cadd(av, sparse_pe_in[j]);
+               avw += weights[j];
+               nav++;
+           }
+       }
+       if (nav) {
+           smoothed[v] = av;
+           smoothed_weights[v] = avw/nav;
+       }
+       else
+           smoothed[v].real = smoothed[v].imag = 0.0;
+    }
+
+    if (mode == 2) {
+       for(i=0; i<MAX_AMP; i++) {
+           smoothed_in[i] = smoothed[i];
+           smoothed_out[i] = smoothed_in[i];
+       }
+       split_vq(smoothed_out, pexp, pexp->vq1, smoothed_weights, smoothed_in);
+       for(i=0; i<MAX_AMP; i++)
+           smoothed[i] = smoothed_out[i];
+    }
+
+    /* set all samples to smoothed average */
+
+    for(i=st,v=0; i<MAX_AMP; i+=step,v++) {
+       en = i+step;
+       if (en > (MAX_AMP-1))
+           en = MAX_AMP-1;
+       for(j=i; j<en; j++)
+           sparse_pe_out[j] = smoothed[v];
+       if (mode == 1)
+           printf("%f ", atan2(smoothed[v].imag, smoothed[v].real));
+    }
+    if (mode == 1)
+       printf("\n");
+
+    /* convert back to Am */
+    
+    for(m=1; m<=model->L; m++) {
+       index = MAX_AMP*m*model->Wo/PI;
+       assert(index < MAX_AMP);
+       pred = pexp->phi_prev[m] + N*m*best_Wo;
+       err = atan2(sparse_pe_out[index].imag, sparse_pe_out[index].real);
+       model->phi[m] = pred + err;
+    }
+    
+}
+
+/*
+  Another version of a functions that tests the theory that some bands
+  can be combined together due to less frequency resolution at higher
+  frequencies.  This will reduce the amount of information we need to
+  encode.
+*/
+
+void smooth_phase2(struct PEXP *pexp, MODEL *model) {
+    float m;
+    float step;
+    int   a,b,h,i;
+    float best_Wo, pred, err, s,c, phi1_;
+
+    best_Wo = refine_Wo(pexp, model, 1, model->L);
+
+    step = (float)model->L/30;
+    printf("\nL: %d step: %3.2f am,bm: ", model->L, step);
+    for(m=(float)model->L/4; m<=model->L; m+=step) {
+       a = floor(m);
+       b = floor(m+step);
+       if (b > model->L) b = model->L;
+       h = b-a;
+
+       printf("%d,%d,(%d)  ", a, b, h);
+       c = s = 0.0;
+       if (h>1) {
+           for(i=a; i<b; i++) {
+               pred = pexp->phi_prev[i] + N*i*best_Wo;
+               err = model->phi[i] - pred;
+               c += cos(err); s += sin(err);
+           }
+           phi1_ = atan2(s,c);
+           for(i=a; i<b; i++) {
+               pred = pexp->phi_prev[i] + N*i*best_Wo;
+               printf("%d: %4.3f -> ", i, model->phi[i]); 
+               model->phi[i] = pred + phi1_;
+               model->phi[i] = atan2(sin(model->phi[i]),cos(model->phi[i]));
+               printf("%4.3f  ", model->phi[i]); 
+           }
+       }
+    }
+}
+
+
+#define MAX_BINS 40
+//static float bins[] = {2600.0, 2800.0, 3000.0, 3200.0, 3400.0, 3600.0, 3800.0, 4000.0};
+static float bins[] = {/*
+
+                       1000.0, 1100.0, 1200.0, 1300.0, 1400.0, 
+                      1500.0, 1600.0, 1700.0, 1800.0, 1900.0,*/
+
+    2000.0, 2400.0, 2800.0,
+    3000.0, 3400.0, 3600.0, 4000.0};
+
+void smooth_phase3(struct PEXP *pexp, MODEL *model) {
+    int    m, i;
+    int   nbins;
+    int   b;
+    float f, best_Wo, pred, err;
+    COMP  av[MAX_BINS];
+
+    nbins = sizeof(bins)/sizeof(float);
+    best_Wo = refine_Wo(pexp, model, 1, model->L);
+
+    /* clear all bins */
+
+    for(i=0; i<MAX_BINS; i++) {
+       av[i].real = 0.0;
+       av[i].imag = 0.0;
+    }
+
+    /* add phases into each bin */
+
+    for(m=1; m<=model->L; m++) {
+       f = m*model->Wo*FS/TWO_PI;
+       if (f > bins[0]) {
+
+           /* find bin  */
+
+           for(i=0; i<nbins; i++)
+               if ((f > bins[i]) && (f <= bins[i+1]))
+                   b = i;
+           assert(b < MAX_BINS);
+
+           /* est predicted phase from average */
+
+           pred = pexp->phi_prev[m] + N*m*best_Wo; 
+           err = model->phi[m] - pred;
+           av[b].real += cos(err); av[b].imag += sin(err);
+       }
+           
+    }
+
+    /* use averages to est phases */
+
+    for(m=1; m<=model->L; m++) {
+       f = m*model->Wo*FS/TWO_PI;
+       if (f > bins[0]) {
+
+           /* find bin */
+
+           for(i=0; i<nbins; i++)
+               if ((f > bins[i]) && (f <= bins[i+1]))
+                   b = i;
+           assert(b < MAX_BINS);
+
+           /* add predicted phase error to this bin */
+
+           printf("L %d m %d f %4.f b %d\n", model->L, m, f, b);
+
+           pred = pexp->phi_prev[m] + N*m*best_Wo;
+           err = atan2(av[b].imag, av[b].real);
+           printf(" %d: %4.3f -> ", m, model->phi[m]); 
+           model->phi[m] = pred + err;
+           model->phi[m] = atan2(sin(model->phi[m]),cos(model->phi[m]));
+           printf("%4.3f\n", model->phi[m]); 
+       }
+    }
+    printf("\n");
+}
+
+
+/* 
+   Try to code the phase of the largest amplitude in each band.  Randomise the
+   phase of the other harmonics. The theory is that only the largest harmonic
+   will be audible.
+*/
+
+void cb_phase1(struct PEXP *pexp, MODEL *model) {
+    int   m, i;
+    int   nbins;
+    int   b;
+    float f, best_Wo;
+    float max_val[MAX_BINS];
+    int   max_ind[MAX_BINS];
+
+    nbins = sizeof(bins)/sizeof(float);
+    best_Wo = refine_Wo(pexp, model, 1, model->L);
+
+    for(i=0; i<nbins; i++)
+       max_val[i] = 0.0;
+
+    /* determine max amplitude for each bin */
+
+    for(m=1; m<=model->L; m++) {
+       f = m*model->Wo*FS/TWO_PI;
+       if (f > bins[0]) {
+
+           /* find bin  */
+
+           for(i=0; i<nbins; i++)
+               if ((f > bins[i]) && (f <= bins[i+1]))
+                   b = i;
+           assert(b < MAX_BINS);
+
+           if (model->A[m] > max_val[b]) {
+               max_val[b] = model->A[m];
+               max_ind[b] = m;
+           }
+       }
+           
+    }
+
+    /* randomise phase of other harmonics */
+
+    for(m=1; m<=model->L; m++) {
+       f = m*model->Wo*FS/TWO_PI;
+       if (f > bins[0]) {
+
+           /* find bin */
+
+           for(i=0; i<nbins; i++)
+               if ((f > bins[i]) && (f <= bins[i+1]))
+                   b = i;
+           assert(b < MAX_BINS);
+
+           if (m != max_ind[b])
+               model->phi[m] = pexp->phi_prev[m] + N*m*best_Wo;
+       }
+    }
+}
+
+
+/* 
+   Theory is only the phase of the envelope of signal matters within a
+   Critical Band. So we estimate the position of an impulse that
+   approximates the envelope of the signal.
+*/
+
+void cb_phase2(struct PEXP *pexp, MODEL *model) {
+    int   st, m, i, a, b, step;
+    float diff,w,c,s,phi1_;
+    float A[MAX_AMP];
+
+    for(m=1; m<=model->L; m++) {
+       A[m] = model->A[m];
+       model->A[m] = 0;
+    }
+
+    st = 2*model->L/4;
+    step = 3;
+    model->phi[1] = pexp->phi_prev[1] + (pexp->Wo_prev+model->Wo)*N/2.0;
+
+    printf("L=%d ", model->L);
+    for(m=st; m<st+step*2; m+=step) {
+       a = m; b=a+step;
+       if (b > model->L)
+           b = model->L;
+       
+       c = s = 0;
+       for(i=a; i<b-1; i++) {
+           printf("diff %d,%d ", i, i+1);
+           diff = model->phi[i+1] - model->phi[i];
+           //w = (model->A[i+1] + model->A[i])/2; 
+           w = 1.0;
+           c += w*cos(diff); s += w*sin(diff);
+       }
+       phi1_ = atan2(s,c);
+       printf("replacing: ");
+       for(i=a; i<b; i++) {
+           //model->phi[i] = i*phi1_;
+           //model->phi[i] = i*model->phi[1];
+           //model->phi[i] = m*(pexp->Wo_prev+model->Wo)*N/2.0;
+           model->A[m] = A[m];
+           printf("%d ", i);
+       }
+       printf(" . ");
+    }
+    printf("\n");
+}
+
+
+static void smooth_phase4(MODEL *model) {
+    int    m;
+    float  phi_m, phi_m_1;
+
+    if (model->L > 25) {
+       printf("\nL %d\n", model->L);
+       for(m=model->L/2; m<=model->L; m+=2) {
+           if ((m+1) <= model->L) {
+               phi_m   = (model->phi[m] - model->phi[m+1])/2.0;
+               phi_m_1 = (model->phi[m+1] - model->phi[m])/2.0;
+               model->phi[m] = phi_m;
+               model->phi[m+1] = phi_m_1;
+               printf("%d %4.3f %4.3f  ", m, phi_m, phi_m_1);
+           }
+       }
+    }
+
+}
+
+/* try repeating last frame, just advance phases to account for time shift */
+
+static void repeat_phases(struct PEXP *pexp, MODEL *model) {
+    int m;
+
+    *model = pexp->prev_model;
+    for(m=1; m<=model->L; m++)
+       model->phi[m] += N*m*model->Wo;
+
+}
+
+/*---------------------------------------------------------------------------*\
+
+  phase_experiment()
+
+  Phase quantisation experiments.
+
+\*---------------------------------------------------------------------------*/
+
+void phase_experiment(struct PEXP *pexp, MODEL *model, char *arg) {
+    int              m;
+    float            before[MAX_AMP], best_Wo;
+
+    assert(pexp != NULL);
+    memcpy(before, &model->phi[0], sizeof(float)*MAX_AMP);
+
+    if (strcmp(arg,"q3") == 0) { 
+       quant_phases(model, 1, model->L, 3);
+       update_snr_calc(pexp, model, before);
+       update_variance_calc(pexp, model, before);
+    }
+
+    if (strcmp(arg,"dec2") == 0) {
+       if ((pexp->frames % 2) != 0) {
+           predict_phases(pexp, model, 1, model->L);   
+           update_snr_calc(pexp, model, before);
+           update_variance_calc(pexp, model, before);
+       }
+    }
+
+    if (strcmp(arg,"repeat") == 0) {
+       if ((pexp->frames % 2) != 0) {
+           repeat_phases(pexp, model); 
+           update_snr_calc(pexp, model, before);
+           update_variance_calc(pexp, model, before);
+       }
+    }
+
+    if (strcmp(arg,"vq") == 0) {
+       sparse_vq_pred_error(pexp, model);
+       update_snr_calc(pexp, model, before);
+       update_variance_calc(pexp, model, before);
+    }
+
+    if (strcmp(arg,"pred") == 0) 
+       predict_phases_state(pexp, model, 1, model->L);
+
+    if (strcmp(arg,"pred1k") == 0) 
+       predict_phases(pexp, model, 1, model->L/4);
+
+    if (strcmp(arg,"smooth") == 0) {
+       smooth_phase(pexp, model,0);
+       update_snr_calc(pexp, model, before);
+    }
+    if (strcmp(arg,"smoothtrain") == 0) 
+       smooth_phase(pexp, model,1);
+    if (strcmp(arg,"smoothvq") == 0) {
+       smooth_phase(pexp, model,2);
+       update_snr_calc(pexp, model, before);
+    }
+
+    if (strcmp(arg,"smooth2") == 0) 
+       smooth_phase2(pexp, model);
+    if (strcmp(arg,"smooth3") == 0) 
+       smooth_phase3(pexp, model);
+    if (strcmp(arg,"smooth4") == 0) 
+       smooth_phase4(model);
+    if (strcmp(arg,"vqsmooth3") == 0)  {
+       sparse_vq_pred_error(pexp, model);
+       smooth_phase3(pexp, model);
+    }
+
+    if (strcmp(arg,"cb1") == 0) {
+       cb_phase1(pexp, model);
+       update_snr_calc(pexp, model, before);
+    }
+
+    if (strcmp(arg,"top") == 0) {
+       //top_amp(pexp, model, 1, model->L/4, 4, 1);
+       //top_amp(pexp, model, model->L/4, model->L/3, 4, 1);
+       //top_amp(pexp, model, model->L/3+1, model->L/2, 4, 1);
+       //top_amp(pexp, model, model->L/2, model->L, 6, 1);
+        //rand_phases(model, model->L/2, 3*model->L/4);
+       //struct_phases(pexp, model, model->L/2, 3*model->L/4);
+       //update_snr_calc(pexp, model, before);
+    }
+
+    if (strcmp(arg,"pred23") == 0) {
+       predict_phases2(pexp, model, model->L/2, model->L);
+       update_snr_calc(pexp, model, before);
+    }
+
+    if (strcmp(arg,"struct23") == 0) {
+       struct_phases(pexp, model, model->L/2, 3*model->L/4 );
+       update_snr_calc(pexp, model, before);
+    }
+
+    if (strcmp(arg,"addnoise") == 0) {
+       int m;
+       float max;
+
+       max = 0;
+       for(m=1; m<=model->L; m++)
+           if (model->A[m] > max)
+               max = model->A[m];
+       max = 20.0*log10(max);
+       for(m=1; m<=model->L; m++)
+           if (20.0*log10(model->A[m]) < (max-20)) {
+               model->phi[m] += (PI/4)*(1.0 -2.0*rand()/RAND_MAX);
+               //printf("m %d\n", m);
+           }
+    }
+
+    /* normalise phases */
+
+    for(m=1; m<=model->L; m++)
+       model->phi[m] = atan2(sin(model->phi[m]), cos(model->phi[m]));
+
+    /* update states */
+
+    //best_Wo = refine_Wo(pexp, model,  model->L/2, model->L);
+    pexp->phi1 += N*model->Wo;
+    
+    for(m=1; m<=model->L; m++)
+       pexp->phi_prev[m] = model->phi[m];          
+    pexp->Wo_prev = model->Wo;
+    pexp->frames++;
+    pexp->prev_model = *model;
+}
+
+#ifdef OLD_STUFF
+    //quant_phases(model, 1, model->L, 3);
+    //update_variance_calc(pexp, model, before);
+    //print_sparse_pred_error(pexp, model, 1, model->L, 40.0);
+
+    //sparse_vq_pred_error(pexp, model);
+    //quant_phases(model, model->L/4+1, model->L, 3);
+
+    //predict_phases1(pexp, model, 1, model->L/4);
+    //quant_phases(model, model->L/4+1, model->L, 3);
+
+    //quant_phases(model, 1, model->L/8, 3);
+
+    //update_snr_calc(pexp, model, before);
+    //update_variance_calc(pexp, model, before);
+   
+    //fixed_bits_per_frame(pexp, model, 40);
+    //struct_phases(pexp, model, 1, model->L/4);
+    //rand_phases(model, 10, model->L);
+    //for(m=1; m<=model->L; m++)
+    // model->A[m] = 0.0;
+    //model->A[model->L/2] = 1000;
+    //repeat_phases(model, 20);
+    //predict_phases(pexp, model, 1, model->L/4);
+    //quant_phases(model, 1, 10, 3);
+    //quant_phases(model, 10, 20, 2);
+    //repeat_phases(model, 20);
+    //rand_phases(model, 3*model->L/4, model->L);
+    // print_phi1_pred_error(model, 1, model->L);
+    //predict_phases(pexp, model, 1, model->L/4);
+    //first_order_band(model, model->L/4, model->L/2);
+    //first_order_band(model, model->L/2, 3*model->L/4);
+    //if (fabs(model->Wo - pexp->Wo_prev)< 0.1*model->Wo)
+    
+    //print_pred_error(pexp, model, 1, model->L, 40.0);
+    //print_sparse_pred_error(pexp, model, 1, model->L, 40.0);
+
+    //phi1_est = est_phi1(model, 1, model->L/4);
+    //print_phi1_pred_error(model, 1, model->L/4);
+
+    //first_order_band(model, 1, model->L/4, phi1_est);        
+    //sub_linear(model, 1, model->L/4, phi1_est);
+
+    //top_amp(pexp, model, 1, model->L/4, 4);
+    //top_amp(pexp, model, model->L/4, model->L/2, 4);
+
+    //first_order_band(model, 1, model->L/4, phi1_est);        
+    //first_order_band(model, model->L/4, model->L/2, phi1_est);       
+
+    //if (fabs(model->Wo - pexp->Wo_prev) > 0.2*model->Wo)
+    // rand_phases(model, model->L/2, model->L);
+       
+    //top_amp(pexp, model, 1, model->L/4, 4);
+    //top_amp(pexp, model, model->L/4, model->L/2, 8);
+    //top_amp(pexp, model, model->L/4+1, model->L/2, 10, 1);
+    //top_amp(pexp, model, 1, model->L/4, 10, 1);
+    //top_amp(pexp, model, model->L/4+1, 3*model->L/4, 10, 1);
+    //top_amp(pexp, model, 1, 3*model->L/4, 20, 1);
+
+    #ifdef REAS_CAND1
+    predict_phases(pexp, model, 1, model->L/4);
+    top_amp(pexp, model, model->L/4+1, 3*model->L/4, 10, 1);
+    rand_phases(model, 3*model->L/4+1, model->L);
+    #endif
+
+    #ifdef REAS_CAND2
+    if ((pexp->frames % 2) == 0) {
+       //printf("quant\n");
+       predict_phases(pexp, model, 1, model->L/4);     
+       //top_amp(pexp, model, model->L/4+1, 3*model->L/4, 20, 1);
+       top_amp(pexp, model,  model->L/4+1, 7*model->L/8, 20, 1);
+       rand_phases(model, 7*model->L/8+1, model->L);
+     }
+    else {
+       //printf("predict\n");
+       predict_phases(pexp, model, 1, model->L);
+    }
+    #endif
+
+    //#define REAS_CAND3
+    #ifdef REAS_CAND3
+    if ((pexp->frames % 3) != 0) {
+       printf("pred\n");
+       predict_phases(pexp, model, 1, model->L);       
+    }
+    else {
+       predict_phases(pexp, model, 1, model->L/4);     
+       fixed_bits_per_frame(pexp, model, model->L/4+1, 60);
+    }
+    #endif
+    //predict_phases(pexp, model, model->L/4, model->L);       
+
+    //print_pred_error(pexp, model, 1, model->L);
+    //limit_prediction_error(pexp, model, model->L/2, model->L, PI/2);
+#endif
diff --git a/codec2-dev/src/phaseexp.h b/codec2-dev/src/phaseexp.h
new file mode 100644 (file)
index 0000000..b43db75
--- /dev/null
@@ -0,0 +1,39 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: phaseexp.h                                          
+  AUTHOR......: David Rowe                                             
+  DATE CREATED: June 2012                                                
+                                                                             
+  Experimental functions for quantising, modelling and synthesising phase.
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2012 David Rowe
+
+  All rights reserved.
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU Lesser General Public License version 2.1, as
+  published by the Free Software Foundation.  This program is
+  distributed in the hope that it will be useful, but WITHOUT ANY
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+  License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with this program; if not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __PHASEEXP__
+#define __PHASEEXP__
+
+#include "kiss_fft.h"
+
+struct PEXP;
+
+struct PEXP * phase_experiment_create();
+void phase_experiment_destroy(struct PEXP *pexp);
+void phase_experiment(struct PEXP *pexp, MODEL *model, char *arg);
+
+#endif
index bc9545a1c335f7e9f11f053e210c06031d61ec2e..0c3fbf39d92b41814c06a734bbc18f255580963c 100644 (file)
@@ -518,54 +518,183 @@ void lspjvm_quantise(float *x, float *xq, int ndim)
   }
 }
 
-/* 3 stage VQ LSP quantsier kindly submitted by Anssi, OH3GDD */
+#define MBEST_STAGES 3
 
-void lspanssi_quantise(float *x, float *xq, int ndim)
+struct MBEST_LIST {
+    int   index[MBEST_STAGES];    /* index of each stage that lead us to this error */
+    float error;
+};
+
+struct MBEST {
+    int                entries;   /* number of entries in mbest list   */
+    struct MBEST_LIST *list;
+};
+
+
+static struct MBEST *mbest_create(int entries) {
+    int           i,j;
+    struct MBEST *mbest;
+
+    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);
+
+    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;
+}
+
+
+static void mbest_destroy(struct MBEST *mbest) {
+    assert(mbest != NULL);
+    free(mbest->list);
+    free(mbest);
+}
+
+
+/*---------------------------------------------------------------------------*\
+
+  mbest_insert
+
+  Insert the results of a vector to codebook entry comparison.  the
+  list is in order of ascending error, so those codebook entries with the
+  smallest error will be first on the list.
+
+\*---------------------------------------------------------------------------*/
+
+static 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; i<entries && !found; i++)
+       if (error < list[i].error) {
+           found = 1;
+           for(j=entries-1; j>i; j--)
+               list[j] = list[j-1];
+           for(j=0; j<MBEST_STAGES; j++)
+               list[i].index[j] = index[j];
+           list[i].error = error;
+       }
+}
+
+
+static void mbest_print(char title[], struct MBEST *mbest) {
+    int i,j;
+    
+    printf("%s\n", title);
+    for(i=0; i<mbest->entries; i++) {
+       for(j=0; j<MBEST_STAGES; j++)
+           printf("  %4d ", mbest->list[i].index[j]);
+       printf(" %f\n", mbest->list[i].error);
+    }
+}
+
+
+/*---------------------------------------------------------------------------*\
+
+  mbest_search
+
+  Searches vec[] to a codebbook of vectors, and maintains a list of the mbest
+  closest matches.
+
+\*---------------------------------------------------------------------------*/
+
+static 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     */
+) 
 {
-  int i, n1, n2, n3;
-  float e, err1[LPC_ORD], err2[LPC_ORD], err3[LPC_ORD];
+   float   e;
+   int     i,j;
+   float   diff;
+
+   for(j=0; j<m; j++) {
+       e = 0.0;
+       for(i=0; i<k; i++) {
+           diff = cb[j*k+i]-vec[i];
+           e += pow(diff*w[i],2.0);
+       }
+       index[0] = j;
+       mbest_insert(mbest, index, e);
+   }
+}
+
+
+/* 3 stage VQ LSP quantiser.  Design and guidance kindly submitted by Anssi, OH3GDD */
+
+void lspanssi_quantise(float *x, float *xq, int ndim, int mbest_entries)
+{
+    int i, j, n1, n2, n3;
   float w[LPC_ORD];
   const float *codebook1 = lsp_cbvqanssi[0].cb;
   const float *codebook2 = lsp_cbvqanssi[1].cb;
   const float *codebook3 = lsp_cbvqanssi[2].cb;
-
+  struct MBEST *mbest_stage1, *mbest_stage2, *mbest_stage3;
+  float target[LPC_ORD];
+  int   index[MBEST_STAGES];
+
+  mbest_stage1 = mbest_create(mbest_entries);
+  mbest_stage2 = mbest_create(mbest_entries);
+  mbest_stage3 = mbest_create(mbest_entries);
+  for(i=0; i<MBEST_STAGES; i++)
+      index[i] = 0;
+  
   compute_weights_anssi(x, w, ndim);
+
   #ifdef DUMP
   dump_weights(w, ndim);
   #endif
 
-  n1 = find_nearest_weighted(codebook1, lsp_cbvqanssi[0].m, x, w, ndim);
-  
-  e = 0.0;
-  for (i=0;i<ndim;i++)
-  {
-      xq[i] = codebook1[ndim*n1+i];
-      err1[i] = x[i] - xq[i];
-      e += err1[i]*err1[i];
+  /* Stage 1 */
+
+  mbest_search(codebook1, x, w, ndim, lsp_cbvqanssi[0].m, mbest_stage1, index);
+  mbest_print("Stage 1:", mbest_stage1);
+
+  /* Stage 2 */
+
+  for (j=0; j<mbest_entries; j++) {
+      index[1] = n1 = mbest_stage1->list[j].index[0];
+      for(i=0; i<ndim; i++)
+         target[i] = x[i] - codebook1[ndim*n1+i];
+      mbest_search(codebook2, target, w, ndim, lsp_cbvqanssi[1].m, mbest_stage2, index);      
   }
-  //printf("error1: %f\n", e);
+  mbest_print("Stage 2:", mbest_stage2);
 
-  n2 = find_nearest_weighted(codebook2, lsp_cbvqanssi[1].m, err1, w, ndim);
+  /* Stage 3 */
 
-  e = 0.0;
-  for (i=0;i<ndim;i++)
-  {
-      xq[i] += codebook2[ndim*n2+i];
-      err2[i] = x[i] - xq[i];
-      e += err2[i]*err2[i];
+  for (j=0; j<mbest_entries; j++) {
+      index[2] = n1 = mbest_stage2->list[j].index[1];
+      index[1] = n2 = mbest_stage2->list[j].index[0];
+      for(i=0; i<ndim; i++)
+         target[i] = x[i] - codebook1[ndim*n1+i] - codebook2[ndim*n2+i];
+      mbest_search(codebook3, target, w, ndim, lsp_cbvqanssi[2].m, mbest_stage3, index);      
   }
-  //printf("error2: %f\n", e);
+  mbest_print("Stage 3:", mbest_stage3);
 
-  n3 = find_nearest_weighted(codebook3, lsp_cbvqanssi[2].m, err2, w, ndim);
-  
-  e = 0.0;
+  n1 = mbest_stage3->list[0].index[2];
+  n2 = mbest_stage3->list[0].index[1];
+  n3 = mbest_stage3->list[0].index[0];
   for (i=0;i<ndim;i++)
-  {
-      xq[i] += codebook3[ndim*n3+i];
-      err3[i] = x[i] - xq[i];
-      e += err3[i]*err3[i];
-  }
-  //printf("error3: %f\n", e);
+      xq[i] = codebook1[ndim*n1+i] + codebook2[ndim*n2+i] + codebook3[ndim*n3+i];
+
+  mbest_destroy(mbest_stage1);
+  mbest_destroy(mbest_stage2);
+  mbest_destroy(mbest_stage3);
 }
 
 int check_lsp_order(float lsp[], int lpc_order)
index 4594a121d06399974c33eb245fc7850b01afcb06..ccf7a31c7151dc69abe1dfb194e615fb9667988e 100644 (file)
@@ -82,7 +82,7 @@ void lspvq_quantise(float lsp[], float lsp_[], int order);
 void lspjnd_quantise(float lsp[], float lsp_[], int order);
 void lspdt_quantise(float lsps[], float lsps_[], float lsps__prev[], int mode);
 void lspjvm_quantise(float lsps[], float lsps_[], int order);
-void lspanssi_quantise(float lsps[], float lsps_[], int order);
+void lspanssi_quantise(float lsps[], float lsps_[], int order, int mbest_entries);
 
 void quantise_WoE(MODEL *model, float *e, float xq[]);
 int  encode_WoE(MODEL *model, float e, float xq[]);
index fccd4cfc6857908c1d0daef165a1fb2475a80f2c..f68d882830e401785f9f2d30a333bd8e1f1ad5f8 100644 (file)
@@ -65,6 +65,7 @@ void norm(float v[], int k, int n[]);
 int quantise(float cb[], float vec[], int d, int e, float *se);
 void print_vec(float cb[], int d, int e);
 void split(float cb[], int d, int b);
+int gain_shape_quantise(float cb[], float vec[], int d, int e, float *se, float *best_gain);
 
 /*-----------------------------------------------------------------------* \
 
@@ -93,8 +94,8 @@ int main(int argc, char *argv[]) {
 
     /* Interpret command line arguments */
 
-    if (argc != 5)     {
-       printf("usage: %s TrainFile D(dimension) B(number of bits) VQFile\n", argv[0]);
+    if (argc < 5)      {
+       printf("usage: %s TrainFile D(dimension) B(number of bits) VQFile [error.txt file]\n", argv[0]);
        exit(1);
     }
 
@@ -165,8 +166,8 @@ int main(int argc, char *argv[]) {
     /* main loop */
 
     printf("\n");
-    printf("bits  Iteration  delta  var    std dev\n");
-    printf("--------------------------------------\n");
+    printf("bits  Iteration  delta  var     std dev\n");
+    printf("---------------------------------------\n");
 
     for(b=1; b<=bits; b++) {
        levels = 1<<b;
@@ -201,6 +202,10 @@ int main(int argc, char *argv[]) {
            for(i=0; i<J; i++) {
                ret = fread(vec, sizeof(float), d, ftrain);
                ind = quantise(cb, vec, d, levels, &se);
+               //ind = gain_shape_quantise(cb, vec, d, levels, &se, &best_gain);
+               //for(j=0; j<d; j++)
+               //          if (vec[j] != 0.0)
+               //      vec[j] += best_gain;
                 #ifdef DBG
                print_vec(vec, d, 1);
                printf("      ind %d se: %f\n", ind, se);
@@ -233,13 +238,15 @@ int main(int argc, char *argv[]) {
                    finished = 1;
            }      
                     
-           /* determine new codebook from centroids */
+           if (!finished) {
+               /* determine new codebook from centroids */
 
-           for(i=0; i<levels; i++) {
-               norm(&cent[i*d], d, &n[i*d]);
-               memcpy(&cb[i*d], &cent[i*d], d*sizeof(float));
+               for(i=0; i<levels; i++) {
+                   norm(&cent[i*d], d, &n[i*d]);
+                   memcpy(&cb[i*d], &cent[i*d], d*sizeof(float));
+               }
            }
-       
+
             #ifdef DBG
            printf("new cb ...\n");
            print_vec(cent, d, e);
@@ -273,6 +280,24 @@ int main(int argc, char *argv[]) {
     }
     fclose(fvq);
 
+    /* optionally dump error file for multi-stage work */
+
+    if (argc == 6) {   
+       FILE *ferr = fopen(argv[5],"wt");
+       assert(ferr != NULL);   
+       rewind(ftrain);
+       for(i=0; i<J; i++) {
+           ret = fread(vec, sizeof(float), d, ftrain);
+           ind = quantise(cb, vec, d, levels, &se);
+           for(j=0; j<d; j++) {
+               if (vec[j] != 0.0)
+                   vec[j] -= cb[ind*d+j];
+               fprintf(ferr, "%f ", vec[j]);
+           }
+           fprintf(ferr, "\n");
+       }
+    }
+
     return 0;
 }
 
@@ -403,6 +428,54 @@ int quantise(float cb[], float vec[], int d, int e, float *se)
    return(besti);
 }
 
+int gain_shape_quantise(float cb[], float vec[], int d, int e, float *se, float *best_gain)
+{
+   float   error;      /* current error                */
+   int     besti;      /* best index so far            */
+   float   best_error; /* best error so far            */
+   int    i,j,m;
+   float   diff, metric, best_metric, gain, sumAm, sumCb;
+
+   besti = 0;
+   best_metric = best_error = 1E32;
+   for(j=0; j<e; j++) {
+
+       /* compute optimum gain */
+
+       sumAm = sumCb = 0.0;
+       m = 0;
+       for(i=0; i<d; i++) {
+          if (vec[i] != 0.0) {
+              m++;
+              sumAm += vec[i];
+              sumCb += cb[j*d+i];
+          }
+       }
+       gain = (sumAm - sumCb)/m;
+       
+       /* compute error */
+
+       metric = error = 0.0;
+       for(i=0; i<d; i++) {
+          if (vec[i] != 0.0) {
+              diff = vec[i] - cb[j*d+i] - gain;
+              error += diff*diff;
+              metric += diff*diff;
+          }
+       }
+       if (metric < best_metric) {
+          best_error = error;
+          best_metric = metric;
+          *best_gain = gain;
+          besti = j;
+       }
+   }
+
+   *se += best_error;
+
+   return(besti);
+}
+
 void split(float cb[], int d, int levels)
 {
     int i,j;